From patchwork Tue Jul 11 09:19:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Pavlu X-Patchwork-Id: 11851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp349297vqm; Tue, 11 Jul 2023 02:28:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFZSumxB9L9PZaMjfED7MSiQ91MuTgpRbJT+eYs7XcBOJDtXOqK7frbihowiP+TFO7jgBF X-Received: by 2002:a17:90b:1998:b0:263:a37:fcc3 with SMTP id mv24-20020a17090b199800b002630a37fcc3mr11343791pjb.5.1689067696356; Tue, 11 Jul 2023 02:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689067696; cv=none; d=google.com; s=arc-20160816; b=HS4HdY3dwLCJvivUQ3Jzq3lsXsM18fFacwb/eriXRjNn69If5gy+6i055vsy7Aq9D1 DzOIXhNyDNKuYZ+HUdpse8Nruhdh/OJP0BPjnTbz/IefT3DPzP5xa5PPfr9NTa9knMs9 5XfqArBkCWWEngOdwlHhjXBe6lIEKRg+gdB9phZ9G0TePZJ3HhFqjTi0rrVeigcYOJMY 21H6xJaFT+rar9waKie6RMmR2OoQelctbmBCyU7MCYYV+VU2VzDSoVfaGdYQsOpCzncP amO3tRy2JfQnwZA2Ao+24xmAzx/yx5G2ZVk1ANkMjX86WFLqU4/PiSAT6xHA++vLra1V Ldeg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=1jlkb8dUUa0Nv29PncgxS1y0JcIN/aXBsVfRkm+5+/k=; fh=A/iTK4ByaBbZ28HmqSXeJy2l0eu6hrhZ4VrfzDt8MTI=; b=pHWCjl2jbLAt2Nu8Y7mTLF5FAq8GNFvfb7ljL5JWUn2hGwcdcULfynGPV9CeyO6J7L MozpUKuRPhcwK872qs/uWpeBgqKnLsqpdVhTrUlctR5jRm4AgRhjlpyVenOxvnu8K909 j+SwqMRAO1kdtII+nltl/iz7eQX+itUK6hf7fD2Ci3w1iE49gLYgshi29mXnYvPpAANS nRA+4kp8UeDb/gZP5d1M2Al8fn9IBw5y4AJgyaL5yAH5kD55SXzZEhEO2usEOPQXN0fH yMCBDZM8RCvcvCVBiF2HOmWHV+u5lqykYNnvCI/6OLwKn+NdF6SQ4thazt0hpFmcD81K KRRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=SQcGB8uQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t33-20020a634461000000b0054f73ee92basi1199282pgk.8.2023.07.11.02.28.03; Tue, 11 Jul 2023 02:28:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=SQcGB8uQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232158AbjGKJZN (ORCPT + 99 others); Tue, 11 Jul 2023 05:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231782AbjGKJYs (ORCPT ); Tue, 11 Jul 2023 05:24:48 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBA1FF7; Tue, 11 Jul 2023 02:20:15 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 676B4226B8; Tue, 11 Jul 2023 09:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1689067214; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1jlkb8dUUa0Nv29PncgxS1y0JcIN/aXBsVfRkm+5+/k=; b=SQcGB8uQgfa14QM7KSMT2CXef1FZOxkEY2eO9m0hIECqCvg5dyDqs8GjTLcYrp0Nuccupd +JnmjAwVPOUkF1dNu+dMSvE1kEKTrx/L2t/Y4ojlka+tm0s8PG8UUHQ1otJVUZ6Mybieal 7Iks0BXJEpBdVuAUVSInOe+W/AQ0qRk= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 34BD71390F; Tue, 11 Jul 2023 09:20:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jtwYDM4erWSiVwAAMHmgww (envelope-from ); Tue, 11 Jul 2023 09:20:14 +0000 From: Petr Pavlu To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mhiramat@kernel.org, peterz@infradead.org Cc: samitolvanen@google.com, x86@kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Pavlu Subject: [PATCH v2 0/2] x86/retpoline,kprobes: Fix the [__indirect_thunk_start, ..end] range Date: Tue, 11 Jul 2023 11:19:50 +0200 Message-Id: <20230711091952.27944-1-petr.pavlu@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771115848892850552 X-GMAIL-MSGID: 1771115848892850552 Fix problems with an output position of thunk sections and the associated definition of range [__indirect_thunk_start, __indirect_thunk_end] which affects the kprobes optimization. Initial v1 of the series kept the mentioned range but it turns out the logic which uses it is not necessary so it is removed altogether. Changes since v1 [1]: - Drop the patch which moved the return thunk out of [__indirect_thunk_start, ..end] and instead replace it with a removal of the kprobes optimization check which looked for calls to indirect thunks. - Slightly adjust the commit message for the first patch, to better match the new second patch. [1] https://lore.kernel.org/lkml/20230705081547.25130-1-petr.pavlu@suse.com/ Petr Pavlu (2): x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG x86/retpoline,kprobes: Skip optprobe check for indirect jumps with retpolines and IBT arch/x86/include/asm/nospec-branch.h | 3 --- arch/x86/kernel/kprobes/opt.c | 40 +++++++++++----------------- arch/x86/kernel/vmlinux.lds.S | 4 +-- arch/x86/lib/retpoline.S | 4 +-- tools/perf/util/thread-stack.c | 4 +-- 5 files changed, 20 insertions(+), 35 deletions(-)