public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thread_info: use unsigned long for flags
@ 2016-09-23 17:24 Mark Rutland
  2016-09-23 18:08 ` Andy Lutomirski
  2016-09-24 16:28 ` [tip:x86/asm] thread_info: Use " tip-bot for Mark Rutland
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Rutland @ 2016-09-23 17:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Rutland, Andrew Morton, Andy Lutomirski, Kees Cook

The generic THREAD_INFO_IN_TASK definition of thread_info::flags is a
u32, matching x86 prior to the introduction of THREAD_INFO_IN_TASK.

However, common helpers like test_ti_thread_flag() implicitly assume
that thread_info::flags has at least the size and alignment of unsigned
long, and relying on padding and alignment provided by other elements of
task_struct is somewhat fragile. Additionally, some architectures use
more that 32 bits for thread_info::flags, and others may need to in
future.

With THREAD_INFO_IN_TASK, task struct follows thread_info with a long
field, and thus we no longer save any space as we did back in commit
affa219b60a11b32 ("x86: change thread_info's flag field back to 32
bits").

Given all this, it makes more sense for the generic thread_info::flags
to be an unsigned long. Make it so.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org
---
 include/linux/thread_info.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

As discussed in the arm64 RFC.

Andy, I'm assuming that as with affa219b60a11b32 no x86 assembly fixups are
required. An x86_64 defconfig built fine for me.

I've based this on your x86/vmap_stack branch. I'm not sure what the plan is
for merging that. If I should be using a different branch to base the arm64
work atop of, please let me know!

Thanks,
Mark.

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index f3837c7..a2c2f88 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -13,7 +13,7 @@
 
 #ifdef CONFIG_THREAD_INFO_IN_TASK
 struct thread_info {
-	u32			flags;		/* low level flags */
+	unsigned long		flags;		/* low level flags */
 };
 
 #define INIT_THREAD_INFO(tsk)			\
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-24 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-23 17:24 [PATCH] thread_info: use unsigned long for flags Mark Rutland
2016-09-23 18:08 ` Andy Lutomirski
2016-09-23 23:48   ` Mark Rutland
2016-09-24 16:28 ` [tip:x86/asm] thread_info: Use " tip-bot for Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox