lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXChqhSUCgUFkWnH@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>
Date: Wed, 21 Jan 2026 15:21:38 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: yebin <yebin@...weicloud.com>
Cc: tytso@....edu, adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
        jack@...e.cz
Subject: Re: [PATCH] ext4: fix mballoc-test.c is not compiled when
 EXT4_KUNIT_TESTS=M

On Wed, Jan 21, 2026 at 05:04:12PM +0800, yebin wrote:
> 
> 
> On 2026/1/20 16:45, Ojaswin Mujoo wrote:
> > On Mon, Jan 19, 2026 at 09:12:57PM +0800, Ye Bin wrote:
> > > From: Ye Bin <yebin10@...wei.com>
> > > 
> > > Now, only EXT4_KUNIT_TESTS=Y testcase will be compiled in 'mballoc.c'.
> > > 
> > > EXT4_FS      KUNIT    EXT4_KUNIT_TESTS
> > > Y              Y         Y
> > > Y              Y         M
> > > Y              M         M // This case will lead to link error
> > > M              Y         M
> > > M              M         M
> > > 
> > > Fixes: 7c9fa399a369 ("ext4: add first unit test for ext4_mb_new_blocks_simple in mballoc")
> > > Signed-off-by: Ye Bin <yebin10@...wei.com>
> > > ---
> > >   fs/ext4/mballoc.c | 6 +++++-
> > >   1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> > > index e817a758801d..0fbd2dfae497 100644
> > > --- a/fs/ext4/mballoc.c
> > > +++ b/fs/ext4/mballoc.c
> > > @@ -7191,6 +7191,10 @@ ext4_mballoc_query_range(
> > >   	return error;
> > >   }
> > > 
> > > -#ifdef CONFIG_EXT4_KUNIT_TESTS
> > > +#if IS_ENABLED(CONFIG_EXT4_KUNIT_TESTS)
> > > +#if IS_BUILTIN(CONFIG_EXT4_FS) && IS_MODULE(CONFIG_KUNIT)
> > > +/* This case will lead to link error. */
> > > +#else
> > >   #include "mballoc-test.c"
> > >   #endif
> > > +#endif
> > 
> > Hi Ye Bin,
> > 
> > Thanks for pointing out this issue but your solution seems to be having
> > a side effect of making ext4.ko depend on kunit.ko.
> > 
> >    modinfo ext4.ko
> >    license:        GPL
> >    license:        GPL
> >    description:    Fourth Extended Filesystem
> >    author:         Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
> >    alias:          fs-ext4
> >    alias:          ext3
> >    alias:          fs-ext3
> >    depends:        kunit
> >    intree:         Y
> >    name:           ext4
> >    retpoline:      Y
> >    vermagic:       6.19.0-rc4-xfstests-g326263653b81-dirty SMP preempt mod_unload
> > 
> > That means we won't be able to insert ext4 module without having kunit.
> 
> Thank you for your reply.
> In my opinion, if the CONFIG_EXT4_KUNIT_TESTS configuration is enabled and
> ext4.ko uses symbols from kunit.ko, then it is normal for ext4.ko to depend
> on kunit.ko.

Hi Ye,

I just feel it adds a dependency that might catch people by surprise.
For example, I'm looking at some RHEL kernel configs, we have EXT4_KUNIT_TESTS=m, 
KUNIT=m, EXT4=m. So incase this patch reaches some distros in future, we
will can have kunit module inserted everytime someone wants to use ext4 in
production, which is infact not recommended by the Kunit docs itself.

I still feel we should avoid this dependency. Eventually we may need to
see if can just build the tests as a module [1] rather than #include
method to avoid these issues.

Regards,
ojaswin


[1] https://docs.kernel.org/dev-tools/kunit/usage.html#testing-static-functions

> 
> > This is not the behavior we want. I think a more simpler fix here could
> > be:
> > 
> >    #if IS_BUILTIN(CONFIG_KUNIT) && IS_ENABLED(CONFIG_EXT4_KUNIT_TESTS)
> >    #include "mballoc-test.c"
> >    #endif
> > 
> > So basically, as long as KUNIT=y and EXT4_KUNIT_TESTS=y/m we will run
> > these tests, otherwise we won't. This also removes the dependency issue.
> > 
> > What do you think?
> > 
> > Regards,
> > ojaswin
> > 
> > > --
> > > 2.34.1
> > > 
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ