From patchwork Fri Jun 30 00:04:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9818153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1B23E602B1 for ; Fri, 30 Jun 2017 00:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 133552846F for ; Fri, 30 Jun 2017 00:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0443A2855E; Fri, 30 Jun 2017 00:05:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 1A55A2846F for ; Fri, 30 Jun 2017 00:05:01 +0000 (UTC) Received: (qmail 5197 invoked by uid 550); 30 Jun 2017 00:04:59 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 5174 invoked from network); 30 Jun 2017 00:04:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=TKVuEtPudupZEph8lUyZOLuWHF3URxrRszkFGL8qeN4=; b=e7yqldASaiVwIsgIGILaK69rCsUHl8clYJXaDUVDDlB2asnL4LTo0rzJ34U+DRP9OG opvTu5XBZf+9eDuwzbROIsjiIFVE361go+bb22tG70KYD4sdSDh8A7WVo8NgoMkmbs+h eBUdrv3rKvnNFzONicTC5xbVWn7bVwngX3VGt8N8DNG16h3dmJ1GNkOdLQSNj9DqKHDq 50Rxeh0DP4GISek7j1UOXr0od5SL2W+tik7MRfQxIoLzpkA6aENEM0ADPZomvDakB1z3 ftS5Mx6LLtshV9eatTq20GZijuDXm/cH8A6n1uMyGj0mJpkfLR5O6m8PchHNmRHk2gBy HrFg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=TKVuEtPudupZEph8lUyZOLuWHF3URxrRszkFGL8qeN4=; b=HNsIsvFVIzDpsxbMMjsetzALS2BxKzTpHrl4Fs78MnU6zwYQPlhnDXv/ePkEKbUBfq BH6X2aY+m79g0erIxCVBAJFjFmF/r+hoqcg4Z/f5GKb2F7/vOJQjzTKBl1jVszlJ0t8V LnE06wVEjk0LRJGhFjH7LOGePdgPJDZagGW4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=TKVuEtPudupZEph8lUyZOLuWHF3URxrRszkFGL8qeN4=; b=KqtrIrL6tCWzovjE1gD68owIZhjXjpATCBojoy46yZCIKG29hjUfkpbxH/plHFSVTe 2CMwWlfmODMdcBKc2PasPp0JJ9FN7rK1Sw281PpqC4F0gtmRawLyZlRqYJ8PdJIBmozg pRVQGaqx77BzGvEGppc40KiUgBbYQLx6y+gCJN/yAgs69bEWZtJ+7UrYo2r87m648s5K 1xk2BfV2FUG9qd49qZ2FJfB5KGEvzcGN6xrxoukk9N86LGXsI6Y78HWhfOscaXspr1xN ktnZEW6F3Cxc607XA7feCXxWqEJhDOrMDJjygknmMkrFjHEfcA4L6p/KjigR9ANf6R9p dNLw== X-Gm-Message-State: AKS2vOyvKBlX8eRmZZTL01uPEuUfIJ0mi+QlV+Jxsj7UiMKpc4TS4EIl EXv5atNUe1ZsgjU2X9WymsDNtTmvZkuIQPfDHQ== X-Received: by 10.107.178.13 with SMTP id b13mr21902965iof.148.1498781087050; Thu, 29 Jun 2017 17:04:47 -0700 (PDT) MIME-Version: 1.0 Sender: keescook@google.com 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: To: Arnd Bergmann Cc: Kernel Hardening , Laura Abbott , "the arch/x86 maintainers" , Linux Kernel Mailing List Subject: [kernel-hardening] Re: [PATCH v2 04/20] gcc-plugins: Add the randstruct plugin X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jun 29, 2017 at 3:53 PM, Kees Cook wrote: > I see a few possible solutions: Or this ugly hack: I suspect updating the ARM assembly (CONFIG-conditionally) to accept >4095 offsets is probably the best solution. -Kees 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;