lkml.org 
[lkml]   [2010]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Yama: verify inode is symlink to avoid bind mounts
On Tue, Jul 13, 2010 at 03:30:21PM -0700, Kees Cook wrote:
> The inode_follow_link LSM hook is called in bind mount situations as
> well as for symlink situations, so we must explicitly check for the
> inode being a symlink to not reject bind mounts in 1777 directories,
> which seems to be a common NFSv4 configuration.
>
> Signed-off-by: Kees Cook <kees.cook@canonical.com>
> ---
> security/yama/yama_lsm.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
> index 3b76386..c70eb10 100644
> --- a/security/yama/yama_lsm.c
> +++ b/security/yama/yama_lsm.c
> @@ -116,6 +116,10 @@ static int yama_inode_follow_link(struct dentry *dentry,
> if (!protected_sticky_symlinks)
> return 0;
>
> + /* if inode isn't a symlink, don't try to evaluate blocking it */
> + if (!S_ISLNK(inode->i_mode))
> + return 0;
> +
> /* owner and follower match? */
> cred = current_cred();
> inode = dentry->d_inode;

Erg, please ignore this -- I tested a slightly different version of this
patch. This version doesn't have inode set yet. I will follow up with the
correct one in a moment...

-Kees

--
Kees Cook
Ubuntu Security Team


\
 
 \ /
  Last update: 2010-07-14 08:15    [W:0.054 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site