Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/fpu: Fix FPU state core dump truncation on CPUs with no extended xfeatures

Zero can be a valid value of num_records. For example, on Intel Atom x6425RE,
only x87 and SSE are supported (features 0, 1), and fpu_user_cfg.max_features
is 3. The for_each_extended_xfeature() loop only iterates feature 2, which is
not enabled, so num_records = 0. This is valid and should not cause core dump
failure.

The issue is that dump_xsave_layout_desc() returns 0 for both genuine errors
(dump_emit() failure) and valid cases (no extended features). Use negative
return values for errors and only abort on genuine failures.

Fixes: ba386777a30b ("x86/elf: Add a new FPU buffer layout info to x86 core files")
Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20251210000219.4094353-2-yongxin.liu@windriver.com

authored by

Yongxin Liu and committed by
Ingo Molnar
c8161e53 5288176a

+2 -2
+2 -2
arch/x86/kernel/fpu/xstate.c
··· 1946 1946 }; 1947 1947 1948 1948 if (!dump_emit(cprm, &xc, sizeof(xc))) 1949 - return 0; 1949 + return -1; 1950 1950 1951 1951 num_records++; 1952 1952 } ··· 1984 1984 return 1; 1985 1985 1986 1986 num_records = dump_xsave_layout_desc(cprm); 1987 - if (!num_records) 1987 + if (num_records < 0) 1988 1988 return 1; 1989 1989 1990 1990 /* Total size should be equal to the number of records */