[PATCH v3 2/2] vfs: avoid duplicating creds in faccessat if possible

Linus Torvalds torvalds at linux-foundation.org
Sat Mar 4 23:52:39 UTC 2023


On Sat, Mar 4, 2023 at 3:08 PM Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Well, this particular patch at least boots for me for my normal
> config. Not that I've run any extensive tests, but I'm writing this
> email while running this patch, so ..

Hmm. I enabled the KUNIT tests, and used an odd CONFIG_NR_CPUS to test
this a bit more.

So in my situation, I have 64 threads, and so nr_cpu_ids is 64, and
CONFIG_NR_CPUS is 150.

Then one cpumask KUNIT test fails with

     # test_cpumask_weight: EXPECTATION FAILED at lib/cpumask_kunit.c:70
                  Expected ((unsigned int)150) == cpumask_weight(&mask_all), but
                      ((unsigned int)150) == 150 (0x96)
                      cpumask_weight(&mask_all) == 64 (0x40)
              &mask_all contains CPUs 0-63

but I think that's actually a KUNIT test bug.

The KUNIT test there is

        KUNIT_EXPECT_EQ_MSG(test, nr_cpumask_bits,
cpumask_weight(&mask_all), MASK_MSG(&mask_all));

and it should *not* expect the cpumask weight to be nr_cpumask_bits,
it should expect it to be nr_cpu_ids.

That only matters now that nr_cpumask_bits isn't the same as nr_cpu_ids./

Anyway, I still think that patch of mine is fine, and I think this
test failure only ends up being about the test, not the patch.

            Linus



More information about the Linux-security-module-archive mailing list