Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1524018pxb; Tue, 26 Oct 2021 10:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4niGsrzyB1xMUwSrqTIanPIetN3uEPSNV4rD+mmsntItaHZ+6W7WuzTP0qCFumyI/ga01 X-Received: by 2002:a17:90a:1101:: with SMTP id d1mr30500pja.205.1635269594566; Tue, 26 Oct 2021 10:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635269594; cv=none; d=google.com; s=arc-20160816; b=oQqjpaX9chRKzjMHCMpFHBFqkYMYa0YRWb6AXYQ1mdNaeJ4SiB4ZU2rTslimhFcgv9 7Rel9HMl3cu336VEIyvNXR6m+/L2Kp97f7EdDcyxF9n43U0lwWZa1QNeGaJ2ouE/i7aU DDMlFgquP1K8aPyxMrSPgG4cU0noq4j79tE7MF2TAdzibm3hedWZePN0Ttu4yKyVAZwG 77ETXPwXqMg84pwsKfNp/ulyaduzXgwwlw12spW5vM64wgUQCY01A8r4ruKKKU81V7Lb BjjBKFH29qYQ1Ru6fLgKusDCvzwZUZLBcr4VjxiDMymYFUDV3q6T0EjkE1hgP1yy3KLM I8SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r0qjm7jPQqP31FdhJus4GoBFS4vikb3c2lNdWiLTWxY=; b=psKfZmRcabL6xw1JQsv9R0/pNUBn4XlRB8FUa0jaF3ycFPETQHcf267td7k+fFe1O1 4IK//FEZRPdM5QAbgjmnFieIVbtGi65vqNZ4paJUHo4jLnELolQaivbdGyA2rqS3vAwn dzpYnEczXlTbl96C+CWAiQBgZQhRlUwGmhic/q1N3IX/sj1jJC6cqoyQzakUFmOtb6/2 pE1HWor6slGFCI5ZeWJD24mlDe5n+Vt73QMgXSTz5YuHqE5RtdbnAd/ZXcjqGfpm72eW cytGX7I/Vqw6LUzLv2zh08ZRJVRSuDZJbPTxcAL20RhgOxWLK4DvYGLk9Tjz4X95XJZ1 SRPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ggfwe06p; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si1436430pjo.62.2021.10.26.10.32.57; Tue, 26 Oct 2021 10:33:14 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ggfwe06p; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235276AbhJZOQ7 (ORCPT + 99 others); Tue, 26 Oct 2021 10:16:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236459AbhJZOQ6 (ORCPT ); Tue, 26 Oct 2021 10:16:58 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD805C061745 for ; Tue, 26 Oct 2021 07:14:34 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id c4so6530564plg.13 for ; Tue, 26 Oct 2021 07:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r0qjm7jPQqP31FdhJus4GoBFS4vikb3c2lNdWiLTWxY=; b=Ggfwe06peSYkfJCJpCFzEdWKERSBo4c/NHpwOXSee18xCOqBThGZijEH68PmGREHXs fmoCL3OC8ROxFZrolaGBpmTBqhxCxtYs8SKcI2TMnQgHxs8YOY8+LcYnVBsMf7LoPbAM Tqsdg2Uf726MPGtLOlNi7jJXG/Gc59HlS3awTJKVgMJ01guO9mcYjUoO4aLA1RTAF9cF Hdy+g/HwYRqOxJvi4Ga3wqI/2dHlZp1SZYyTXvMd2Gw4cfo8cX5tN9aFVm9sKGuscCuQ 3X31PVcx663BhFQWtoDg1I/+WBNFmvSkpQHPrzCuhsGD0XV3hRfqT22cN7Q4pXrNVkyF 3ceg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r0qjm7jPQqP31FdhJus4GoBFS4vikb3c2lNdWiLTWxY=; b=CY5WpIocN3iGw4U8B3WEtOqOrh+JXM6RAO6Y6GBGopNtaIl5sdErenJ2c+i6UBq71V Za8qwf1LPe8esrZgs2Wqh+IMNSUvndYXDouO09dpYsUCy9QHd+q2hpDULDlyiwKIJqeV mwh9VnEnPr0LBMoecvl6JhKGwujKVS+xm32yvaoHeew4Inz11nFpVxpIn9iaEOel3qf1 7xO3zuzWRvxKycGyd7gpUiHxmbxFYv8pCz1S2XZr7cu+1suwu+6l9+q08nR/u9Kx8jxI PgZ+jOwUPbC27kekB95pOXl6qbBtfgfm+sluEV9NAUWGaNOdi90bJQ27LVwpx+bw+NGE L4Vw== X-Gm-Message-State: AOAM531TqJyr/+GXe9tsW+z7ZDmQAyXRH7ousVMgjnAweREHleh1BkQg 6/naVUhRY2BfOCuOl8lZ0Z3FZmuzSE4= X-Received: by 2002:a17:90a:f990:: with SMTP id cq16mr381028pjb.196.1635257673951; Tue, 26 Oct 2021 07:14:33 -0700 (PDT) Received: from localhost ([47.251.3.230]) by smtp.gmail.com with ESMTPSA id 141sm8353033pge.23.2021.10.26.07.14.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Oct 2021 07:14:32 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Lai Jiangshan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Javier Martinez Canillas , Daniel Bristot de Oliveira , Brijesh Singh , Andy Shevchenko , Tom Lendacky , Juergen Gross , Chester Lin Subject: [PATCH V4 03/50] x86/traps: Remove stack-protector from traps.c Date: Tue, 26 Oct 2021 22:13:33 +0800 Message-Id: <20211026141420.17138-4-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211026141420.17138-1-jiangshanlai@gmail.com> References: <20211026141420.17138-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan When stack-protector is enabled, the compiler adds some instrument code at the beginning and the end of some functions. Many functions in traps.c are non-instrumentable. Moreover, stack-protector code in the beginning of the affected function accesses the canary that might be watched by hardware breakpoints which also violate the non-instrumentable nature of some functions and might cause infinite recursive #DB because the canary is accessed before resetting the dr7. So it is better to remove stack-protector from traps.c. It is also prepared for later patches that move some entry code into traps.c, some of which can NOT use percpu register until gsbase is properly switched. And stack-protector depends on the percpu register to work. Signed-off-by: Lai Jiangshan --- arch/x86/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 2ff3e600f426..8ac45801ba8b 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -50,6 +50,7 @@ KCOV_INSTRUMENT := n CFLAGS_head$(BITS).o += -fno-stack-protector CFLAGS_cc_platform.o += -fno-stack-protector +CFLAGS_traps.o += -fno-stack-protector CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace -- 2.19.1.6.gb485710b