linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cc: amir73il@gmail.com, hu1.chen@intel.com, miklos@szeredi.hu,
	 malini.bhandaru@intel.com, tim.c.chen@intel.com,
	mikko.ylinen@intel.com,  lizhen.you@intel.com,
	linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 0/3] overlayfs: Optimize override/revert creds
Date: Thu, 25 Apr 2024 11:20:04 +0200	[thread overview]
Message-ID: <20240425-nullnummer-pastinaken-c8cf2f7c41f3@brauner> (raw)
In-Reply-To: <87a5liy3le.fsf@intel.com>

On Wed, Apr 24, 2024 at 12:15:25PM -0700, Vinicius Costa Gomes wrote:
> Christian Brauner <brauner@kernel.org> writes:
> 
> > On Tue, Apr 02, 2024 at 07:18:05PM -0700, Vinicius Costa Gomes wrote:
> >> Hi,
> >> 
> >> Changes from RFC v3:
> >>  - Removed the warning "fixes" patches, as they could hide potencial
> >>    bugs (Christian Brauner);
> >>  - Added "cred-specific" macros (Christian Brauner), from my side,
> >>    added a few '_' to the guards to signify that the newly introduced
> >>    helper macros are preferred.
> >>  - Changed a few guard() to scoped_guard() to fix the clang (17.0.6)
> >>    compilation error about 'goto' bypassing variable initialization;
> >> 
> >> Link to RFC v3:
> >> 
> >> https://lore.kernel.org/r/20240216051640.197378-1-vinicius.gomes@intel.com/
> >> 
> >> Changes from RFC v2:
> >>  - Added separate patches for the warnings for the discarded const
> >>    when using the cleanup macros: one for DEFINE_GUARD() and one for
> >>    DEFINE_LOCK_GUARD_1() (I am uncertain if it's better to squash them
> >>    together);
> >>  - Reordered the series so the backing file patch is the first user of
> >>    the introduced helpers (Amir Goldstein);
> >>  - Change the definition of the cleanup "class" from a GUARD to a
> >>    LOCK_GUARD_1, which defines an implicit container, that allows us
> >>    to remove some variable declarations to store the overriden
> >>    credentials (Amir Goldstein);
> >>  - Replaced most of the uses of scoped_guard() with guard(), to reduce
> >>    the code churn, the remaining ones I wasn't sure if I was changing
> >>    the behavior: either they were nested (overrides "inside"
> >>    overrides) or something calls current_cred() (Amir Goldstein).
> >> 
> >> New questions:
> >>  - The backing file callbacks are now called with the "light"
> >>    overriden credentials, so they are kind of restricted in what they
> >>    can do with their credentials, is this acceptable in general?
> >
> > Until we grow additional users, I think yes. Just needs to be
> > documented.
> >
> 
> Will add some documentation for it, then.
> 
> >>  - in ovl_rename() I had to manually call the "light" the overrides,
> >>    both using the guard() macro or using the non-light version causes
> >>    the workload to crash the kernel. I still have to investigate why
> >>    this is happening. Hints are appreciated.
> >
> > Do you have a reproducer? Do you have a splat from dmesg?
> 
> Just to be sure, with this version of the series the crash doesn't
> happen. It was only happening when I was using the guard() macro
> everywhere.
> 
> I just looked at my crash collection and couldn't find the splats, from
> what I remember I lost connection to the machine, and wasn't able to
> retrieve the splat.
> 
> I believe the crash and clang 17 compilation error point to the same
> problem, that in ovl_rename() some 'goto' skips the declaration of the
> (implicit) variable that the guard() macro generates. And it ends up
> doing a revert_creds_light() on garbage memory when ovl_rename()
> returns.

If this is a compiler bug this warrants at least a comment in the commit
message because right now people will be wondering why that place
doesn't use a guard. Ideally we can just use guards everywhere though
and report this as a bug against clang, I think.

> 
> (if you want I can try and go back to "guard() everywhere" and try a bit
> harder to get a splat)
> 
> Does that make sense?

Yes.

  reply	other threads:[~2024-04-25  9:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  2:18 [PATCH v1 0/3] overlayfs: Optimize override/revert creds Vinicius Costa Gomes
2024-04-03  2:18 ` [PATCH v1 1/3] cred: Add a light version of override/revert_creds() Vinicius Costa Gomes
2024-04-03  2:18 ` [PATCH v1 2/3] fs: Optimize credentials reference count for backing file ops Vinicius Costa Gomes
2024-04-03 15:40   ` kernel test robot
2024-04-03  2:18 ` [PATCH v1 3/3] overlayfs: Optimize credentials usage Vinicius Costa Gomes
2024-04-12 12:36 ` [PATCH v1 0/3] overlayfs: Optimize override/revert creds Miklos Szeredi
2024-04-24 19:01   ` Vinicius Costa Gomes
2024-04-25  6:06     ` Amir Goldstein
2024-04-24 17:01 ` Christian Brauner
2024-04-24 19:15   ` Vinicius Costa Gomes
2024-04-25  9:20     ` Christian Brauner [this message]
2024-04-25 17:12       ` Vinicius Costa Gomes
2024-04-25 17:47         ` Nathan Chancellor

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=20240425-nullnummer-pastinaken-c8cf2f7c41f3@brauner \
    --to=brauner@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=hu1.chen@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=lizhen.you@intel.com \
    --cc=malini.bhandaru@intel.com \
    --cc=mikko.ylinen@intel.com \
    --cc=miklos@szeredi.hu \
    --cc=tim.c.chen@intel.com \
    --cc=vinicius.gomes@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).