[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+fDwk_17bLtx9KdeoCs+hxgksMvxzutJjgB76tP+NV4g@mail.gmail.com>
Date: Thu, 8 Mar 2012 14:03:13 -0800
From: Kees Cook <keescook@...omium.org>
To: Cyrill Gorcunov <gorcunov@...nvz.org>
Cc: Andy Lutomirski <luto@...capital.net>,
Oleg Nesterov <oleg@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Pavel Emelyanov <xemul@...allels.com>,
Tejun Heo <tj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Will Drewry <wad@...omium.org>
Subject: Re: [RFC] c/r: prctl: Add ability to set new mm_struct::exe_file v3
On Thu, Mar 8, 2012 at 1:57 PM, Cyrill Gorcunov <gorcunov@...nvz.org> wrote:
> On Thu, Mar 08, 2012 at 12:24:38PM -0800, Andy Lutomirski wrote:
>>
>> nnp is no_new_privs, which is my patch and is almost, but not quite,
>> very relevant to this discussion. Hence my confusion ;)
>>
>> FWIW, since I've touched this code recently, the cleanup you're
>> suggesting sounds good.
>>
>
> Andy, Kees, I guess the patch below might be a helper we need,
> while I'm not sure on naming. hm?
>
> Cyrill
> ---
> include/linux/fs.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> Index: linux-2.6.git/include/linux/fs.h
> ===================================================================
> --- linux-2.6.git.orig/include/linux/fs.h
> +++ linux-2.6.git/include/linux/fs.h
> @@ -2669,5 +2669,11 @@ static inline void inode_has_no_xattr(st
> inode->i_flags |= S_NOSEC;
> }
>
> +static inline bool file_may_exec(struct file *f)
> +{
> + return S_ISREG(f->f_path.dentry->d_inode->i_mode) &&
> + !(f->f_path.mnt->mnt_flags & MNT_NOEXEC);
> +}
> +
> #endif /* __KERNEL__ */
> #endif /* _LINUX_FS_H */
How about "file_is_exec" instead, since it doesn't (and likely
shouldn't) include the inode_permission(..., EXEC)? I'd like other
people's thoughts on this since maybe it's not needed and I instead
have accidentally derailed this patch with useless bike shedding.
-Kees
--
Kees Cook
ChromeOS Security
--
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