All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: "Maciej Zięba" <maciekz82@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Vivek Goyal <vgoyal@redhat.com>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Theodore Tso <tytso@mit.edu>, Mark Salyzyn <salyzyn@android.com>
Subject: Re: overlayfs 4.19: unable to make backup link: Invalid cross-device link
Date: Wed, 14 Nov 2018 14:09:01 +0200	[thread overview]
Message-ID: <CAOQ4uxjRGpwGou3+BNUvMV6bCx8ysTyEESOR9RVY4Nc2QvkJjg@mail.gmail.com> (raw)
In-Reply-To: <CACTyJpCx7y-5OOhk0P8ETQwp4_n-a1W1Dmc-1dHeE6j_cvdk7A@mail.gmail.com>

On Wed, Nov 14, 2018 at 12:28 PM Maciej Zięba <maciekz82@gmail.com> wrote:
>
> Hi :)
>
> I'm not sure which part is relevant, so I'm sending the entire dmesg output as well as the docker messages. I hope it will be useful.
>

Thanks for the info!

Problem is ovl_set_redirect() inside ovl_link() is missing
ovl_override_creds().

Can you try the patch below?

Reason that unionmount-testsuite didn't catch this is because
it is run as root.

Vivek, Mark,

Either of you care to implement dropping privileges for the duration
of unionmount-testsuite test cases (in between mounts and unmounts)?

Thanks,
Amir.

---

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index c6289147c787..82c129bfe58d 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -651,6 +651,18 @@ static int ovl_symlink(struct inode *dir, struct
dentry *dentry,
        return ovl_create_object(dentry, S_IFLNK, 0, link);
 }

+static int ovl_set_link_redirect(struct dentry *dentry)
+{
+       const struct cred *old_cred;
+       int err;
+
+       old_cred = ovl_override_creds(dentry->d_sb);
+       err = ovl_set_redirect(dentry, false);
+       revert_creds(old_cred);
+
+       return err;
+}
+
 static int ovl_link(struct dentry *old, struct inode *newdir,
                    struct dentry *new)
 {
@@ -670,7 +682,7 @@ static int ovl_link(struct dentry *old, struct
inode *newdir,
                goto out_drop_write;

        if (ovl_is_metacopy_dentry(old)) {
-               err = ovl_set_redirect(old, false);
+               err = ovl_set_link_redirect(old);
                if (err)
                        goto out_drop_write;
        }

  parent reply	other threads:[~2018-11-14 12:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27 20:04 overlayfs 4.19: unable to make backup link: Invalid cross-device link Theodore Y. Ts'o
2018-10-29  7:37 ` Amir Goldstein
2018-10-29  8:31 ` Miklos Szeredi
2018-10-29 22:04   ` Theodore Y. Ts'o
2018-10-30  4:44     ` Amir Goldstein
2018-11-14  9:46       ` Amir Goldstein
2018-11-14  9:55         ` Miklos Szeredi
2018-11-14 10:28           ` Maciej Zięba
2018-11-14 10:33             ` Maciej Zięba
2018-11-14 12:09             ` Amir Goldstein [this message]
2018-11-14 12:14               ` Maciej Zięba
2018-11-14 14:25               ` Vivek Goyal
2018-11-14 18:40                 ` Maciej Zięba
2018-11-14 21:33               ` Maciej Zięba

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=CAOQ4uxjRGpwGou3+BNUvMV6bCx8ysTyEESOR9RVY4Nc2QvkJjg@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=maciekz82@gmail.com \
    --cc=miklos@szeredi.hu \
    --cc=salyzyn@android.com \
    --cc=tytso@mit.edu \
    --cc=vgoyal@redhat.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.