From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFC0EC54FC9 for ; Tue, 21 Apr 2020 07:02:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A395C206F4 for ; Tue, 21 Apr 2020 07:02:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IQK60By5"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="GBUY2Mu1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A395C206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kUFxjak/zJFl6yW6pZZ5E0rtIOhv5HbFyBmUKBTKZto=; b=IQK60By5EHrmO4 jLxaW9lBdRTwZA1LzjH5Q1vbvzI2k/xmQFKGufMgEekhOWS3MHKAc6M0a8JIzo8qdRNKdxYJ+LqXJ PkL0BO18pj1U+a0jTXpBQ6BUg8lAIpKbrBVoK7gaHiAcYTb/yd28k58UK+Vdu6yiMMkvfsrcUehWK 0D481Y0QHnBUaIo0M9kkoIv0SWCKLBdyJVKC9lp9b41AmZyxH9CSmy2nl+wVa2b980+bT3+wRicts wXCdnIwX6O+G3b4PtQESnDrjZyHvvPWEL8vgowD3qN1WyfGCuicwovt3/Qv7g5qZAk/745HiTmPbQ RctCWT9IsQojzdXGZlcQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQmvA-00059L-HW; Tue, 21 Apr 2020 07:02:16 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQmv7-000573-CP for linux-arm-kernel@lists.infradead.org; Tue, 21 Apr 2020 07:02:14 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2DC8206A5; Tue, 21 Apr 2020 07:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587452532; bh=Z+fmf3MZTanUK1eDlZtoFdJGrDCVH0CGd4BwENIe5E0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GBUY2Mu1pH5QqANYe1GJjosD6c/oF6gvLuIOBkUU4xMMIBCPQc8eHirwbD/lIN+fo pUy9A2APpR3RQVTYdoe85rp+Z4PEu0b/7iqs2G14lfRh1kJ+t8bXU8/q58TDECxLfu Zii20HSrpehI+Mop+ZzV1HtSTFSAZqshN53NFF/4= Date: Tue, 21 Apr 2020 08:02:06 +0100 From: Will Deacon To: Kees Cook Subject: Re: [PATCH v2 5/5] arm64: entry: Enable random_kstack_offset support Message-ID: <20200421070206.GB14448@willie-the-truck> References: <20200324203231.64324-1-keescook@chromium.org> <20200324203231.64324-6-keescook@chromium.org> <20200420205458.GC29998@willie-the-truck> <202004201529.BB787BB@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202004201529.BB787BB@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_000213_453283_63936602 X-CRM114-Status: GOOD ( 17.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Jann Horn , Ard Biesheuvel , Peter Zijlstra , Catalin Marinas , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , linux-arm-kernel@lists.infradead.org, Andy Lutomirski , kernel-hardening@lists.openwall.com, "Perla, Enrico" , Thomas Gleixner , Elena Reshetova Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 20, 2020 at 03:34:57PM -0700, Kees Cook wrote: > On Mon, Apr 20, 2020 at 09:54:58PM +0100, Will Deacon wrote: > > On Tue, Mar 24, 2020 at 01:32:31PM -0700, Kees Cook wrote: > > > + /* > > > + * Since the compiler chooses a 4 bit alignment for the stack, > > > + * let's save one additional bit (9 total), which gets us up > > > + * near 5 bits of entropy. > > > + */ > > > + choose_random_kstack_offset(get_random_int() & 0x1FF); > > > > Hmm, this comment doesn't make any sense to me. I mean, I get that 0x1ff > > is 9 bits, and that is 4+5 but so what? > > Er, well, yes. I guess I was just trying to explain why there were 9 > bits saved here and to document what I was seeing the compiler actually > doing with the values. (And it serves as a comparison to the x86 comment > which is explaining similar calculations in the face of x86_64 vs ia32.) > > Would something like this be better? > > /* > * Since the compiler uses 4 bit alignment for the stack (1 more than > * x86_64), let's try to match the 5ish-bit entropy seen in x86_64, > * instead of having needlessly lower entropy. As a result, keep the > * low 9 bits. > */ Yes, thank you! I was missing the comparison to x86_64 and so the one "additional" bit didn't make sense to me. With the new comment: Acked-by: Will Deacon I'm assuming you're merging this via some other tree, but let me know if you need anything else from me. Cheers, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel