All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Zhang Tianci <zhangtianci.1997@bytedance.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Subject: Re: [PATCH] ovl: Do not override fsuid and fsgid in ovl_link()
Date: Wed, 17 Aug 2022 10:36:38 +0300	[thread overview]
Message-ID: <CAOQ4uxgrkPYBkZG--70s4PnUiT0ht=GdWrrm+aY4ZHoZjZrWAw@mail.gmail.com> (raw)
In-Reply-To: <20220817034559.44936-1-zhangtianci.1997@bytedance.com>

On Wed, Aug 17, 2022 at 6:49 AM Zhang Tianci
<zhangtianci.1997@bytedance.com> wrote:
>
> ovl_link() did not create a new inode after commit
> 51f7e52dc943 ("ovl: share inode for hard link"), so
> in ovl_create_or_link() we should not override cred's
> fsuid and fsgid when called by ovl_link().
>
> Signed-off-by: Zhang Tianci <zhangtianci.1997@bytedance.com>
> Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
> ---
>  fs/overlayfs/dir.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 6b03457f72bb..568d338032db 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -595,9 +595,9 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
>         err = -ENOMEM;
>         override_cred = prepare_creds();
>         if (override_cred) {
> -               override_cred->fsuid = inode->i_uid;
> -               override_cred->fsgid = inode->i_gid;
>                 if (!attr->hardlink) {
> +                       override_cred->fsuid = inode->i_uid;
> +                       override_cred->fsgid = inode->i_gid;
>                         err = security_dentry_create_files_as(dentry,
>                                         attr->mode, &dentry->d_name, old_cred,
>                                         override_cred);
> --

This change looks incorrect.
Unless I am missing something, fsuid/fsgid still need to
be overridden for calling link() on underlying fs.
What made you do this change?

Thanks,
Amir.

  reply	other threads:[~2022-08-17  7:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  3:45 [PATCH] ovl: Do not override fsuid and fsgid in ovl_link() Zhang Tianci
2022-08-17  7:36 ` Amir Goldstein [this message]
2022-08-17  9:11   ` [External] " 天赐张
2022-08-17  9:53     ` Amir Goldstein
2022-08-17  9:55       ` Amir Goldstein
2022-08-17 10:27         ` Christian Brauner
2022-08-17 10:29           ` Christian Brauner
2022-08-17 11:36             ` 天赐张
2022-08-17 11:56               ` Christian Brauner
2022-08-17 12:29                 ` Christian Brauner
2022-08-17 12:37                   ` Christian Brauner
2022-08-25  8:46                     ` 天赐张

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='CAOQ4uxgrkPYBkZG--70s4PnUiT0ht=GdWrrm+aY4ZHoZjZrWAw@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=zhangjiachen.jaycee@bytedance.com \
    --cc=zhangtianci.1997@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.