| Summary: | Pointer validation gone missing for __vdso_gettimeofday() | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Peter Holm <pho> |
| Component: | amd64 | Assignee: | freebsd-amd64 (Nobody) <amd64> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
Nothing in the SUSvX requires the pointer to the struct timeval to be validated, or rather, if pointer is not valid, the behaviour is undefined. It is impossible to 'fix' this in reliable manner for userspace function. The expectations are the same as for other functions, e.g. strcmp(3). Thank you for the explanation. - Peter State Changed From-To: open->closed Issue nicely explained by kib@. |
If first argument to gettimeofday() is an invalid pointer the call does not return EFAULT. How-To-Repeat: $ cat -n gettimeofday.c 1 #include <err.h> 2 #include <stdio.h> 3 #include <sys/time.h> 4 #include <sys/syscall.h> 5 #include <unistd.h> 6 7 int 8 main(void) 9 { 10 if (syscall(SYS_gettimeofday, (void *)-1, NULL) == -1) 11 warn("syscall()"); 12 13 /* broken by r237434 */ 14 if (gettimeofday((void *)-1, NULL) == -1) 15 warn("gettimeofday()"); 16 17 return (0); 18 } $ cc -o gettimeofday -Wall -Wextra -O2 -g gettimeofday.c $ ./gettimeofday gettimeofday: syscall(): Bad address Segmentation fault (core dumped) $