From: Alexey Dobriyan <adobriyan@gmail.com>
To: Nicholas Hans Simmonds <nhstux@gmail.com>
Cc: linux-kernel@vger.kernel.org,
"Andrew G. Morgan" <morgan@transmeta.com>,
Alexander Kjeldaas <astor@guardian.no>
Subject: Re: [PATCH] Filesystem capabilities support
Date: Sun, 3 Jul 2005 03:01:48 +0400 [thread overview]
Message-ID: <200507030301.48862.adobriyan@gmail.com> (raw)
In-Reply-To: <20050702214108.GA755@laptop>
On Sunday 03 July 2005 01:41, Nicholas Hans Simmonds wrote:
> This is a simple attempt at providing capability support through extended
> attributes. Setting security.cap_set to contain a struct cap_xattr_data which
> defines the desired capabilities will switch on the new behaviour otherwise
> there is no change. When a file is written to then the xattr (if it exists) is
> removed to prevent tampering with priveleged executables. Whilst I'm not sure
> this provides a secure implementation, I can't see any problem with it myself.
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> int cap_bprm_set_security (struct linux_binprm *bprm)
> {
> + ssize_t (*bprm_getxattr)(struct dentry *,const char *,void *,size_t);
> + struct dentry *bprm_dentry;
> + ssize_t ret;
> + struct cap_xattr_data caps;
> +
$ make security/commoncap.o
CC security/commoncap.o
security/commoncap.c: In function `cap_bprm_set_security':
security/commoncap.c:114: warning: unused variable `bprm_getxattr'
security/commoncap.c:115: warning: unused variable `bprm_dentry'
security/commoncap.c:116: warning: unused variable `ret'
security/commoncap.c:117: warning: unused variable `caps'
with an obvious change in .config
> +#ifdef CONFIG_SECURITY_FS_CAPABILITIES
> + /* Locate any VFS capabilities: */
> +
> + bprm_dentry = bprm->file->f_dentry;
> + if(!(bprm_dentry->d_inode->i_op &&
> + bprm_dentry->d_inode->i_op->getxattr))
> + return 0;
> + bprm_getxattr = bprm_dentry->d_inode->i_op->getxattr;
> +
> + 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 == _LINUX_CAPABILITY_VERSION) {
> + cap_t(bprm->cap_effective) &= caps.mask_effective;
> + cap_t(bprm->cap_effective) |= caps.effective;
> +
> + cap_t(bprm->cap_permitted) &= caps.mask_permitted;
> + cap_t(bprm->cap_permitted) |= caps.permitted;
> +
> + cap_t(bprm->cap_inheritable) &= caps.mask_inheritable;
> + cap_t(bprm->cap_inheritable) |= caps.inheritable;
> + } else
> + printk(KERN_WARNING "Warning: %s capability set has "
> + "incorrect version\n",bprm->filename);
You may want to print this incorrect version.
> + }
> + up(&bprm_dentry->d_inode->i_sem);
> +#endif /* CONFIG_SECURITY_FS_CAPABILITIES */
next prev parent reply other threads:[~2005-07-02 22:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-02 21:41 [PATCH] Filesystem capabilities support Nicholas Hans Simmonds
2005-07-02 23:01 ` Alexey Dobriyan [this message]
2005-07-03 0:14 ` Nicholas Hans Simmonds
2005-07-06 4:56 ` Nathan Scott
2005-07-04 14:27 ` Nicholas Hans Simmonds
2005-07-13 6:29 ` Nicholas Hans Simmonds
2005-07-13 17:51 ` Horst von Brand
2005-07-14 4:29 ` Nicholas Hans Simmonds
2005-07-14 20:05 ` Horst von Brand
2005-07-16 14:23 ` Nicholas Hans Simmonds
2005-07-15 3:45 ` Jesper Juhl
2005-07-16 15:42 ` Nicholas Hans Simmonds
-- strict thread matches above, loose matches on Subject: below --
2005-07-24 13:36 Arnout Engelen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200507030301.48862.adobriyan@gmail.com \
--to=adobriyan@gmail.com \
--cc=astor@guardian.no \
--cc=linux-kernel@vger.kernel.org \
--cc=morgan@transmeta.com \
--cc=nhstux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox