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] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW9AofPgVKEL6bk1@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>
Date: Tue, 20 Jan 2026 14:15:21 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: Ye Bin <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 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.
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