tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Adding sc_pid to SCM_CREDS
On 31/03/2016 12:58, Roy Marples wrote:
> On 31/03/2016 03:44, Christos Zoulas wrote:
>> In article <56FAB3EC.4070406%marples.name@localhost>,
>> Roy Marples <roy%marples.name@localhost> wrote:
>>> -=-=-=-=-=-
>>> For AF_UNIX SOCK_DGRAM sockets, the only way of obtaining credentials is
>>> via LOCAL_CREDS which returns SCM_CREDS as a cmsg.
>>> However, struct sockcred lacks the process id of the sender which is of
>>> use to many applications.
>>>
>>> For SOCK_STREAM and SOCK_SEQPACKET, we do have LOCAL_PEEREID, but that
>>> comes at the extra expense of a syscall after accepting.
>>>
>>> There was a previous discussion here:
>>> https://mail-index.netbsd.org/tech-kern/2008/07/05/msg001969.html
>>>
>>> And an open gnats ticket with a LOCAL_PROC suggestion under kern/39108
>>> http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=39108
>>>
>>> Attached is a patch which adds sc_pid to struct sockcred and correctly
>>> fills it out. The old sockcred structure is available as osockcred in
>>> compat/sys/socket.h and guarded by COMPAT_70.
>>>
>>> Everything seems to work ok with old binaries, but would appreciate some
>>> extra eyes on the compat code or any suggestion how it could be done better.
>>>
>>> Roy
>>
>> I think that most of the code and defines for the compatibility interfaces
>> belongs in compat/ except of course for the parts that are need to be in
>> the original socket code because it can't be done differently.
>
> OK.
>
> New patch, with man page update here:
> http://www.netbsd.org/~roy/SCM_CREDS-pid.patch
Made more changes recommended by Christos, patch refreshed above.
Roy
Home |
Main Index |
Thread Index |
Old Index