[LTP] [PATCH] cve-2015-3290: Fix tst_syscall() return value

Richard Palethorpe rpalethorpe@suse.de
Thu Feb 16 10:24:51 CET 2023


Hello,

Martin Doucha <mdoucha@suse.cz> writes:

> The modify_ldt() syscall returns 32-bit signed integer value. Recent changes
> in tst_syscall() caused the value to be interpreted as unsigned on older
> kernels/glibc, which breaks the cve-2015-3290 test. Add explicit type cast
> to fix it.

This is strange, currently for the test to work the return 32bit return
value must be sign extended to 64bit so that it equals -EINVAL (right?).

Meanwhile kernel has never changed the return value, it's always 32bit
("which is a bug"). I can't find any change in glibc either that would
explain it.

I am missing something or is it a mystery?

>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>  testcases/cve/cve-2015-3290.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c
> index f61d2809b..a2a8fcedd 100644
> --- a/testcases/cve/cve-2015-3290.c
> +++ b/testcases/cve/cve-2015-3290.c
> @@ -195,7 +195,8 @@ static void set_ldt(void)
>  		.useable	 = 0
>  	};
>  
> -	TEST(tst_syscall(__NR_modify_ldt, 1, &data_desc, sizeof(data_desc)));
> +	TEST((int)tst_syscall(__NR_modify_ldt, 1, &data_desc,
> +		sizeof(data_desc)));
>  	if (TST_RET == -EINVAL) {
>  		tst_brk(TCONF | TRERRNO,
>  			"modify_ldt: 16-bit data segments are probably disabled");
> -- 
> 2.39.0


-- 
Thank you,
Richard.


More information about the ltp mailing list