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

Petr Vorel pvorel@suse.cz
Mon Oct 4 08:07:27 CEST 2021


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).

Kind regards,
Petr


More information about the ltp mailing list