From: Christian Brauner <brauner@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "Daniel Díaz" <daniel.diaz@linaro.org>,
"Naresh Kamboju" <naresh.kamboju@linaro.org>,
"open list" <linux-kernel@vger.kernel.org>,
linux-ext4 <linux-ext4@vger.kernel.org>,
linux-fsdevel@vger.kernel.org, lkft-triage@lists.linaro.org,
"Jan Kara" <jack@suse.cz>,
"Andreas Dilger" <adilger.kernel@dilger.ca>,
"Theodore Ts'o" <tytso@mit.edu>,
"Randy Dunlap" <rdunlap@infradead.org>,
shikemeng@huaweicloud.com, "Arnd Bergmann" <arnd@arndb.de>,
"Dan Carpenter" <dan.carpenter@linaro.org>
Subject: Re: ext4_mballoc_test: Internal error: Oops: map_id_range_down (kernel/user_namespace.c:318)
Date: Thu, 29 Feb 2024 11:09:24 +0100 [thread overview]
Message-ID: <20240229-stapfen-eistee-9d946b4a3a9d@brauner> (raw)
In-Reply-To: <7e1c18e3-7523-4fe6-affe-d3f143ad79e3@roeck-us.net>
On Wed, Feb 28, 2024 at 11:33:36AM -0800, Guenter Roeck wrote:
> On 2/28/24 11:26, Daniel Díaz wrote:
> > Hello!
> >
> > On Wed, 28 Feb 2024 at 12:19, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> > > Kunit ext4_mballoc_test tests found following kernel oops on Linux next.
> > > All ways reproducible on all the architectures and steps to reproduce shared
> > > in the bottom of this email.
> > >
> > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > >
>
> [ ... ]
>
> > +Guenter. Just the thing we were talking about, at about the same time.
> >
>
> Good that others see the same problem. Thanks a lot for reporting!
Hm...
static struct super_block *mbt_ext4_alloc_super_block(void)
{ struct ext4_super_block *es = kzalloc(sizeof(*es), GFP_KERNEL);
struct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
struct mbt_ext4_super_block *fsb = kzalloc(sizeof(*fsb), GFP_KERNEL);
if (fsb == NULL || sbi == NULL || es == NULL)
goto out;
sbi->s_es = es;
fsb->sb.s_fs_info = sbi;
return &fsb->sb;
out:
kfree(fsb);
kfree(sbi);
kfree(es);
return NULL;
}
That VFS level struct super_block that is returned from this function is
never really initialized afaict? Therefore, sb->s_user_ns == NULL:
i_uid_write(sb, ...)
-> NULL = i_user_ns(sb)
-> make_kuid(NULL)
-> map_id_range_down(NULL)
Outside of this test this can never be the case. See alloc_super() in
fs/super.c. So to stop the bleeding this needs something like:
static struct super_block *mbt_ext4_alloc_super_block(void)
{
struct ext4_super_block *es = kzalloc(sizeof(*es), GFP_KERNEL);
struct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
struct mbt_ext4_super_block *fsb = kzalloc(sizeof(*fsb), GFP_KERNEL);
if (fsb == NULL || sbi == NULL || es == NULL)
goto out;
sbi->s_es = es;
fsb->sb.s_fs_info = sbi;
+ fsb.sb.s_user_ns = &init_user_ns;
return &fsb->sb;
out:
kfree(fsb);
kfree(sbi);
kfree(es);
return NULL;
}
next prev parent reply other threads:[~2024-02-29 10:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 18:19 fs: ext4_mballoc_test: Internal error: Oops: map_id_range_down (kernel/user_namespace.c:318) Naresh Kamboju
2024-02-28 19:26 ` Daniel Díaz
2024-02-28 19:33 ` Guenter Roeck
2024-02-29 10:09 ` Christian Brauner [this message]
2024-02-29 11:35 ` Kemeng Shi
2024-03-01 3:19 ` Kemeng Shi
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=20240229-stapfen-eistee-9d946b4a3a9d@brauner \
--to=brauner@kernel.org \
--cc=adilger.kernel@dilger.ca \
--cc=arnd@arndb.de \
--cc=dan.carpenter@linaro.org \
--cc=daniel.diaz@linaro.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lkft-triage@lists.linaro.org \
--cc=naresh.kamboju@linaro.org \
--cc=rdunlap@infradead.org \
--cc=shikemeng@huaweicloud.com \
--cc=tytso@mit.edu \
/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