* [PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE
@ 2025-09-19 12:58 Yao Zi
2025-09-19 13:21 ` Wentao Guan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yao Zi @ 2025-09-19 12:58 UTC (permalink / raw)
To: Huacai Chen, WANG Xuerui, Thomas Huth, Yao Zi, Thomas Gleixner,
Xi Ruoyao
Cc: loongarch, linux-kernel
After LoongArch was converted to use the generic TIF bits in commit
f9629891d407 ("loongarch: Use generic TIF bits"), its TIF_FIXADE flag
takes the same bit with TIF_RESTORE_SIGMASK in thread_info.flags.
Such conflict causes TIF_FIXADE being considered cleared when
TIF_RESTORE_SIGMASK is cleared during deliver of a signal. And since
TIF_FIXADE determines whether unaligned access emulation works for a
task, userspace making use of unaligned access will receive unexpected
SIGBUS (and likely terminate) after receiving its first signal.
This conflict looks like a simple typo, let's just switch to a free bit.
Fixes: f9629891d407 ("loongarch: Use generic TIF bits")
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
Note the problematic commit is contained in next-20250918, but not
master.
arch/loongarch/include/asm/thread_info.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/loongarch/include/asm/thread_info.h b/arch/loongarch/include/asm/thread_info.h
index def7cb14467e..4d7117fcdc78 100644
--- a/arch/loongarch/include/asm/thread_info.h
+++ b/arch/loongarch/include/asm/thread_info.h
@@ -77,7 +77,7 @@ register unsigned long current_stack_pointer __asm__("$sp");
#define TIF_NOHZ 16 /* in adaptive nohz mode */
#define TIF_USEDFPU 17 /* FPU was used by this task this quantum (SMP) */
#define TIF_USEDSIMD 18 /* SIMD has been used this quantum */
-#define TIF_FIXADE 10 /* Fix address errors in software */
+#define TIF_FIXADE 19 /* Fix address errors in software */
#define TIF_LOGADE 20 /* Log address errors to syslog */
#define TIF_32BIT_REGS 21 /* 32-bit general purpose registers */
#define TIF_32BIT_ADDR 22 /* 32-bit address space */
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re:[PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE
2025-09-19 12:58 [PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE Yao Zi
@ 2025-09-19 13:21 ` Wentao Guan
2025-09-20 4:16 ` [PATCH] " Huacai Chen
2025-09-20 8:25 ` [tip: core/core] " tip-bot2 for Yao Zi
2 siblings, 0 replies; 4+ messages in thread
From: Wentao Guan @ 2025-09-19 13:21 UTC (permalink / raw)
To: chenhuacai, WANG Xuerui, Thomas Huth, Yao Zi, tglx, Xi Ruoyao
Cc: loongarch, linux-kernel
Hello,
nice catch:)
Reviewed-by: Wentao Guan <guanwentao@uniontech.com>
BRs
Wentao Guan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE
2025-09-19 12:58 [PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE Yao Zi
2025-09-19 13:21 ` Wentao Guan
@ 2025-09-20 4:16 ` Huacai Chen
2025-09-20 8:25 ` [tip: core/core] " tip-bot2 for Yao Zi
2 siblings, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2025-09-20 4:16 UTC (permalink / raw)
To: Yao Zi
Cc: WANG Xuerui, Thomas Huth, Thomas Gleixner, Xi Ruoyao, loongarch,
linux-kernel
On Fri, Sep 19, 2025 at 8:58 PM Yao Zi <ziyao@disroot.org> wrote:
>
> After LoongArch was converted to use the generic TIF bits in commit
> f9629891d407 ("loongarch: Use generic TIF bits"), its TIF_FIXADE flag
> takes the same bit with TIF_RESTORE_SIGMASK in thread_info.flags.
>
> Such conflict causes TIF_FIXADE being considered cleared when
> TIF_RESTORE_SIGMASK is cleared during deliver of a signal. And since
> TIF_FIXADE determines whether unaligned access emulation works for a
> task, userspace making use of unaligned access will receive unexpected
> SIGBUS (and likely terminate) after receiving its first signal.
>
> This conflict looks like a simple typo, let's just switch to a free bit.
>
> Fixes: f9629891d407 ("loongarch: Use generic TIF bits")
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---
>
> Note the problematic commit is contained in next-20250918, but not
> master.
It will be more beautiful if this patch is squashed to the original one.
Huacai
>
> arch/loongarch/include/asm/thread_info.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/include/asm/thread_info.h b/arch/loongarch/include/asm/thread_info.h
> index def7cb14467e..4d7117fcdc78 100644
> --- a/arch/loongarch/include/asm/thread_info.h
> +++ b/arch/loongarch/include/asm/thread_info.h
> @@ -77,7 +77,7 @@ register unsigned long current_stack_pointer __asm__("$sp");
> #define TIF_NOHZ 16 /* in adaptive nohz mode */
> #define TIF_USEDFPU 17 /* FPU was used by this task this quantum (SMP) */
> #define TIF_USEDSIMD 18 /* SIMD has been used this quantum */
> -#define TIF_FIXADE 10 /* Fix address errors in software */
> +#define TIF_FIXADE 19 /* Fix address errors in software */
> #define TIF_LOGADE 20 /* Log address errors to syslog */
> #define TIF_32BIT_REGS 21 /* 32-bit general purpose registers */
> #define TIF_32BIT_ADDR 22 /* 32-bit address space */
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: core/core] LoongArch: Fix bitflag conflict for TIF_FIXADE
2025-09-19 12:58 [PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE Yao Zi
2025-09-19 13:21 ` Wentao Guan
2025-09-20 4:16 ` [PATCH] " Huacai Chen
@ 2025-09-20 8:25 ` tip-bot2 for Yao Zi
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Yao Zi @ 2025-09-20 8:25 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Yao Zi, Thomas Gleixner, Wentao Guan, x86, linux-kernel
The following commit has been merged into the core/core branch of tip:
Commit-ID: 3ec09344b01a15901ba824e877a0562ed8103e27
Gitweb: https://git.kernel.org/tip/3ec09344b01a15901ba824e877a0562ed8103e27
Author: Yao Zi <ziyao@disroot.org>
AuthorDate: Fri, 19 Sep 2025 12:58:29
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 20 Sep 2025 09:55:56 +02:00
LoongArch: Fix bitflag conflict for TIF_FIXADE
After LoongArch was converted to use the generic TIF bits in commit
f9629891d407 ("loongarch: Use generic TIF bits"), its TIF_FIXADE flag
takes the same bit with TIF_RESTORE_SIGMASK in thread_info.flags.
Such conflict causes TIF_FIXADE being considered cleared when
TIF_RESTORE_SIGMASK is cleared during deliver of a signal. And since
TIF_FIXADE determines whether unaligned access emulation works for a
task, userspace making use of unaligned access will receive unexpected
SIGBUS (and likely terminate) after receiving its first signal.
This conflict looks like a simple typo, switch it to the free bit 19.
Fixes: f9629891d407 ("loongarch: Use generic TIF bits")
Signed-off-by: Yao Zi <ziyao@disroot.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Wentao Guan <guanwentao@uniontech.com>
---
arch/loongarch/include/asm/thread_info.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/loongarch/include/asm/thread_info.h b/arch/loongarch/include/asm/thread_info.h
index def7cb1..4d7117f 100644
--- a/arch/loongarch/include/asm/thread_info.h
+++ b/arch/loongarch/include/asm/thread_info.h
@@ -77,7 +77,7 @@ register unsigned long current_stack_pointer __asm__("$sp");
#define TIF_NOHZ 16 /* in adaptive nohz mode */
#define TIF_USEDFPU 17 /* FPU was used by this task this quantum (SMP) */
#define TIF_USEDSIMD 18 /* SIMD has been used this quantum */
-#define TIF_FIXADE 10 /* Fix address errors in software */
+#define TIF_FIXADE 19 /* Fix address errors in software */
#define TIF_LOGADE 20 /* Log address errors to syslog */
#define TIF_32BIT_REGS 21 /* 32-bit general purpose registers */
#define TIF_32BIT_ADDR 22 /* 32-bit address space */
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-20 8:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 12:58 [PATCH] LoongArch: Fix bitflag conflict for TIF_FIXADE Yao Zi
2025-09-19 13:21 ` Wentao Guan
2025-09-20 4:16 ` [PATCH] " Huacai Chen
2025-09-20 8:25 ` [tip: core/core] " tip-bot2 for Yao Zi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.