Re: [PATCH RFC 0/1] mount: universally disallow mounting over symlinks

Al Viro
2020-01-13T13:31:10Z

On Mon, Jan 13, 2020 at 02:03:00PM +0800, Ian Kent wrote:

> Oh wait, for systemd I was actually looking at:
> https://github.com/systemd/systemd/blob/master/src/shared/switch-root.c
>
> >
> > Mind you, that's not the actual systemd repo. either I probably
> > need to look a lot deeper (and at the actual systemd repo) to
> > work out what's actually being called.
> >
> > > Sigh... Guess I'll have to dig that Fedora KVM image out and
> > > try to see what it's about... ;-/ Here comes a couple of hours
> > > of build...

D'oh... And yes, that would've been a bisect hazard - switch to
path_lookupat() later in the series gets rid of that. Incremental
(to be foldede, of course):

diff --git a/fs/namei.c b/fs/namei.c
index 1793661c3342..204677c37751 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2634,7 +2634,7 @@ path_mountpoint(struct nameidata *nd, unsigned flags, struct path *path)
(err = lookup_last(nd)) > 0) {
s = trailing_symlink(nd);
}
- if (!err)
+ if (!err && (nd->flags & LOOKUP_RCU))
err = unlazy_walk(nd);
if (!err)
err = handle_lookup_down(nd);