Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4015360pxb; Mon, 27 Sep 2021 07:39:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbyYoIRRoiAgM5xTHH/40ogto2XzNyZidzuqWmo/f0/VqveNoRrIoJJGyJ0u+dDV0UHLd5 X-Received: by 2002:a65:4209:: with SMTP id c9mr17315pgq.399.1632753578973; Mon, 27 Sep 2021 07:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632753578; cv=none; d=google.com; s=arc-20160816; b=FVbQ7eQvrNIJ5RFSuxsihmO8UcNn/sOggQV6O3oXbd6MMDIMfxBvWG44Y4zy2V+neO Eh7QgHaTxeZ7f6IubHRrCoGVo1NWVmi+grJECUR0iL9dVnREiYxX/WTzb+RQQmNxWp8b EC9nYPYYnxObxqiM83UFGW4Cp0EfJ8z2E89XwoeO2EfogcCqZ1TfX5S+MAMIOKoayvVg 3kfJ9GAFBoJ742s6QM8ZomVRv9Ttz13vVyo+KMohS2KLa524qUYWq2zUZiPj5v9n+4zZ ZrAQHV/mu6i8lqkTrpQ8qHxExwkAs0nLoWw286xlAPOH3GTj5jSujgIoxgPK4aREwF6M Wwag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=1WKM4V5FH/wwjaJcnD+Q9YiA3V/JhDP/t5TXk37kY0A=; b=ficKMO2YJw5jRfD+5d6eKiNyCXHOASj3AwZDrHX4hj5ZFLsEFLTTLd/8KwoxRTLm0y i5OhBdj+YbLZ0xDtbSLsAuQsb4OPlXEuus6KaJ5cZgj3LfxehszTJSz6tBVkFSxEwE24 zCGdckCyZisieB2kWG6ATooukifsm2Lt+BnTLDPq0iB/SRz2iX/19hEmSA1SvLXH2LDY uFFQAJtWf8c8TSSmRw35ex8xWc3ydHTnibWT1ZTTlcS7KlaI8UGvg5a0EpxSV6Fommr0 ZIeVcGUFbBF7osSq+WAXbXZXXluaZJtK/XUnE5/AFbZJTYaX1t97VyX+7/QKdGN2d8Rf XDWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si5018047pln.47.2021.09.27.07.39.25; Mon, 27 Sep 2021 07:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234858AbhI0OkR (ORCPT + 99 others); Mon, 27 Sep 2021 10:40:17 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:51265 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234706AbhI0OkR (ORCPT ); Mon, 27 Sep 2021 10:40:17 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=laijs@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0UpqZ8xo_1632753514; Received: from C02XQCBJJG5H.local(mailfrom:laijs@linux.alibaba.com fp:SMTPD_---0UpqZ8xo_1632753514) by smtp.aliyun-inc.com(127.0.0.1); Mon, 27 Sep 2021 22:38:35 +0800 Subject: Re: [PATCH V2 02/41] x86/traps: Remove stack-protector from traps.c To: Borislav Petkov Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Joerg Roedel , Javier Martinez Canillas , Daniel Bristot de Oliveira , Brijesh Singh , Andy Shevchenko , Arvind Sankar , Juergen Gross , Chester Lin References: <20210926150838.197719-1-jiangshanlai@gmail.com> <20210926150838.197719-3-jiangshanlai@gmail.com> From: Lai Jiangshan Message-ID: Date: Mon, 27 Sep 2021 22:38:34 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/27 19:01, Borislav Petkov wrote: > On Mon, Sep 27, 2021 at 06:49:16PM +0800, Lai Jiangshan wrote: >> Using only "-fno-stack-protector" is enough to disable stack protector with >> my .config, I'm not so sure about other configuration. > > What does the gcc manpage say about it? > In gcc's code, all the -f[no-]stack-protector* argument overwrites the same flag_stack_protect variable, so the last one takes effect. > fstack-protector > Common Var(flag_stack_protect, 1) Init(-1) Optimization > Use propolice as a stack protection method. > > fstack-protector-all > Common RejectNegative Var(flag_stack_protect, 2) Init(-1) Optimization > Use a stack protection method for every function. > > fstack-protector-strong > Common RejectNegative Var(flag_stack_protect, 3) Init(-1) Optimization > Use a smart stack protection method for certain functions. > > fstack-protector-explicit > Common RejectNegative Var(flag_stack_protect, 4) Optimization > Use stack protection method only for functions with the stack_protect attribute. In linux kernel's scripts/Makefile.lib, CFLAGS_traps.o is the last flags for gcc invocation, so only "CFLAGS_traps.o += -fno-stack-protector" must be enough. > _c_flags = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \ > $(filter-out $(ccflags-remove-y), \ > $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ccflags-y)) \ > $(CFLAGS_$(target-stem).o))