Summary: | fcntl works on Valgrind's own file descriptors | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Steven Stewart-Gallus <sstewartgallus00> |
Component: | general | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ahajkova, mark |
Priority: | NOR | ||
Version: | 3.9.0 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | NetBSD | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | patch |
Description
Steven Stewart-Gallus
2014-07-12 06:20:30 UTC
looks like PRE(sys_fcntl) and PRE(sys_fcntl64) don't check ML_(fd_allowed) Note that there is a bug in the example program: fds = calloc(size, sizeof fds[0]); if (fds != NULL) { errnum = errno; goto close_fds_dir; } should be if (fds == NULL) Created attachment 170678 [details]
patch
(In reply to Alexandra Hajkova from comment #3) > Created attachment 170678 [details] > patch Thanks. Looks good. commit 4b83e3d47daaf5eff2ca96867a8c790e13830eb5 Author: Alexandra Hájková <ahajkova@redhat.com> Date: Thu Jun 20 07:45:56 2024 -0400 Don't allow programs calling fnctl on valgrind's own file descriptors Add a call to ML_(fd_allowed) in the PRE handler of fcntl and fcntl64 and block syscalls with EBADF when the file descriptor isn't allowed to be used by the program. https://bugs.kde.org/show_bug.cgi?id=337388 |