[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re : breakage in emacsclient
From: |
Samuel Thibault |
Subject: |
Re: Re : breakage in emacsclient |
Date: |
Mon, 9 Nov 2020 21:53:35 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Andrew Eggenberger, le jeu. 29 oct. 2020 16:12:47 -0500, a ecrit:
> I think the problem is with the pflocal/io.c implementation of S_io_stat.
[...]
> calling fstat on the
> file descriptor of a socket created with cloexec_socket (AF_UNIX,
> SOCK_STREAM, 0);. But S_io_stat doesn't set uid.
Indeed. The more complete story is that
- on the application side, socket() calls _hurd_socket_server, which
opens /servers/socket/1
- on the pflocal side, that translates to calling trivfs_S_dir_lookup,
which does receive the user credentials in its cred parameter, and
calls trivfs_open that creates a struct trivfs_peropen and struct
trivfs_protid in which the user field points to the credentials.
- then on the application side, socket() calls __socket_create
- on the pflocal side, that translates to calling S_socket_create.
There, the pf port is for now untranslated (showing up as a
mach_port_t), but you can add to pflocal/mig-mutate.h the same
PF_INTRAN, PF_INTRAN_PAYLOAD, and PF_DESTRUCTOR as in e.g.
pfinet/mig-mutate.h, so that S_socket_create (and others in the same
file) get the translated port (showing up as a struct trivfs_protid
*master). Then you have access to the credential, and can record
uid/gid in a new field of struct sock.
> The problem is that /hurd/pflocal is owned by and in
> the group root,
Well, that's unrelated. io_stat memsets the struct stat to 0 anyway.
Samuel
- Re: Re : breakage in emacsclient,
Samuel Thibault <=