netdev
[Top] [All Lists]

Re: [RFC] SO_PEERSEC - security credentials for Unix stream sockets

To: James Morris <jmorris@xxxxxxxxxx>
Subject: Re: [RFC] SO_PEERSEC - security credentials for Unix stream sockets
From: Stephen Smalley <sds@xxxxxxxxxxxxxx>
Date: Tue, 16 Dec 2003 08:47:31 -0500
Cc: Chris Wright <chrisw@xxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx>, kuznet@xxxxxxxxxxxxx, lsm <linux-security-module@xxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <Xine.LNX.4.44.0312160816350.16300-100000@thoron.boston.redhat.com>
Organization: National Security Agency
References: <Xine.LNX.4.44.0312160816350.16300-100000@thoron.boston.redhat.com>
Sender: netdev-bounce@xxxxxxxxxxx
On Tue, 2003-12-16 at 08:19, James Morris wrote:
> It's not reliable: the required buffer size could change between calls.  
> Do you know of any examples of syscalls which do this?

getxattr(2).  From the man page:

       An empty buffer of size zero can be passed into these calls  to  return
       the  current size of the named extended attribute, which can be used to
       estimate the size of a buffer which is sufficiently large to  hold  the
       value associated with the extended attribute.
                                                                                
       The  interface  is  designed to allow guessing of initial buffer sizes,
       and to enlarge buffers when the return value indicates that the  buffer
       provided was too small.

The SELinux getfilecon(3) function (libselinux/src/getfilecon.c) uses
getxattr(2) in this manner.

-- 
Stephen Smalley <sds@xxxxxxxxxxxxxx>
National Security Agency


<Prev in Thread] Current Thread [Next in Thread>