[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176535282315.498.10251081753003110803.tip-bot2@tip-bot2>
Date: Wed, 10 Dec 2025 07:47:03 -0000
From: "tip-bot2 for Yongxin Liu" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Yongxin Liu <yongxin.liu@...driver.com>, Ingo Molnar <mingo@...nel.org>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/urgent] x86/fpu: Fix FPU state core dump truncation on CPUs
with no extended xfeatures
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: c8161e5304abb26e6c0bec6efc947992500fa6c5
Gitweb: https://git.kernel.org/tip/c8161e5304abb26e6c0bec6efc947992500fa6c5
Author: Yongxin Liu <yongxin.liu@...driver.com>
AuthorDate: Wed, 10 Dec 2025 08:02:20 +08:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Wed, 10 Dec 2025 08:44:34 +01:00
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@...driver.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Link: https://patch.msgid.link/20251210000219.4094353-2-yongxin.liu@windriver.com
---
arch/x86/kernel/fpu/xstate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 48113c5..76153df 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -1946,7 +1946,7 @@ static int dump_xsave_layout_desc(struct coredump_params *cprm)
};
if (!dump_emit(cprm, &xc, sizeof(xc)))
- return 0;
+ return -1;
num_records++;
}
@@ -1984,7 +1984,7 @@ int elf_coredump_extra_notes_write(struct coredump_params *cprm)
return 1;
num_records = dump_xsave_layout_desc(cprm);
- if (!num_records)
+ if (num_records < 0)
return 1;
/* Total size should be equal to the number of records */
Powered by blists - more mailing lists