From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752362AbdF3AFA (ORCPT ); Thu, 29 Jun 2017 20:05:00 -0400 Received: from mail-io0-f169.google.com ([209.85.223.169]:34816 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751755AbdF3AE6 (ORCPT ); Thu, 29 Jun 2017 20:04:58 -0400 MIME-Version: 1.0 In-Reply-To: References: <1495829844-69341-1-git-send-email-keescook@chromium.org> <1495829844-69341-5-git-send-email-keescook@chromium.org> From: Kees Cook Date: Thu, 29 Jun 2017 17:04:46 -0700 X-Google-Sender-Auth: Mbdw1Ucj8j-mJfbncjMansa0f0w Message-ID: Subject: Re: [PATCH v2 04/20] gcc-plugins: Add the randstruct plugin To: Arnd Bergmann Cc: Kernel Hardening , Laura Abbott , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 29, 2017 at 3:53 PM, Kees Cook wrote: > I see a few possible solutions: Or this ugly hack: diff --git a/include/linux/sched.h b/include/linux/sched.h index e2ad3531e7fe..5d131f9f1dac 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -749,6 +749,19 @@ struct task_struct { /* Namespaces: */ struct nsproxy *nsproxy; +#ifdef CONFIG_ARM + /* + * Since task_struct is gigantic, some asmoffset locations + * (e.g. TSK_STACK_CANARY) for a randomized field may exceed + * an architecture's instruction immediate values. As a + * work-around to avoid changing the performance characteristics + * of the assembly, split the randomization into two groups, + * keeping the "early" fields within range of the immediates. + */ + randomized_struct_fields_end + randomized_struct_fields_start +#endif + /* Signal handlers: */ struct signal_struct *signal; struct sighand_struct *sighand; I suspect updating the ARM assembly (CONFIG-conditionally) to accept >4095 offsets is probably the best solution. -Kees -- Kees Cook Pixel Security