[LTP] [PATCH 1/2] clock_nanosleep01: Avoid dereferencing bad pointers in libc on 32bit

Richard Palethorpe rpalethorpe@suse.de
Tue Oct 5 14:04:51 CEST 2021


Hello Jan,

Jan Stancek <jstancek@redhat.com> writes:

> On Mon, Oct 4, 2021 at 8:07 AM Petr Vorel <pvorel@suse.cz> wrote:
>
>  Hi Richie,
>
>  > In 32-bit (regardless of kernel bits) glibc and musl will usually
>  > dereference the timespec pointers and try to read them. In some cases
>  > this might be avoidable, but they must do it in others.
>
>  > Passing invalid pointers is undefined in POSIX. In any case, AFAICT
>  > libc would have to catch the signal in order to guarantee EFAULT is
>  > returned.
>
>  LGTM.
>
>  Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
>  > Possibly we shouldn't test things like this at all through libc
>  > wrappers.
>  Only for 32bit or also for 64 bit? Anyway, there has always been some cases
>  where bad addr testing was problematic (e.g. non-intel arch).
>
> I'd skip it for both, I recall that some implementations
> were crashing.

Yes, there is not much we can do if it fails.

>
> Acked-by: Jan Stancek <jstancek@redhat.com>
>  
>  
>  Kind regards,
>  Petr
>
>  -- 
>  Mailing list info: https://lists.linux.it/listinfo/ltp


-- 
Thank you,
Richard.


More information about the ltp mailing list