Luca, I am not sure you have seen newly updated PR by Nadav that adds low level support - https://github.com/cloudius-systems/osv/pull/1223. You may want to use it update your branch.
I have reviewed his PR and it looks good to me. But ideally I want to run more tests on my side and I would like you to run some tests on your side that involve the high level code before I merge this PR into master. It obviously touches very critical part of the kernel - thread scheduler. Regards and thanks for your work Luca. Waldek On Wed, May 3, 2023 at 14:04 Luca Abeni <[email protected]> wrote: > Hi again, > > On Mon, 17 Apr 2023 at 10:30, Nadav Har'El <[email protected]> wrote: > [...] > >> > 6. Please verify the changes to clock_gettime() and nonsleep() to > return EINVAL when given a null pointer is the same in Linux (i.e., that it > doesn't return EFAULT) in that case. It's a bit sad we need to waste time > on these checks :-( > >> > >> I just tested, and on Linux a program passing NULL to clock_gettime() > >> just segfaults... > > > > > > Interesting. Maybe even though clock_gettime() is in section 2 of the > manual, it isn't a real system call > > and is a C wrapper - which segfaults? Real system calls are supposed to > return EFAULT, not segfault. > > I verified this happens because clock_gettime() is a vsyscall > implemented through the vDSO. This is the backtrace: > Program received signal SIGSEGV, Segmentation fault. > do_hres (ts=<optimized out>, clk=<optimized out>, vd=<optimized out>) > at > /build/linux-lowlatency-UVnJHF/linux-lowlatency-6.2.0/include/vdso/math64.h:21 > Downloading source file > /build/linux-lowlatency-UVnJHF/linux-lowlatency-6.2.0/include/vdso/math64.h > 21 > /build/linux-lowlatency-UVnJHF/linux-lowlatency-6.2.0/include/vdso/math64.h: > Directory not empty. > (gdb) bt > #0 do_hres (ts=<optimized out>, clk=<optimized out>, vd=<optimized out>) > at > /build/linux-lowlatency-UVnJHF/linux-lowlatency-6.2.0/include/vdso/math64.h:21 > #1 __cvdso_clock_gettime_common (ts=0x0, clock=1, vd=<optimized out>) > at > /build/linux-lowlatency-UVnJHF/linux-lowlatency-6.2.0/arch/x86/entry/vdso/../../../../lib/vdso/gettimeofday.c:251 > #2 __cvdso_clock_gettime_data (clock=1, ts=0x0, vd=<optimized out>) > at > /build/linux-lowlatency-UVnJHF/linux-lowlatency-6.2.0/arch/x86/entry/vdso/../../../../lib/vdso/gettimeofday.c:258 > #3 0x0000000000421f66 in clock_gettime () > #4 0x0000000000401791 in test (ts=0x0) at gettime_test.c:11 > #5 0x0000000000401802 in main () at gettime_test.c:23 > > And the kernel documentation explains that > " > ...if you pass a bad pointer to a vDSO function, you might get SIGSEGV > instead of -EFAULT. > " > > > So, I guess we can remove the NULL check :) > > Luca > > -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/osv-dev/CAJfkoWq7HqAv1drjf54vr0buwfavY3mLT%2BUQfFrfLTntNXcg5w%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/CAL9cFfN2fiDrF96tqVHL87XZHsBjb5O9dkOo-Ci-ysGk-6S7ag%40mail.gmail.com.
