[Bug build/23989] New: test-container and shell-container should check more fds for validity
carlos at redhat dot com
sourceware-bugzilla@sourceware.org
Fri Dec 14 20:12:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=23989
Bug ID: 23989
Summary: test-container and shell-container should check more
fds for validity
Product: glibc
Version: 2.30
Status: NEW
Severity: normal
Priority: P2
Component: build
Assignee: unassigned at sourceware dot org
Reporter: carlos at redhat dot com
CC: carlos at redhat dot com
Target Milestone: ---
In support/test-container.c:
220 /* Special case of above for devices like /dev/zero where we have to
221 mount a device over a device, not a directory over a directory. */
222 static void
223 devmount (const char *new_root_path, const char *which)
224 {
225 int fd;
226 fd = open (concat (new_root_path, "/dev/", which, NULL),
227 O_CREAT | O_TRUNC | O_RDWR, 0777);
228 xclose (fd);
229
230 trymount (concat ("/dev/", which, NULL),
231 concat (new_root_path, "/dev/", which, NULL));
232 }
Should use xopen to avoid passing an invalid fd to xclose.
Likewise in support/shell-container.c:
218 if (new_stdin != 0)
219 {
220 dup2 (new_stdin, 0);
221 close (new_stdin);
222 }
223 if (new_stdout != 1)
224 {
225 dup2 (new_stdout, 1);
226 close (new_stdout);
227 }
228 if (new_stderr != 2)
229 {
230 dup2 (new_stderr, 2);
231 close (new_stdout);
232 }
Earlier open's should either be xopen or we should check that new_* fds are
valid.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list