|
Message-Id: <1515636190-24061-34-git-send-email-keescook@chromium.org> Date: Wed, 10 Jan 2018 18:03:05 -0800 From: Kees Cook <keescook@...omium.org> To: linux-kernel@...r.kernel.org Cc: Kees Cook <keescook@...omium.org>, Catalin Marinas <catalin.marinas@....com>, Will Deacon <will.deacon@....com>, Christian Borntraeger <borntraeger@...ibm.com>, Ingo Molnar <mingo@...nel.org>, James Morse <james.morse@....com>, "Peter Zijlstra (Intel)" <peterz@...radead.org>, Dave Martin <Dave.Martin@....com>, zijun_hu <zijun_hu@....com>, linux-arm-kernel@...ts.infradead.org, Linus Torvalds <torvalds@...ux-foundation.org>, David Windsor <dave@...lcore.net>, Alexander Viro <viro@...iv.linux.org.uk>, Andrew Morton <akpm@...ux-foundation.org>, Andy Lutomirski <luto@...nel.org>, Christoph Hellwig <hch@...radead.org>, Christoph Lameter <cl@...ux.com>, "David S. Miller" <davem@...emloft.net>, Laura Abbott <labbott@...hat.com>, Mark Rutland <mark.rutland@....com>, "Martin K. Petersen" <martin.petersen@...cle.com>, Paolo Bonzini <pbonzini@...hat.com>, Christoffer Dall <christoffer.dall@...aro.org>, Dave Kleikamp <dave.kleikamp@...cle.com>, Jan Kara <jack@...e.cz>, Luis de Bethencourt <luisbg@...nel.org>, Marc Zyngier <marc.zyngier@....com>, Rik van Riel <riel@...hat.com>, Matthew Garrett <mjg59@...gle.com>, linux-fsdevel@...r.kernel.org, linux-arch@...r.kernel.org, netdev@...r.kernel.org, linux-mm@...ck.org, kernel-hardening@...ts.openwall.com Subject: [PATCH 33/38] arm64: Implement thread_struct whitelist for hardened usercopy This whitelists the FPU register state portion of the thread_struct for copying to userspace, instead of the default entire structure. Cc: Catalin Marinas <catalin.marinas@....com> Cc: Will Deacon <will.deacon@....com> Cc: Christian Borntraeger <borntraeger@...ibm.com> Cc: Ingo Molnar <mingo@...nel.org> Cc: James Morse <james.morse@....com> Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org> Cc: Dave Martin <Dave.Martin@....com> Cc: zijun_hu <zijun_hu@....com> Cc: linux-arm-kernel@...ts.infradead.org Signed-off-by: Kees Cook <keescook@...omium.org> --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/processor.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a93339f5178f..c84477e6a884 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -90,6 +90,7 @@ config ARM64 select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT select HAVE_ARCH_SECCOMP_FILTER + select HAVE_ARCH_THREAD_STRUCT_WHITELIST select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_ARCH_VMAP_STACK diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 023cacb946c3..e58a5864ec89 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -113,6 +113,14 @@ struct thread_struct { struct debug_info debug; /* debugging */ }; +/* Whitelist the fpsimd_state for copying to userspace. */ +static inline void arch_thread_struct_whitelist(unsigned long *offset, + unsigned long *size) +{ + *offset = offsetof(struct thread_struct, fpsimd_state); + *size = sizeof(struct fpsimd_state); +} + #ifdef CONFIG_COMPAT #define task_user_tls(t) \ ({ \ -- 2.7.4
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.