mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Kees Cook <kees.cook@canonical.com>
Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Yama: verify inode is symlink to avoid bind mounts
Date: Tue, 13 Jul 2010 21:30:48 -0500	[thread overview]
Message-ID: <20100714023048.GB17686@hallyn.com> (raw)
In-Reply-To: <20100713223021.GK6104@outflux.net>

Quoting Kees Cook (kees.cook@canonical.com):
> 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,

Are you sure about that??

If that's true, you might also expand the comment in
include/linux/security.h.

> 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;
> -- 
> 1.7.1
> 
> 
> -- 
> Kees Cook
> Ubuntu Security Team
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-07-14  2:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13 22:30 Kees Cook
2010-07-14  2:30 ` Serge E. Hallyn [this message]
2010-07-14  6:53   ` Kees Cook
2010-07-14  6:12 ` Kees Cook

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=20100714023048.GB17686@hallyn.com \
    --to=serge@hallyn.com \
    --cc=kees.cook@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®