* [PATCH v1 0/4] x86: Simplifying LAM
@ 2026-02-20 12:46 Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 1/4] x86/process: Shorten the default LAM tag width Maciej Wieczor-Retman
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Maciej Wieczor-Retman @ 2026-02-20 12:46 UTC (permalink / raw)
To: peterz, will, oleg, xin, maciej.wieczor-retman, dave.hansen,
tglx, james.morse, akpm, seanjc, ryan.roberts, riel, mingo,
shuah, hpa, brgerst, bp, luto, baohua, ubizjak
Cc: x86, linux-kernel, linux-kselftest, m.wieczorretman
After ChkTag [1] announcement, it's worth preparing a stable x86 linear
address masking (lam) user interface. One important aspect of lam is the
tag width, and aligning it with other industry solutions can provide a
more popular, generalized interface that other technologies could
utilize.
ChkTag will use 4-bit tags and since that's the direction other memory
tagging implementations seem to be taking too (for example Arm's MTE)
it's reasonable to converge lam in linux to the same specification. Even
though x86's LAM supports 6-bit tags it is beneficial to default lam to
4 bits as ChkTag will likely be the main user of the interface and such
connection should simplify things in the future.
6-bit tags should still be available as a debug feature and possible to
enable through debugfs. Tag width can be system wide whether it's the
default 4 bits or debug 6 bits and when a process requests a specific tag
width it should get the max amount enabled globally.
Series also cleans up some comments referencing LAM_U48 which was not
implemented in the kernel and the comments shouldn't imply it can be
enabled.
Patches are based on v6.19.
[1] https://community.intel.com/t5/Blogs/Tech-Innovation/open-intel/ChkTag-x86-Memory-Safety/post/1721490
Maciej Wieczor-Retman (4):
x86/process: Shorten the default LAM tag width
x86/process: Add a debug interface to change LAM tag width
x86/mm: Cleanup comments where LAM_U48 is mentioned
selftests/lam: Add test cases for different LAM tag widths
arch/x86/include/asm/mmu.h | 2 +-
arch/x86/include/asm/mmu_context.h | 3 ++
arch/x86/include/asm/tlbflush.h | 2 +-
arch/x86/kernel/process_64.c | 71 +++++++++++++++++++++---
tools/testing/selftests/x86/lam.c | 87 +++++++++++++++++++++++++-----
5 files changed, 144 insertions(+), 21 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 1/4] x86/process: Shorten the default LAM tag width
2026-02-20 12:46 [PATCH v1 0/4] x86: Simplifying LAM Maciej Wieczor-Retman
@ 2026-02-20 12:48 ` Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 2/4] x86/process: Add a debug interface to change " Maciej Wieczor-Retman
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Maciej Wieczor-Retman @ 2026-02-20 12:48 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin
Cc: m.wieczorretman, Maciej Wieczor-Retman, linux-kernel
From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
With the announcement of ChkTag, it's worth preparing a stable x86
linear address masking (lam) user interface. One important aspect of lam
is the tag width, and aligning it with other industry solutions can
provide a more popular, generalized interface that other technologies
could utilize.
ChkTag will use 4-bit tags and since that's the direction other memory
tagging implementations seem to be taking too (for example Arm's MTE)
it's reasonable to converge lam in linux to the same specification. Even
though x86's LAM supports 6-bit tags it is beneficial to default lam to
4 bits as ChkTag will likely be the main user of the interface and such
connection should simplify things in the future.
Set the default tag width to 4 bits and make it variable. While static
keys were considered to implement it, the LAM tag width isn't used in
any performance intensive code paths, and doesn't justify anything more
than a simple global variable.
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
---
arch/x86/include/asm/mmu_context.h | 3 +++
arch/x86/kernel/process_64.c | 15 +++++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 73bf3b1b44e8..13999d48abd6 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -86,6 +86,9 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next)
#endif
#ifdef CONFIG_ADDRESS_MASKING
+
+extern unsigned long lam_available_bits;
+
static inline unsigned long mm_lam_cr3_mask(struct mm_struct *mm)
{
/*
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 432c0a004c60..04968b303e66 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -797,7 +797,10 @@ static long prctl_map_vdso(const struct vdso_image *image, unsigned long addr)
#ifdef CONFIG_ADDRESS_MASKING
-#define LAM_U57_BITS 6
+#define LAM_MAX_BITS 6
+#define LAM_DEFAULT_BITS 4
+
+unsigned long lam_available_bits = LAM_DEFAULT_BITS;
static void enable_lam_func(void *__mm)
{
@@ -811,10 +814,10 @@ static void enable_lam_func(void *__mm)
}
}
-static void mm_enable_lam(struct mm_struct *mm)
+static void mm_enable_lam(struct mm_struct *mm, unsigned long nr_bits)
{
mm->context.lam_cr3_mask = X86_CR3_LAM_U57;
- mm->context.untag_mask = ~GENMASK(62, 57);
+ mm->context.untag_mask = ~GENMASK(57 + lam_available_bits - 1, 57);
/*
* Even though the process must still be single-threaded at this
@@ -850,12 +853,12 @@ static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits)
return -EBUSY;
}
- if (!nr_bits || nr_bits > LAM_U57_BITS) {
+ if (!nr_bits || nr_bits > lam_available_bits) {
mmap_write_unlock(mm);
return -EINVAL;
}
- mm_enable_lam(mm);
+ mm_enable_lam(mm, nr_bits);
mmap_write_unlock(mm);
@@ -965,7 +968,7 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
if (!cpu_feature_enabled(X86_FEATURE_LAM))
return put_user(0, (unsigned long __user *)arg2);
else
- return put_user(LAM_U57_BITS, (unsigned long __user *)arg2);
+ return put_user(lam_available_bits, (unsigned long __user *)arg2);
#endif
case ARCH_SHSTK_ENABLE:
case ARCH_SHSTK_DISABLE:
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 2/4] x86/process: Add a debug interface to change LAM tag width
2026-02-20 12:46 [PATCH v1 0/4] x86: Simplifying LAM Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 1/4] x86/process: Shorten the default LAM tag width Maciej Wieczor-Retman
@ 2026-02-20 12:48 ` Maciej Wieczor-Retman
2026-02-20 16:41 ` kernel test robot
2026-02-20 12:48 ` [PATCH v1 3/4] x86/mm: Cleanup comments where LAM_U48 is mentioned Maciej Wieczor-Retman
2026-02-20 12:49 ` [PATCH v1 4/4] selftests/lam: Add test cases for different LAM tag widths Maciej Wieczor-Retman
3 siblings, 1 reply; 7+ messages in thread
From: Maciej Wieczor-Retman @ 2026-02-20 12:48 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin
Cc: m.wieczorretman, Maciej Wieczor-Retman, linux-kernel
From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
While shortening the tag bits to converge the specifications of LAM and
ChkTag, the 6 bit wide LAM (Linear Address Masking) tags should still be
available to use. Since using this tag width is likely going to be for
debug purposes only, using debugfs is the best choice.
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
---
arch/x86/kernel/process_64.c | 56 ++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 04968b303e66..2f9f74cddd2a 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -41,6 +41,7 @@
#include <linux/ftrace.h>
#include <linux/syscalls.h>
#include <linux/iommu.h>
+#include <linux/debugfs.h>
#include <asm/processor.h>
#include <asm/pkru.h>
@@ -802,6 +803,61 @@ static long prctl_map_vdso(const struct vdso_image *image, unsigned long addr)
unsigned long lam_available_bits = LAM_DEFAULT_BITS;
+static ssize_t lam_bits_read_file(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ char buf[2];
+ unsigned int len;
+
+ len = sprintf(buf, "%ld\n", lam_available_bits);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+/*
+ * Writing a number to this file changes the used lam tag width. Valid values
+ * are 4 bit tag width and 6 bit tag width - the second, non-default one is
+ * meant mostly for debug and shall be deprecated in the future.
+ */
+static ssize_t lam_bits_write_file(struct file *file,
+ const char __user *user_buf, size_t count,
+ loff_t *ppos)
+{
+ char buf[32];
+ ssize_t len;
+ int ceiling;
+ u8 bits;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (kstrtou8(buf, 0, &bits))
+ return -EINVAL;
+
+ switch (bits) {
+ case LAM_DEFAULT_BITS:
+ case LAM_MAX_BITS:
+ lam_available_bits = bits;
+ return count;
+ default:
+ return -EINVAL;
+ }
+}
+
+static const struct file_operations fops_lam_bits = {
+ .read = lam_bits_read_file,
+ .write = lam_bits_write_file,
+};
+
+static int __init create_lam_available_bits(void)
+{
+ debugfs_create_file("lam_available_bits", 0600,
+ arch_debugfs_dir, NULL, &fops_lam_bits);
+ return 0;
+}
+late_initcall(create_lam_available_bits);
+
static void enable_lam_func(void *__mm)
{
struct mm_struct *mm = __mm;
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 3/4] x86/mm: Cleanup comments where LAM_U48 is mentioned
2026-02-20 12:46 [PATCH v1 0/4] x86: Simplifying LAM Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 1/4] x86/process: Shorten the default LAM tag width Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 2/4] x86/process: Add a debug interface to change " Maciej Wieczor-Retman
@ 2026-02-20 12:48 ` Maciej Wieczor-Retman
2026-02-20 12:49 ` [PATCH v1 4/4] selftests/lam: Add test cases for different LAM tag widths Maciej Wieczor-Retman
3 siblings, 0 replies; 7+ messages in thread
From: Maciej Wieczor-Retman @ 2026-02-20 12:48 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin
Cc: m.wieczorretman, Maciej Wieczor-Retman, linux-kernel
From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
For simplicity only the LAM_U57 mode is implemented in the kernel. No
matter whether the enabled paging mode is 5-level or 4-level the masked
tag bits are the same as on a 5-level system.
Remove two mentions of LAM_U48 which implied that it could be enabled.
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
---
arch/x86/include/asm/mmu.h | 2 +-
arch/x86/include/asm/tlbflush.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
index 0fe9c569d171..9dcfce439c19 100644
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -49,7 +49,7 @@ typedef struct {
unsigned long flags;
#ifdef CONFIG_ADDRESS_MASKING
- /* Active LAM mode: X86_CR3_LAM_U48 or X86_CR3_LAM_U57 or 0 (disabled) */
+ /* Active LAM mode: X86_CR3_LAM_U57 or 0 (disabled) */
unsigned long lam_cr3_mask;
/* Significant bits of the virtual address. Excludes tag bits. */
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 00daedfefc1b..fe6458619f64 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -110,7 +110,7 @@ struct tlb_state {
/*
* Active LAM mode.
*
- * X86_CR3_LAM_U57/U48 shifted right by X86_CR3_LAM_U57_BIT or 0 if LAM
+ * X86_CR3_LAM_U57 shifted right by X86_CR3_LAM_U57_BIT or 0 if LAM
* disabled.
*/
u8 lam;
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 4/4] selftests/lam: Add test cases for different LAM tag widths
2026-02-20 12:46 [PATCH v1 0/4] x86: Simplifying LAM Maciej Wieczor-Retman
` (2 preceding siblings ...)
2026-02-20 12:48 ` [PATCH v1 3/4] x86/mm: Cleanup comments where LAM_U48 is mentioned Maciej Wieczor-Retman
@ 2026-02-20 12:49 ` Maciej Wieczor-Retman
3 siblings, 0 replies; 7+ messages in thread
From: Maciej Wieczor-Retman @ 2026-02-20 12:49 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Shuah Khan
Cc: m.wieczorretman, Maciej Wieczor-Retman, linux-kernel, linux-kselftest
From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
After the default tag width in LAM (Linear Address Masking) is set to 4
bits, it's still possible to enable 6 bit wide tags for debug purposes
through debugfs.
When a program enables LAM, it should be able to, through a syscall,
request a number of tag bits equal or smaller to the one used system
wide. If it requests a smaller one it should receive the system wide
setting anyway.
Change the default tag width. Add four tests to check all combinations
of tag width requests. Modify the existing test infrastructure to check
with a syscall what the needed tag width actually is.
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
---
tools/testing/selftests/x86/lam.c | 87 ++++++++++++++++++++++++++-----
1 file changed, 74 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c
index 1919fa6daec0..9ed2964082eb 100644
--- a/tools/testing/selftests/x86/lam.c
+++ b/tools/testing/selftests/x86/lam.c
@@ -26,9 +26,11 @@
/* LAM modes, these definitions were copied from kernel code */
#define LAM_NONE 0
-#define LAM_U57_BITS 6
+#define LAM_U57_BITS 4
+#define LAM_MAX_BITS 6
-#define LAM_U57_MASK (0x3fULL << 57)
+#define LAM_U57_MASK (0xfULL << 57)
+#define LAM_MAX_MASK (0x3fULL << 57)
/* arch prctl for LAM */
#define ARCH_GET_UNTAG_MASK 0x4001
#define ARCH_ENABLE_TAGGED_ADDR 0x4002
@@ -175,7 +177,7 @@ static int set_lam(unsigned long lam)
int ret = 0;
uint64_t ptr = 0;
- if (lam != LAM_U57_BITS && lam != LAM_NONE)
+ if (lam != LAM_U57_BITS && lam != LAM_MAX_BITS && lam != LAM_NONE)
return -1;
/* Skip check return */
@@ -184,16 +186,21 @@ static int set_lam(unsigned long lam)
/* Get untagged mask */
syscall(SYS_arch_prctl, ARCH_GET_UNTAG_MASK, &ptr);
+ /* Update lam in case lam6 is enabled */
+ syscall(SYS_arch_prctl, ARCH_GET_MAX_TAG_BITS, &lam);
+
/* Check mask returned is expected */
if (lam == LAM_U57_BITS)
ret = (ptr != ~(LAM_U57_MASK));
+ else if (lam == LAM_MAX_BITS)
+ ret = (ptr != ~(LAM_MAX_MASK));
else if (lam == LAM_NONE)
ret = (ptr != -1ULL);
return ret;
}
-static unsigned long get_default_tag_bits(void)
+static unsigned long get_default_tag_bits(int bits)
{
pid_t pid;
int lam = LAM_NONE;
@@ -204,8 +211,8 @@ static unsigned long get_default_tag_bits(void)
perror("Fork failed.");
} else if (pid == 0) {
/* Set LAM mode in child process */
- if (set_lam(LAM_U57_BITS) == 0)
- lam = LAM_U57_BITS;
+ if (set_lam(bits) == 0)
+ syscall(SYS_arch_prctl, ARCH_GET_MAX_TAG_BITS, &lam);
else
lam = LAM_NONE;
exit(lam);
@@ -217,6 +224,27 @@ static unsigned long get_default_tag_bits(void)
return lam;
}
+static int change_lam_width(unsigned char width)
+{
+ char buf[2];
+ int ret, fd;
+
+ snprintf(buf, sizeof(buf), "%u", width);
+ fd = open("/sys/kernel/debug/x86/lam_available_bits", O_WRONLY);
+ if (fd < 0) {
+ ksft_print_msg("lam_available_bits debug file not found!\n");
+ return fd;
+ }
+
+ ret = write(fd, buf, sizeof(buf));
+ if (ret < 0)
+ return ret;
+
+ close(fd);
+
+ return 0;
+}
+
/*
* Set tagged address and read back untag mask.
* check if the untag mask is expected.
@@ -284,20 +312,32 @@ static int handle_lam_test(void *src, unsigned int lam)
return (!!strcmp((char *)src, (char *)ptr));
}
-
int handle_max_bits(struct testcases *test)
{
- unsigned long exp_bits = get_default_tag_bits();
- unsigned long bits = 0;
+ unsigned long exp_bits, bits = 0;
+ int ret = 1;
- if (exp_bits != LAM_NONE)
- exp_bits = LAM_U57_BITS;
+ if (test->later) {
+ ret = change_lam_width(LAM_MAX_BITS);
+ if (ret)
+ return ret;
+ }
+
+ exp_bits = get_default_tag_bits(test->lam);
/* Get LAM max tag bits */
if (syscall(SYS_arch_prctl, ARCH_GET_MAX_TAG_BITS, &bits) == -1)
- return 1;
+ goto out;
- return (exp_bits != bits);
+ ret = exp_bits != bits;
+out:
+ if (test->later) {
+ ret = change_lam_width(LAM_U57_BITS);
+ if (ret)
+ return ret;
+ }
+
+ return ret;
}
/*
@@ -968,9 +1008,30 @@ static struct testcases malloc_cases[] = {
static struct testcases bits_cases[] = {
{
+ .later = 0,
+ .lam = LAM_U57_BITS,
.test_func = handle_max_bits,
.msg = "BITS: Check default tag bits\n",
},
+ {
+ .later = 1,
+ .lam = LAM_U57_BITS,
+ .test_func = handle_max_bits,
+ .msg = "BITS: Check if 4 bits can be requested in 6 bit mode.\n",
+ },
+ {
+ .later = 0,
+ .expected = 1,
+ .lam = LAM_MAX_BITS,
+ .test_func = handle_max_bits,
+ .msg = "BITS:[Negative] Check if 6 bits can be requested in 4 bit mode.\n",
+ },
+ {
+ .later = 1,
+ .lam = LAM_MAX_BITS,
+ .test_func = handle_max_bits,
+ .msg = "BITS: Check if 6 bits can be requested in 6 bit mode.\n",
+ },
};
static struct testcases syscall_cases[] = {
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/4] x86/process: Add a debug interface to change LAM tag width
2026-02-20 12:48 ` [PATCH v1 2/4] x86/process: Add a debug interface to change " Maciej Wieczor-Retman
@ 2026-02-20 16:41 ` kernel test robot
2026-02-20 16:57 ` Maciej Wieczor-Retman
0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2026-02-20 16:41 UTC (permalink / raw)
To: Maciej Wieczor-Retman, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
Cc: llvm, oe-kbuild-all, m.wieczorretman, Maciej Wieczor-Retman,
linux-kernel
Hi Maciej,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/x86/core]
[also build test WARNING on peterz-queue/sched/core akpm-mm/mm-everything linus/master v6.19 next-20260220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Maciej-Wieczor-Retman/x86-process-Shorten-the-default-LAM-tag-width/20260220-205155
base: tip/x86/core
patch link: https://lore.kernel.org/r/5ed38af72848015f3417c462e624e52891dc14ed.1771589807.git.m.wieczorretman%40pm.me
patch subject: [PATCH v1 2/4] x86/process: Add a debug interface to change LAM tag width
config: x86_64-buildonly-randconfig-001-20260220 (https://download.01.org/0day-ci/archive/20260221/202602210040.C4PVoS0u-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260221/202602210040.C4PVoS0u-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602210040.C4PVoS0u-lkp@intel.com/
All warnings (new ones prefixed by >>):
arch/x86/kernel/process_64.c:812:8: warning: 'sprintf' will always overflow; destination buffer has size 2, but format string expands to at least 3 [-Wformat-overflow]
812 | len = sprintf(buf, "%ld\n", lam_available_bits);
| ^
>> arch/x86/kernel/process_64.c:827:6: warning: unused variable 'ceiling' [-Wunused-variable]
827 | int ceiling;
| ^~~~~~~
2 warnings generated.
vim +/ceiling +827 arch/x86/kernel/process_64.c
815
816 /*
817 * Writing a number to this file changes the used lam tag width. Valid values
818 * are 4 bit tag width and 6 bit tag width - the second, non-default one is
819 * meant mostly for debug and shall be deprecated in the future.
820 */
821 static ssize_t lam_bits_write_file(struct file *file,
822 const char __user *user_buf, size_t count,
823 loff_t *ppos)
824 {
825 char buf[32];
826 ssize_t len;
> 827 int ceiling;
828 u8 bits;
829
830 len = min(count, sizeof(buf) - 1);
831 if (copy_from_user(buf, user_buf, len))
832 return -EFAULT;
833
834 buf[len] = '\0';
835 if (kstrtou8(buf, 0, &bits))
836 return -EINVAL;
837
838 switch (bits) {
839 case LAM_DEFAULT_BITS:
840 case LAM_MAX_BITS:
841 lam_available_bits = bits;
842 return count;
843 default:
844 return -EINVAL;
845 }
846 }
847
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/4] x86/process: Add a debug interface to change LAM tag width
2026-02-20 16:41 ` kernel test robot
@ 2026-02-20 16:57 ` Maciej Wieczor-Retman
0 siblings, 0 replies; 7+ messages in thread
From: Maciej Wieczor-Retman @ 2026-02-20 16:57 UTC (permalink / raw)
To: kernel test robot
Cc: Maciej Wieczor-Retman, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, llvm,
oe-kbuild-all, linux-kernel
I'll correct these in the next version.
On 2026-02-21 at 00:41:41 +0800, kernel test robot wrote:
>Hi Maciej,
>
>kernel test robot noticed the following build warnings:
>
>[auto build test WARNING on tip/x86/core]
>[also build test WARNING on peterz-queue/sched/core akpm-mm/mm-everything linus/master v6.19 next-20260220]
>[If your patch is applied to the wrong git tree, kindly drop us a note.
>And when submitting patch, we suggest to use '--base' as documented in
>https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
>url: https://github.com/intel-lab-lkp/linux/commits/Maciej-Wieczor-Retman/x86-process-Shorten-the-default-LAM-tag-width/20260220-205155
>base: tip/x86/core
>patch link: https://lore.kernel.org/r/5ed38af72848015f3417c462e624e52891dc14ed.1771589807.git.m.wieczorretman%40pm.me
>patch subject: [PATCH v1 2/4] x86/process: Add a debug interface to change LAM tag width
>config: x86_64-buildonly-randconfig-001-20260220 (https://download.01.org/0day-ci/archive/20260221/202602210040.C4PVoS0u-lkp@intel.com/config)
>compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
>rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
>reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260221/202602210040.C4PVoS0u-lkp@intel.com/reproduce)
>
>If you fix the issue in a separate patch/commit (i.e. not just a new version of
>the same patch/commit), kindly add following tags
>| Reported-by: kernel test robot <lkp@intel.com>
>| Closes: https://lore.kernel.org/oe-kbuild-all/202602210040.C4PVoS0u-lkp@intel.com/
>
>All warnings (new ones prefixed by >>):
>
> arch/x86/kernel/process_64.c:812:8: warning: 'sprintf' will always overflow; destination buffer has size 2, but format string expands to at least 3 [-Wformat-overflow]
> 812 | len = sprintf(buf, "%ld\n", lam_available_bits);
> | ^
>>> arch/x86/kernel/process_64.c:827:6: warning: unused variable 'ceiling' [-Wunused-variable]
> 827 | int ceiling;
> | ^~~~~~~
> 2 warnings generated.
>
>
>vim +/ceiling +827 arch/x86/kernel/process_64.c
>
> 815
> 816 /*
> 817 * Writing a number to this file changes the used lam tag width. Valid values
> 818 * are 4 bit tag width and 6 bit tag width - the second, non-default one is
> 819 * meant mostly for debug and shall be deprecated in the future.
> 820 */
> 821 static ssize_t lam_bits_write_file(struct file *file,
> 822 const char __user *user_buf, size_t count,
> 823 loff_t *ppos)
> 824 {
> 825 char buf[32];
> 826 ssize_t len;
> > 827 int ceiling;
> 828 u8 bits;
> 829
> 830 len = min(count, sizeof(buf) - 1);
> 831 if (copy_from_user(buf, user_buf, len))
> 832 return -EFAULT;
> 833
> 834 buf[len] = '\0';
> 835 if (kstrtou8(buf, 0, &bits))
> 836 return -EINVAL;
> 837
> 838 switch (bits) {
> 839 case LAM_DEFAULT_BITS:
> 840 case LAM_MAX_BITS:
> 841 lam_available_bits = bits;
> 842 return count;
> 843 default:
> 844 return -EINVAL;
> 845 }
> 846 }
> 847
>
>--
>0-DAY CI Kernel Test Service
>https://github.com/intel/lkp-tests/wiki
--
Kind regards
Maciej Wieczór-Retman
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-20 16:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-20 12:46 [PATCH v1 0/4] x86: Simplifying LAM Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 1/4] x86/process: Shorten the default LAM tag width Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 2/4] x86/process: Add a debug interface to change " Maciej Wieczor-Retman
2026-02-20 16:41 ` kernel test robot
2026-02-20 16:57 ` Maciej Wieczor-Retman
2026-02-20 12:48 ` [PATCH v1 3/4] x86/mm: Cleanup comments where LAM_U48 is mentioned Maciej Wieczor-Retman
2026-02-20 12:49 ` [PATCH v1 4/4] selftests/lam: Add test cases for different LAM tag widths Maciej Wieczor-Retman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome