Re: make not closing fds?
Christos Zoulas wrote: > On Sep 1, 2:24pm, kar...@netbsd.org (Frank Kardel) wrote: > | That's what I assume too. But, should normal commands really get access > | to those fds? > > No, I don't think so. Perhaps the pipes are used to redirect and > collect the output of normal commands. I assume the job token pipes are passed to "normal" commands because those normal commands can be an arbitrarily complex, and it is impossible to know whether they will end up invoking a sub-make or not. That still doesn't explain why there should be as many as 40 open file descriptors, though. -- Andreas Gustafsson, g...@gson.org
Re: make not closing fds?
On Sep 1, 2:24pm, kar...@netbsd.org (Frank Kardel) wrote: -- Subject: Re: make not closing fds? | That's what I assume too. But, should normal commands really get access | to those fds? | No, I don't think so. Perhaps the pipes are used to redirect and collect the output of normal commands. christos
Re: make not closing fds?
That's what I assume too. But, should normal commands really get access to those fds? Frank On 09/01/13 14:06, Christos Zoulas wrote: In article <522317ab.1020...@netbsd.org>, Frank Kardel wrote: While building a release I saw in fstat that commands started from make had many (pipe) file descriptors allocated. Is make missing setting FD_CLOEXEC/closing before fork on these ? While this is not really critical it opens up possibilities to clobber at least the output and gobble up input data with misbehaved programs. I believe parallel make passes tokens through fds to children to keep track of how many parallel makes are running. christos
Re: make not closing fds?
In article <522317ab.1020...@netbsd.org>, Frank Kardel wrote: >While building a release I saw in fstat that commands started from make >had many (pipe) file descriptors allocated. Is make missing >setting FD_CLOEXEC/closing before fork on these ? While this is not >really critical it opens up possibilities to clobber at least the output >and gobble up >input data with misbehaved programs. I believe parallel make passes tokens through fds to children to keep track of how many parallel makes are running. christos
make not closing fds?
While building a release I saw in fstat that commands started from make had many (pipe) file descriptors allocated. Is make missing setting FD_CLOEXEC/closing before fork on these ? While this is not really critical it opens up possibilities to clobber at least the output and gobble up input data with misbehaved programs. Frank Example: USER CMD PID FD MOUNT INUM MODE SZ|DV R/W root rm 4126 wd /fs/raid1a 2666534 drwxr-xr-x 512 r root rm 41260 /tmp 85401585450532163 -rw--- 1053 rw root rm 41261 /11534468 crw-rw-rw-null w root rm 41262* pipe 0xfe8680442708 -> 0xfe87ded81040 w root rm 41263* pipe 0xfe8681282468 -> 0xfe87acd3f2f8 w root rm 41264* pipe 0xfe874dfe4590 -> 0xfe8749cb25b0 w root rm 41265 /fs/raid1a 2666537 -rw-r--r-- 25192 w root rm 41266* pipe 0xfe8680442708 -> 0xfe87ded81040 w root rm 41267* pipe 0xfe818d2b9290 -> 0xfe8781eb1598 w ...more up to fs 40 root cat25766 wd /fs/raid1a 1985407 drwxr-xr-x 512 r root cat257660 /tmp 85401585450180222 -rw--- 750 rw root cat257661* pipe 0xfe867fee2460 -> 0xfe87e59a0538 w root cat257662* pipe 0xfe867fee2460 -> 0xfe87e59a0538 w root cat257663* pipe 0xfe8681282468 -> 0xfe87acd3f2f8 w root cat257664* pipe 0xfe874dfe4590 -> 0xfe8749cb25b0 w root cat257665* pipe 0xfe87acd3f2f8 <- 0xfe8681282468 rn root cat257666* pipe 0xfe86cdd9c840 -> 0xfe879aeed430 w ...more up to fd 30