Re: [PATCH 1/5] x86: change THREAD_INFO definition to not depend on KERNEL_STACK_OFFSET

From: Borislav Petkov
Date: Fri Mar 20 2015 - 06:31:49 EST

On Thu, Mar 19, 2015 at 06:17:45PM +0100, Denys Vlasenko wrote:
> This changes THREAD_INFO definition and all its callsites
> so that they do not count stack position from
> (top of stack - KERNEL_STACK_OFFSET), but from top of stack.
> Semi-mysterious expressions THREAD_INFO(%rsp,RIP) - "why RIP??"
> are now replaced by more logical THREAD_INFO(%rsp,SIZEOF_PTREGS) -
> "calculate thread_info's address using information that
> rsp is SIZEOF_PTREGS bytes below top of stack".
> While at it, replace "(off)-THREAD_SIZE(reg)" with equivalent
> "((off)-THREAD_SIZE)(reg)". The form without parentheses
> falsely looks like we invoke THREAD_SIZE() macro.
> Improve comment atop THREAD_INFO macro definition.
> This patch does not change generated code (verified by objdump).
> Signed-off-by: Denys Vlasenko <dvlasenk@xxxxxxxxxx>
> CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> CC: Steven Rostedt <rostedt@xxxxxxxxxxx>
> CC: Ingo Molnar <mingo@xxxxxxxxxx>
> CC: Borislav Petkov <bp@xxxxxxxxx>
> CC: "H. Peter Anvin" <hpa@xxxxxxxxx>
> CC: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
> CC: Oleg Nesterov <oleg@xxxxxxxxxx>
> CC: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> CC: Alexei Starovoitov <ast@xxxxxxxxxxxx>
> CC: Will Drewry <wad@xxxxxxxxxxxx>
> CC: Kees Cook <keescook@xxxxxxxxxxxx>
> CC: x86@xxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx

Acked-by: Borislav Petkov <bp@xxxxxxx>


ECO tip #101: Trim your mails when you reply.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at