Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3713142pxb; Wed, 13 Oct 2021 11:20:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw98PyzrtrXG02ab/C4FQ54j2f184orlnqDHvribJZIeOzwA3hZLrbraSuVDdvuDG8pBLiz X-Received: by 2002:a17:906:fca5:: with SMTP id qw5mr872323ejb.315.1634149251776; Wed, 13 Oct 2021 11:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634149251; cv=none; d=google.com; s=arc-20160816; b=pEhHJ7Dxopq5UUu7IgMUBSoDKtDbo0TASXFLZTEgsLBZ3HV67RNDvjLN2RuouwbX48 Jy5bGZANIVHBvVhUqF0PHPUnxjwKf5kzi8/sTE0L4LtiXR3iq13C/1MJJCZqu1z+xBvh ecQN5alzVzBg9LX3FerJMZpYV47sZS9+f2vl5Xz8epfyx6yIU5g0wAeoOvLJ69d0q4T9 qIUp9AWYvw7D7XWbdIs11tjwUNxXyDQvLOzI2/5qE2paSjMY6SwwYhDb2i4nZH4i7gnr vrtxdBZPr253LMASjajRA+jEB/lsYQt4wF9KvmTly9D9XHy/yrsKajQb4bIxJCMhXdCh P2xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=NLRoIZHIP07xVaQxZ/Th6ra9+3RRZlDKsNZoVY8HRkw=; b=TmzhI1oRaxNMMNIeDl0n70PSkvecJP/cE6FkVnDvZ+LSOq09T1x9i+vBLnLevR+A2H aLOSeRfMb4KNretcBfILiaJdGEJCqdKVwBeC5qMYAlOr2/NBOStumhmsUbMd6mWxgOOf IdDzUYOUZZW9O+K8ADh+OTD/EaHExi7q5vWFaFduZmrr0jl/C6+dKtUiUNcDMQwqMFEx BblQ8/vkF1JntrBoYxiC74A3YBAalq2j21uVnf/h1S2i2cnA2wNtkLop4GKDp6kZgb5e uD2Fxl9aPBuYhFzmvA77bn+ctAlCnMT01aEHcGx4QZIYYz8KVcaUDJJXxG31zP9k0y3d YPMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=sQ9nG9JW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si264417edi.542.2021.10.13.11.20.28; Wed, 13 Oct 2021 11:20:51 -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=@google.com header.s=20210112 header.b=sQ9nG9JW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238665AbhJMSTz (ORCPT + 99 others); Wed, 13 Oct 2021 14:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238761AbhJMSTg (ORCPT ); Wed, 13 Oct 2021 14:19:36 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F233DC061753 for ; Wed, 13 Oct 2021 11:17:32 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id h185-20020a256cc2000000b005bdce4db0easo4052525ybc.12 for ; Wed, 13 Oct 2021 11:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=NLRoIZHIP07xVaQxZ/Th6ra9+3RRZlDKsNZoVY8HRkw=; b=sQ9nG9JWWa9Mn97zg9W9ZToGFaIJ+2096eP72oFROHBdWmdU++QLmNkakZgzAhGzJI l6VU4DnehIZi61j+bqVrQp6NIU4IOVz+4lFXgddoeQjjJSQZaY4Edt+/4VnpBIfo5p2z ij1YdPs5vzTPQbblRpk/dLZ3/7es3995ybY4KCiZyqsh1kcsvvqK9dJudhqjOG/NESe0 AkhoTR8IwyxPR3LhIcRE1AfA4c0IjmquY9kD0B25IuAhnttXbEHgTDC5vlogLV0M93AM 4xOJeVFJN8JWaglbFKxv5w7Ttx8GMWD/b9W/6V14TuRAWP7OiNnlijLg0oXPHz3Tpnsi Wu7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=NLRoIZHIP07xVaQxZ/Th6ra9+3RRZlDKsNZoVY8HRkw=; b=W3zqOu9iSZEfDst6mMtGxonGxFBNH7M0Z6imIKgIwt8GGNxp2tF30/egtpfSA5u5I6 w2yVrMptlh80jQRTfSFv0+Jav3EEiUomovK0jig9xfqu7EGx2cokPGK9XgxshDK9OEbx TV0FRk++4r7dZNTkezHFOaAO99n1niadmW48GmcPPq57vOYwuYg6hdaSqlDakxYysH1i kyFZgSZJ372+96b8R0J5Yh7vdJT6Xxcb6ah0ERhpO8emSTy4F113T+9vKN66DKS5PCEE cE4rcdfItgLsMFj2U8/OIQ+FntNlCtVmLHYbI89SlQSw98LyhzTQpRqRj6dATLRqGVHj LU2Q== X-Gm-Message-State: AOAM530VsQ8pBs9lvtrr5p2s8fkPerJZ6zoWKSk4udTwgjUnBCl500eu Y3xQwpWjXnuR5lpiortxxZZQ65pcfM1YyvnFT0E= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:9ea6:6c27:1876:926c]) (user=samitolvanen job=sendgmr) by 2002:a25:b790:: with SMTP id n16mr917302ybh.395.1634149052151; Wed, 13 Oct 2021 11:17:32 -0700 (PDT) Date: Wed, 13 Oct 2021 11:16:56 -0700 In-Reply-To: <20211013181658.1020262-1-samitolvanen@google.com> Message-Id: <20211013181658.1020262-14-samitolvanen@google.com> Mime-Version: 1.0 References: <20211013181658.1020262-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=1165; h=from:subject; bh=cWgW7c++4rTsWL5fNfmGI8mvplNIrZThQL76GT9fg04=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBhZyKaCYCUH7T+fWoNdx2QCDRdr+KfWhTjVE/9EB9M oD6hwNCJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYWcimgAKCRBMtfaEi7xW7qhXDA Cc8MvkJ9dETn63gZb8T2sHkjmWGrk7/WGznHUsqwmQG+VZA5JcCeAh9+c5wesuJXP9BqacwjdRKKSj 56XBWu4BovM5i7dniaLFJq179rRY9/YlknjUBgAR1sMDvpHbQM0wYBlTSTsSwqXgM2rUulhLu2H9+c TbjBHDXtalxCYUpP/wQgDOFX7J0PwRpHUb4hGKfFuf51FaLAOQzNscIT0JPD9DZ8KMS4tVwR1Ulziv xPJQ1REeLX96kOtZq5doOqPR6h6EWpCs2SnCiTdFCuFNnfwxJoLpFZlL3JGQTDhy8SlIZygC/SN5rD 6FASRz6UJdPQ21fZNHoRizyKcPIE0Iec9NimvjSTAkOv6N/h/+WUTc5Bcgr/hM/8uJzEuIuf0iCGUO 5PVAb8WHGpPCH/GhTfKy9a1qeufVESBFH+hf3G3l4PqhLaM0H6ee1eXG92/lQ8gmBuDVYuqmenjL+R UNmMhCzNAsGzLX49wnTGk7jqkHv93ooYfVDgfgySqKF5A= X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v5 13/15] x86, cpu: Use LTO for cpu.c with CFI From: Sami Tolvanen To: x86@kernel.org Cc: Kees Cook , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow LTO to be used for cpu.c when CONFIG_CFI_CLANG is enabled to avoid indirect call failures. CFI requires Clang >= 13, which doesn't have the stack protector inlining bug. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Tested-by: Sedat Dilek --- arch/x86/power/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/power/Makefile b/arch/x86/power/Makefile index 379777572bc9..a0532851fed7 100644 --- a/arch/x86/power/Makefile +++ b/arch/x86/power/Makefile @@ -4,9 +4,11 @@ # itself be stack-protected CFLAGS_cpu.o := -fno-stack-protector +ifndef CONFIG_CFI_CLANG # Clang may incorrectly inline functions with stack protector enabled into # __restore_processor_state(): https://bugs.llvm.org/show_bug.cgi?id=47479 CFLAGS_REMOVE_cpu.o := $(CC_FLAGS_LTO) +endif obj-$(CONFIG_PM_SLEEP) += cpu.o obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o hibernate.o -- 2.33.0.1079.g6e70778dc9-goog