From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Amir Goldstein <amir73il@gmail.com>,
brauner@kernel.org, miklos@szeredi.hu
Cc: hu1.chen@intel.com, malini.bhandaru@intel.com,
tim.c.chen@intel.com, mikko.ylinen@intel.com,
linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/4] ovl: Optimize override/revert creds
Date: Wed, 13 Nov 2024 11:30:03 -0800 [thread overview]
Message-ID: <87ldxnrkxw.fsf@intel.com> (raw)
In-Reply-To: <CAOQ4uxgHwmAa4K3ca7i1G2gFQ1WBge855R19hgEk7BNy+EBqfg@mail.gmail.com>
Amir Goldstein <amir73il@gmail.com> writes:
> On Thu, Nov 7, 2024 at 1:57 AM Vinicius Costa Gomes
> <vinicius.gomes@intel.com> wrote:
[...]
>
> Vinicius,
>
> While testing fanotify with LTP tests (some are using overlayfs),
> kmemleak consistently reports the problems below.
>
> Can you see the bug, because I don't see it.
> Maybe it is a false positive...
Hm, if the leak wasn't there before and we didn't touch anything related to
prepare_creds(), I think that points to the leak being real.
But I see your point, still not seeing it.
This code should be equivalent to the code we have now (just boot
tested):
----
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 136a2c7fb9e5..7ebc2fd3097a 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -576,8 +576,7 @@ static int ovl_setup_cred_for_create(struct dentry *dentry, struct inode *inode,
* We must be called with creator creds already, otherwise we risk
* leaking creds.
*/
- WARN_ON_ONCE(override_creds(override_cred) != ovl_creds(dentry->d_sb));
- put_cred(override_cred);
+ WARN_ON_ONCE(override_creds_light(override_cred) != ovl_creds(dentry->d_sb));
return 0;
}
----
Does it change anything? (I wouldn't think so, just to try something)
>
> Christian, Miklos,
>
> Can you see a problem?
>
> Thanks,
> Amir.
>
>
> unreferenced object 0xffff888008ad8240 (size 192):
> comm "fanotify06", pid 1803, jiffies 4294890084
> hex dump (first 32 bytes):
> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace (crc ee6a93ea):
> [<00000000ab4340a4>] __create_object+0x22/0x83
> [<0000000053dcaf3b>] kmem_cache_alloc_noprof+0x156/0x1e6
> [<00000000b4a08c1d>] prepare_creds+0x1d/0xf9
> [<00000000c55dfb6c>] ovl_setup_cred_for_create+0x27/0x93
> [<00000000f82af4ee>] ovl_create_or_link+0x73/0x1bd
> [<0000000040a439db>] ovl_create_object+0xda/0x11d
> [<00000000fbbadf17>] lookup_open.isra.0+0x3a0/0x3ff
> [<0000000007a2faf0>] open_last_lookups+0x160/0x223
> [<00000000e7d8243a>] path_openat+0x136/0x1b5
> [<0000000004e51585>] do_filp_open+0x57/0xb8
> [<0000000053871b92>] do_sys_openat2+0x6f/0xc0
> [<000000004d76b8b7>] do_sys_open+0x3f/0x60
> [<000000009b0be238>] do_syscall_64+0x96/0xf8
> [<000000006ff466ad>] entry_SYSCALL_64_after_hwframe+0x76/0x7e
Cheers,
--
Vinicius
next prev parent reply other threads:[~2024-11-13 19:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 0:57 [PATCH v4 0/4] overlayfs: Optimize override/revert creds Vinicius Costa Gomes
2024-11-07 0:57 ` [PATCH v4 1/4] cred: Add a light version of override/revert_creds() Vinicius Costa Gomes
2024-11-07 0:57 ` [PATCH v4 2/4] fs/backing-file: Convert to revert/override_creds_light() Vinicius Costa Gomes
2024-11-07 0:57 ` [PATCH v4 3/4] ovl: use wrapper ovl_revert_creds() Vinicius Costa Gomes
2024-11-07 0:57 ` [PATCH v4 4/4] ovl: Optimize override/revert creds Vinicius Costa Gomes
2024-11-13 14:26 ` Amir Goldstein
2024-11-13 19:30 ` Vinicius Costa Gomes [this message]
2024-11-14 8:56 ` Amir Goldstein
2024-11-14 9:17 ` Amir Goldstein
2024-11-14 11:01 ` Amir Goldstein
2024-11-14 21:01 ` Vinicius Costa Gomes
2024-11-15 8:16 ` Amir Goldstein
2024-11-07 10:19 ` [PATCH v4 0/4] overlayfs: " Amir Goldstein
2024-11-08 16:57 ` Amir Goldstein
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=87ldxnrkxw.fsf@intel.com \
--to=vinicius.gomes@intel.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=hu1.chen@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=malini.bhandaru@intel.com \
--cc=mikko.ylinen@intel.com \
--cc=miklos@szeredi.hu \
--cc=tim.c.chen@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 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.