[systemd-devel] [PATCH 1/3] logind: session: don't set /dev/ttyX owner to root on restore_vt
Olivier Brunel
jjk at jjacky.com
Mon Aug 11 07:39:04 PDT 2014
On 08/11/14 16:25, Lennart Poettering wrote:
> On Fri, 08.08.14 20:45, Olivier Brunel (jjk at jjacky.com) wrote:
>
>> In session_prepare_vt() we set owner of /dev/ttyX to the user, as that is
>> needed for things to work. However, we shouldn't "reset" it to root on
>> session_restore_vt() since it could have in fact already been set to
>> the user.
>
> I don't follow here, can't parse this. Could you please elaborate?
I meant, before the call to session_prepare_vt() the owner of /dev/ttyX
might not be root, but already set to the user. In which case setting it
"back" to root might not be expected/best.
E.g. if a log in on tty3 right now, /dev/tty3 will be owned by my user,
then if a process try a TakeControl() and it failed (or after it's done)
the ownership would be set to root, even though it wasn't actually root
to begin with.
>
>> ---
>> src/login/logind-session.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/src/login/logind-session.c b/src/login/logind-session.c
>> index fdeacb1..905e73f 100644
>> --- a/src/login/logind-session.c
>> +++ b/src/login/logind-session.c
>> @@ -1070,8 +1070,6 @@ void session_restore_vt(Session *s) {
>> mode.mode = VT_AUTO;
>> ioctl(vt, VT_SETMODE, &mode);
>>
>> - fchown(vt, 0, -1);
>> -
>> s->vtfd = safe_close(s->vtfd);
>> }
>>
>
>
> Lennart
>
More information about the systemd-devel
mailing list