Re: [PATCH] Filesystem capabilities support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 13, 2005 at 01:51:46PM -0400, Horst von Brand wrote:
> Nicholas Hans Simmonds <[email protected]> wrote:
> > Sorry, my earlier reply seems to have gotten lost somewhere. I've been
> > pondering this issue for some time and am still not sure what's the best
> > answer. I've attached a small patch which handles this by detecting byte
> > swapping of the version code. I'm not convinced it's necessary but
> > shouldn't hurt.
> > 
> > diff --git a/security/commoncap.c b/security/commoncap.c
> > --- a/security/commoncap.c
> > +++ b/security/commoncap.c
> > @@ -153,6 +153,15 @@ int cap_bprm_set_security (struct linux_
> >  	down(&bprm_dentry->d_inode->i_sem);
> >  	ret = bprm_getxattr(bprm_dentry,XATTR_CAP_SET,&caps,sizeof(caps));
> >  	if(ret == sizeof(caps)) {
> > +		if(caps.version = swab32(_LINUX_CAPABILITY_VERSION)) {
>                               ^
> 				|
> 				+-- Surely wrong?!
> 

True, just noticed that. Amazing how even the simplest patches provide
such ample opportunity to shoot oneself in the foot.

> > +			swab32s(&caps.version);
> > +			swab32s(&caps.effective);
> > +			swab32s(&caps.mask_effective);
> > +			swab32s(&caps.permitted);
> > +			swab32s(&caps.mask_permitted);
> > +			swab32s(&caps.inheritable);
> > +			swab32s(&caps.mask_inheritable);
> > +		}
> >  		if(caps.version == _LINUX_CAPABILITY_VERSION) {
> >  			cap_t(bprm->cap_effective) &= caps.mask_effective;
> >  			cap_t(bprm->cap_effective) |= caps.effective;
> -- 
> Dr. Horst H. von Brand                   User #22616 counter.li.org
> Departamento de Informatica                     Fono: +56 32 654431
> Universidad Tecnica Federico Santa Maria              +56 32 654239
> Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

Other than this, what are the general thoughts about this method as
opposed to just using a well defined byte order?

Thanks,

Nicholas
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux