lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4942DCA5.60109@sparta.com>
Date:	Fri, 12 Dec 2008 16:50:29 -0500
From:	"Matthew N. Dodd" <Matthew.Dodd@...rta.com>
To:	"David P. Quigley" <dpquigl@...ho.nsa.gov>
CC:	James Morris <jmorris@...ei.org>, hch@...radead.org,
	viro@...iv.linux.org.uk, casey@...aufler-ca.com, sds@...ho.nsa.gov,
	trond.myklebust@....uio.no, bfields@...ldses.org,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-security-module@...r.kernel.org, selinux@...ho.nsa.gov,
	labeled-nfs@...ux-nfs.org
Subject: Re: [PATCH 03/14] LSM/SELinux: inode_{get,set,notify}secctx hooks
 to access LSM security context information.

David P. Quigley wrote:
> On Fri, 2008-12-05 at 20:58 +1100, James Morris wrote:
>> On Wed, 26 Nov 2008, David P. Quigley wrote:
>>
>>> + * @inode_getsecctx:
>>> + * 	Returns a string containing all relavent security context information
>>> + *
>>> + * 	@inode we wish to set the security context of.
>>> + *	@ctx is a pointer in which to place the allocated security context.
>>> + *	@ctxlen points to the place to put the length of @ctx.
>>>   * This is the main security structure.
>>>   */
>>>  struct security_operations {
>>> @@ -1479,6 +1514,10 @@ struct security_operations {
>>>  	int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
>>>  	void (*release_secctx) (char *secdata, u32 seclen);
>>>  
>>> +	int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen);
>>> +	int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen);
>>> +	int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
>> For inode_getsecctx(), you're returning the length via the return value, 
>> so you should not also need to pass in a pointer to ctxlen, right?
>>
>> IMHO, it's clearer and simpler to always only return error status from 
>> these kinds of functions, and to pass things like size back via pointer 
>> args, although it seems that a few mixed return functions have crept in to 
>> the code over time.  My preference would be to convert it to return value 
>> is error status only, with the length entirely separate as a pointer arg.
>>
>>
>> - James
> 
> I'll have to look into why we did it this way. The discussion for these
> patches happened many months ago so I don't remember why it was done
> this way. I remember at the time getting an approval for the approach
> but a desire not to merge the patch while there were no users of it.

I think it was a result of inode_getsecctx() being a wrapper for 
selinux_inode_getsecurity() which returns a length.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ