Bug 240768

Summary: linux(4): 'openssl speed rsa' segfaults
Product: Base System Reporter: Edward Tomasz Napierala <trasz>
Component: kernAssignee: freebsd-emulation mailing list <emulation>
Status: New ---    
Severity: Affects Only Me CC: cem
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Edward Tomasz Napierala freebsd_committer 2019-09-23 12:42:57 UTC
Ubuntu's openssl (1.1.1b-1ubuntu2.1 amd64) crashes like this:

# openssl speed rsa
Doing 512 bits private rsa's for 10s: 236319 512 bits private RSA's in 10.06s
Doing 512 bits public rsa's for 10s: 4137009 512 bits public RSA's in 10.10s
Doing 1024 bits private rsa's for 10s: Segmentation fault (core dumped)
Comment 1 Conrad Meyer freebsd_committer 2019-09-23 15:30:32 UTC
Which glibc?  Have you looked at the core / do you have a stack?
Comment 2 Edward Tomasz Napierala freebsd_committer 2019-09-23 15:39:28 UTC
GNU C Library (Ubuntu GLIBC 2.29-0ubuntu2) stable release version 2.29.  I don't have a working core (linuxulator coredumps are not particularly useful), I'm afraid.  However, I've just noticed it's somewhat random: this time I got:

# openssl speed rsa
Doing 512 bits private rsa's for 10s: 197105 512 bits private RSA's in 10.02s
Doing 512 bits public rsa's for 10s: 3558737 512 bits public RSA's in 10.03s
Doing 1024 bits private rsa's for 10s: 96450 1024 bits private RSA's in 10.09s
Doing 1024 bits public rsa's for 10s: 1412783 1024 bits public RSA's in 10.07s
Doing 2048 bits private rsa's for 10s: Segmentation fault (core dumped)
Comment 3 Conrad Meyer freebsd_committer 2019-09-23 17:16:01 UTC
Does Linux GDB work in linuxulator?  I'm pretty unfamiliar.  Getting cores working seems very useful.
Comment 4 Conrad Meyer freebsd_committer 2019-09-23 17:16:23 UTC
(In reply to Conrad Meyer from comment #3)
(By which I meant, live debugging, as opposed to post-facto core inspection.)
Comment 5 Edward Tomasz Napierala freebsd_committer 2019-09-23 17:23:47 UTC
It doesn't, I'm afraid.  I have some patches that improve the situation a bit, but they are not enough to make it work properly yet.

Regarding core files - the ones we generate have FreeBSD stuff in them, so Linux gdb can't use them; our native gdb, on the other hand, refuses to touch Linux executables.
Comment 6 Conrad Meyer freebsd_committer 2019-09-23 18:20:02 UTC
Re: core files -- yeah, I have a vague recollection of something like that.  At the end of the day, it's one or more bugs.  It seems like something that can be fixed, from one end or the other (or both).
Comment 7 Edward Tomasz Napierala freebsd_committer 2020-01-28 16:25:08 UTC
Hah; not sure how could I miss this:

time(NULL)                              = 1580227238 (2020-01-28T11:00:38-0500)
time(NULL)                              = 1580227238 (2020-01-28T11:00:38-0500)
time(NULL)                              = 1580227238 (2020-01-28T11:00:38-0500)
time(NULL)                              = 1580227238 (2020-01-28T11:00:38-0500)
time(NULL)                              = 1580227238 (2020-01-28T11:00:38-0500)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigaction(SIGALRM, {sa_handler=0x108da00, sa_mask=[ALRM], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x802c37a20}, {sa_handler=0x108da00, sa_mask=[ALRM], sa_flags=SA_RESTART}, 8) = 0
rt_sigreturn({mask=[]})                 = 15611098741728140169
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault

Funnily enough, previous SIGLARMs work... kind of:

time(NULL)                              = 1580227218 (2020-01-28T11:00:18-0500)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---                          
rt_sigaction(SIGALRM, {sa_handler=0x108da00, sa_mask=[ALRM], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x802c37a20}, {sa_handler=0x108da00, sa_mask=[ALRM], sa_flags=SA_RESTART}, 8) = 0
rt_sigreturn({mask=[]})                 = 7816104742323179296     



times({tms_utime=947, tms_stime=45, tms_cutime=0, tms_cstime=0}) = 955958      
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL, si_errno=-512} ---           
rt_sigaction(SIGALRM, {sa_handler=0x108da00, sa_mask=[ALRM], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x802c37a20}, {sa_handler=0x108da00, sa_mask=[ALRM], sa_flags=SA_RESTART}, 8) = 0
rt_sigreturn({mask=[]})                 = -1 EPERM (Operation not permitted)   
write(2, "RSA verify failure\n", 19RSA verify failure