Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758387AbcC2XEZ (ORCPT ); Tue, 29 Mar 2016 19:04:25 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:33407 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753295AbcC2XEX (ORCPT ); Tue, 29 Mar 2016 19:04:23 -0400 MIME-Version: 1.0 In-Reply-To: <1459281207-24377-2-git-send-email-sbauer@eng.utah.edu> References: <1459281207-24377-1-git-send-email-sbauer@eng.utah.edu> <1459281207-24377-2-git-send-email-sbauer@eng.utah.edu> Date: Tue, 29 Mar 2016 18:04:22 -0500 X-Google-Sender-Auth: wwKJCbWBniryJIBQMSn4-vZGO5M Message-ID: Subject: Re: [PATCH v4 1/4] SROP Mitigation: Architecture independent code for signal cookies From: Linus Torvalds To: Scott Bauer Cc: Linux Kernel Mailing List , "kernel-hardening@lists.openwall.com" , "the arch/x86 maintainers" , Andi Kleen , Andy Lutomirski , Ingo Molnar , Thomas Gleixner , wmealing@redhat.com, Abhiram Balasubramanian , Scott Bauer Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 795 Lines: 22 On Tue, Mar 29, 2016 at 2:53 PM, Scott Bauer wrote: > @@ -1231,6 +1232,8 @@ void setup_new_exec(struct linux_binprm * bprm) > /* This is the point of no return */ > current->sas_ss_sp = current->sas_ss_size = 0; > > + get_random_bytes(¤t->sig_cookie, sizeof(current->sig_cookie)); > + This should probably just be current->sig_cookie = get_random_long(); instead. That will use hardware random numbers if available, and be *much* faster. I realize that some people don't like the hardware random number generators because they don't trust them, but quite frankly, for something like this it's fine. If the attacker is in collusion with the hardware manufacturer, you have way bigger problems than a SROP attack. Linus