bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how does O_NOCTTY help? [Re: bug in chdir-safer


From: Jim Meyering
Subject: Re: how does O_NOCTTY help? [Re: bug in chdir-safer
Date: Tue, 14 Feb 2006 15:38:19 +0100

Paul Eggert <address@hidden> wrote:
>>> That's the basic idea, but I'm afraid it's a bit more complicated than
>>> that.  The process is exposed even after it closes the terminal, since
>>> it doesn't relinquish the controlling terminal even after it closes
>>> the corresponding file descriptor (certainly if other processes have
>>> the terminal open -- even via an independent descriptor...
>
>> Your use of `processes' means `processes in the same process group', right?
>
> No, unfortunately (if my memory is correct) it's any process,
> anywhere.  This dates all the way back to a hack in 7th edition Unix,
> which didn't have process groups.  As I dimly recall, it was a bit of
> a mess.

It sounds like you're explaining why it was important to use O_NOCTTY
on ancient systems.  Do you really think it is important now?

These days, I suspect that there's no vulnerability to interference by
arbitrary processes, since all systems have the notions of a process group,
a session (a la setsid), and a session leader.  Otherwise, this (omitting
O_NOCTTY) would constitute a significant security risk and it would have
been well documented.

That said, using O_NOCTTY does seem useful, if only to avoid whatever
cost is involved in setting the controlling terminal.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]