For some reason Linux 'openssl speed rsa' ends up calling time(2) over and over again: write(2, "Doing 512 bit private rsa's for "..., 37Doing 512 bit private rsa's for 10s: ) = 37 alarm(10) = 0 times({tms_utime=0, tms_stime=1, tms_cutime=0, tms_cstime=0}) = 2574131 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 time([1568856996]) = 1568856996 [..] This obviously doesn't happen under real Linux.
Which version of openssl? Under real linux (4.20.4 kernel, glibc 2.27), with openssl 1.1.0i, I instead see a bajillion getpid() calls (something like 300/second). (suggestive of fork-detection.) But I suspect that has nothing to do with your time() calls. Probably instead of time() syscall, openssl is hitting some linux-vdso.so.1 call that we don't implement in linuxulator.
Yeah, time is one of the functions provided by vdso on Linux x86_64: __vdso_clock_gettime LINUX_2.6 __vdso_getcpu LINUX_2.6 __vdso_gettimeofday LINUX_2.6 __vdso_time LINUX_2.6 http://man7.org/linux/man-pages/man7/vdso.7.html
I see this with both CentOS (openssl-1.0.2k-16.el7_6.1) and Ubuntu (openssl-1.1.1b-1ubuntu2.1). It does seem related to vdso... but doesn't our vdso already provide this symbol (sys/amd64/linux/linux_vdso.lds.s)?
Yeah, you're right, it does seem to provide it. Hmm. I don't know what is going wrong here, but for some reason the linux dynamic linker isn't connecting openssl to our emulated linux vdso.
(In reply to Conrad Meyer from comment #4) no, even current vdso time() always calls syscall. on Linux strace does not show time() call as it in the vdso (not a syscall)
grab, I think it not a bug, but I'll close it when implement time() in the vdso
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=42317e642645b36e711b5dd560d06a303a492e0f commit 42317e642645b36e711b5dd560d06a303a492e0f Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-07-04 20:41:32 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-07-04 20:41:32 +0000 linux(4): Implement __vdso_time PR: 240769 MFC after: 3 days sys/compat/linux/linux_vdso_gtod.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f8da86347070ce4b6c39a8d6ba2df53e49ec4f84 commit f8da86347070ce4b6c39a8d6ba2df53e49ec4f84 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-07-04 20:41:32 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-07-11 21:28:28 +0000 linux(4): Implement __vdso_time PR: 240769 MFC after: 3 days (cherry picked from commit 42317e642645b36e711b5dd560d06a303a492e0f) sys/compat/linux/linux_vdso_gtod.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
in stable/13