Received: by 10.213.65.68 with SMTP id h4csp692740imn; Wed, 28 Mar 2018 11:01:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+CgGwoay5pCvpT447po0BY+ZIuTHa2XqNFlmakYVwZu920OboBBRxnzS38Qe1mfsiXb8Gk X-Received: by 2002:a17:902:6984:: with SMTP id l4-v6mr4927593plk.61.1522260092921; Wed, 28 Mar 2018 11:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522260092; cv=none; d=google.com; s=arc-20160816; b=ACb5sy9REFfQwmM38tMKB6g3Lpud8xJyXZV3PvB1RcH3DdHHW1MViRLnwbtqquSnA+ KOPn05IoZOeoQ3BCz6+5/dWH6OAIjfuutFltfCVA+/sDHGfPTNNYv+1cD9qRsk1Y6uO1 yOzlWXuQWCnOLmS8rv7Rk7+Xf7Xv5zQtCHsWpXRi6s6ta2fr3zQYnzX9WHUdSLzZ2AoH /PPNHMPWbq+v7RzBQu9/2N+OcllhNGwfQlfpSvJs0NVYu75ZDT6uUUaRhbMa3o4QorY8 IDEigfNv5xXiXQd3HzImyP6YInx/V9NVl3qh7+xroZQwZiFWNV43EiKmlGozPjP24we9 k7Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=5Oh3Z7iHzr51EAoDaxsyP9vUBjsotWSrP5ZZP7247dQ=; b=MMl931AleriZK+yAlfz+ynScZinMZNizxjaCSRY5XzU5sbeHrSVwK+nHOO/fHOSgvQ /Ex4oYuId1PWd8NG4WJHkArpykzLny5az8pbl7DNOM7lhaN6/sMReQ7rj0ssnW9xSJAg 7XoRyqHUR16UaqPXlpb+lqGtFJRQY8ZEkPXSg5wmn2ju9KHnEs5ftY1CxCoIxuWtrjEb xhJsrt51i/5U8d6Ujgc9eu0x41lNzzpuPYV2oJ9TMtJ2jQ5J/6tXZ4b2SjpRJddXK6wU sVIrq+zXHcv4oLsOY6XX8Mc9eYF5JKVzjMJkCPDXefYYaye0tOTCWCJSXwAz4JLW7qGw 3TQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24-v6si3862712plo.273.2018.03.28.11.01.11; Wed, 28 Mar 2018 11:01:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753352AbeC1SAD (ORCPT + 99 others); Wed, 28 Mar 2018 14:00:03 -0400 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:33490 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbeC1SAB (ORCPT ); Wed, 28 Mar 2018 14:00:01 -0400 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1f1FMW-00051r-00; Wed, 28 Mar 2018 17:59:52 +0000 Date: Wed, 28 Mar 2018 13:59:52 -0400 From: Rich Felker To: Huacai Chen Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ralf Baechle , James Hogan , linux-mips@linux-mips.org, Russell King , linux-arm-kernel@lists.infradead.org, Yoshinori Sato , linux-sh@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH V4 Resend] ZBOOT: fix stack protector in compressed boot phase Message-ID: <20180328175952.GO1436@brightrain.aerifal.cx> References: <1522226933-29317-1-git-send-email-chenhc@lemote.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522226933-29317-1-git-send-email-chenhc@lemote.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 28, 2018 at 04:48:53PM +0800, Huacai Chen wrote: > Call __stack_chk_guard_setup() in decompress_kernel() is too late that > stack checking always fails for decompress_kernel() itself. So remove > __stack_chk_guard_setup() and initialize __stack_chk_guard before we > call decompress_kernel(). > > Original code comes from ARM but also used for MIPS and SH, so fix them > together. If without this fix, compressed booting of these archs will > fail because stack checking is enabled by default (>=4.16). > > V1 -> V2: Fix build on ARM. > V2 -> V3: Fix build on SuperH. > V3 -> V4: Initialize __stack_chk_guard in C code as a constant. > > Cc: stable@vger.kernel.org > Signed-off-by: Huacai Chen > --- > arch/arm/boot/compressed/misc.c | 9 +-------- > arch/mips/boot/compressed/decompress.c | 9 +-------- > arch/sh/boot/compressed/misc.c | 9 +-------- > 3 files changed, 3 insertions(+), 24 deletions(-) > > [...] > > diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c > index 627ce8e..c15cac9 100644 > --- a/arch/sh/boot/compressed/misc.c > +++ b/arch/sh/boot/compressed/misc.c > @@ -104,12 +104,7 @@ static void error(char *x) > while(1); /* Halt */ > } > > -unsigned long __stack_chk_guard; > - > -void __stack_chk_guard_setup(void) > -{ > - __stack_chk_guard = 0x000a0dff; > -} > +const unsigned long __stack_chk_guard = 0x000a0dff; > > void __stack_chk_fail(void) > { > @@ -130,8 +125,6 @@ void decompress_kernel(void) > { > unsigned long output_addr; > > - __stack_chk_guard_setup(); > - > #ifdef CONFIG_SUPERH64 > output_addr = (CONFIG_MEMORY_START + 0x2000); > #else > -- > 2.7.0 LGTM. Acked-by: Rich Felker Rich