[LTP] [PATCH v3 2/2] Add test for CVE 2021-38198

Petr Vorel pvorel@suse.cz
Mon May 6 22:02:10 CEST 2024


Hi Martin, Cyril,

> Hi Martin, Cyril,

> > +static struct tst_test test = {
> > +	.test_all = tst_kvm_run,
> > +	.setup = setup,
> > +	.cleanup = tst_kvm_cleanup,
> > +	.needs_root = 1,

> This test was merged some time ago.

> FYI this .needs_root generates -Wsingle-bit-bitfield-constant-conversion error.
> Nothing important, maybe you see an easy way to fix it.

> kvm_pagefault01.c:218:16: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
>         .needs_root = 1,
>                       ^
> 1 warning generated.

I'm sorry, this is not specific to KVM tests (and indeed, I was not able to find
how this could be specific), but to any test built with clang (gcc simply does
not issue this error). Obviously the problem is for any 1 bit field member in
struct tst_test. The fix is quite simple - turn them to unsigned int.

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?id=eab9100d9898cbd37882b04415b12156f8942f18

Kind regards,
Petr

> Kind regards,
> Petr


More information about the ltp mailing list