From nobody Wed Dec 17 06:10:13 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BD6D20A5E5 for ; Fri, 14 Nov 2025 15:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763132572; cv=none; b=JHsVjsLK0RlWox0o0W19KrTcdLiq7PlauaVEBhNk/5DKBvvxg99Tudj4cjWEGHGJBHBM6p/qXJttb1Ojwp4mysleudDIXK9jbsOtRzCuYo8Q3lqNP+SLDjOKzB+wh0jbeSvtogtsagdawU2XHaBCPe0/LjdJxz/KWFAqGsHzKTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763132572; c=relaxed/simple; bh=Dsxrkf28GQuyqD4QjCXp2aGE+3iNdRSDLPbA+0swbpk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hbblaqotXvinYhFhenpLDEdSn6d6TVbHw5433gL9Nm+VGaFDuG2ictXTx/Yn12CQANRZp2+g51dIB2pcXh34rOTT7aDwYU4s5cUhD9lkBTgomeqIZAjMGNmrXjfYdyudP/16Oia3QslT9PgxO7xRqcmf9q64e1JMd7O79QtEfFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=El2tDJYB; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="El2tDJYB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763132569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b4IT63puubgpuedNrSBejwiXJhFoMe1SM8s9x/q/mXU=; b=El2tDJYBnCVYoSdRQPjKeDzvdgqTVNxwzPLwzCdN3yldYUIL246S/p5yw6ekPbcgrj57m+ y1tTz+nBwczGNojYR3X97gpn3AbMacQBh7oWAl2uqe8/dfGCKEEpBKq/QAcY2NBhtS3ZBM vuag4msejhD/x/hBGdktlHToCmr4zy4= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-NweJLrEmMpKdNLpvmtUD0Q-1; Fri, 14 Nov 2025 10:02:45 -0500 X-MC-Unique: NweJLrEmMpKdNLpvmtUD0Q-1 X-Mimecast-MFC-AGG-ID: NweJLrEmMpKdNLpvmtUD0Q_1763132559 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FF231954230; Fri, 14 Nov 2025 15:02:36 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.45.226.10]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C56B419560B9; Fri, 14 Nov 2025 15:02:19 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, rcu@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Arnaldo Carvalho de Melo , Paolo Bonzini , Arnd Bergmann , Frederic Weisbecker , "Paul E. McKenney" , Jason Baron , Steven Rostedt , Ard Biesheuvel , Sami Tolvanen , "David S. Miller" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Mel Gorman , Andrew Morton , Masahiro Yamada , Han Shen , Rik van Riel , Jann Horn , Dan Carpenter , Oleg Nesterov , Juri Lelli , Clark Williams , Yair Podemsky , Marcelo Tosatti , Daniel Wagner , Petr Tesarik , Shrikanth Hegde Subject: [PATCH v7 01/31] objtool: Make validate_call() recognize indirect calls to pv_ops[] Date: Fri, 14 Nov 2025 16:01:03 +0100 Message-ID: <20251114150133.1056710-2-vschneid@redhat.com> In-Reply-To: <20251114150133.1056710-1-vschneid@redhat.com> References: <20251114150133.1056710-1-vschneid@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" call_dest_name() does not get passed the file pointer of validate_call(), which means its invocation of insn_reloc() will always return NULL. Make it take a file pointer. While at it, make sure call_dest_name() uses arch_dest_reloc_offset(), otherwise it gets the pv_ops[] offset wrong. Fabricating an intentional warning shows the change; previously: vmlinux.o: warning: objtool: __flush_tlb_all_noinstr+0x4: call to {dynami= c}() leaves .noinstr.text section now: vmlinux.o: warning: objtool: __flush_tlb_all_noinstr+0x4: call to pv_ops[= 1]() leaves .noinstr.text section Signed-off-by: Valentin Schneider Acked-by: Josh Poimboeuf --- tools/objtool/check.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 9004fbc067693..12b6967e5fd0d 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3325,7 +3325,7 @@ static inline bool func_uaccess_safe(struct symbol *f= unc) return false; } =20 -static inline const char *call_dest_name(struct instruction *insn) +static inline const char *call_dest_name(struct objtool_file *file, struct= instruction *insn) { static char pvname[19]; struct reloc *reloc; @@ -3334,9 +3334,9 @@ static inline const char *call_dest_name(struct instr= uction *insn) if (insn_call_dest(insn)) return insn_call_dest(insn)->name; =20 - reloc =3D insn_reloc(NULL, insn); + reloc =3D insn_reloc(file, insn); if (reloc && !strcmp(reloc->sym->name, "pv_ops")) { - idx =3D (reloc_addend(reloc) / sizeof(void *)); + idx =3D (arch_dest_reloc_offset(reloc_addend(reloc)) / sizeof(void *)); snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx); return pvname; } @@ -3415,17 +3415,19 @@ static int validate_call(struct objtool_file *file, { if (state->noinstr && state->instr <=3D 0 && !noinstr_call_dest(file, insn, insn_call_dest(insn))) { - WARN_INSN(insn, "call to %s() leaves .noinstr.text section", call_dest_n= ame(insn)); + WARN_INSN(insn, "call to %s() leaves .noinstr.text section", call_dest_n= ame(file, insn)); return 1; } =20 if (state->uaccess && !func_uaccess_safe(insn_call_dest(insn))) { - WARN_INSN(insn, "call to %s() with UACCESS enabled", call_dest_name(insn= )); + WARN_INSN(insn, "call to %s() with UACCESS enabled", + call_dest_name(file, insn)); return 1; } =20 if (state->df) { - WARN_INSN(insn, "call to %s() with DF set", call_dest_name(insn)); + WARN_INSN(insn, "call to %s() with DF set", + call_dest_name(file, insn)); return 1; } =20 --=20 2.51.0