From nobody Sun Apr 5 16:22:43 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 429C53DEFF9 for ; Tue, 24 Mar 2026 09:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774345750; cv=none; b=GQbNmESPRIi0MLKfkKXV1VM5aWI/YATeqURcYtvMGuRjhnoKqlSYMxcvebRm0Us4AcoHR6JsD1OQkb5VfDuD0UFI9EhX/MYYmT6gXTpch5gwQoyBsYtaVORc9V7cx+ob8MLGFLZmshyHb6IPTQPpbZrwkvR5M2UFvfBt9WHN2Uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774345750; c=relaxed/simple; bh=cu41BU69+aqmQZMD2uuVADqUugzltgEfWdbVsXmZ/WQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mSehxeiQqCGrVAynbhxzYST36VCnwa3OkQVkmw6ql5A+PiIV08110qdFC0viarF5Y1Woc24+EMC5AtTJ2wObug004XspHRf5+6wPTdYo7DusMF8m5YjsSl2BMs6vFYyt/oHpp6+2u8dJ+bVQtRJHY5DmnB5VrSkqWZLV/h7XPhg= 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=KU/bGIP/; arc=none smtp.client-ip=170.10.133.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="KU/bGIP/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774345746; 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=KUuxkh0IxxlR1KOoFNjZCYbUauFoeQmbuz1JYSeJkVA=; b=KU/bGIP/a1y2lrZhehwlcDhCUdF5cqPB/agchNfn4eraOGxZkaqy7+dPqYwtfbXD8OZtSQ HHHpF0N0cOCZv+whaAWz5qi3m+qDMF98vG1gDMn4qE4S8hS/W8E6p0PxgNqkn6ilY8/q8Y cjRs7o0D9u/9FTU2AoMdNtBkmdGge3A= Received: from mx-prod-mc-05.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-528-cC3e26PvOy-Zp4rfC0OIjg-1; Tue, 24 Mar 2026 05:49:01 -0400 X-MC-Unique: cC3e26PvOy-Zp4rfC0OIjg-1 X-Mimecast-MFC-AGG-ID: cC3e26PvOy-Zp4rfC0OIjg_1774345738 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EBA601956089; Tue, 24 Mar 2026 09:48:56 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.44.34.246]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 08FBD300019F; Tue, 24 Mar 2026 09:48:42 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@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 , Tomas Glozar , Yair Podemsky , Marcelo Tosatti , Daniel Wagner , Petr Tesarik , Shrikanth Hegde Subject: [RFC PATCH v8 01/10] objtool: Make validate_call() recognize indirect calls to pv_ops[] Date: Tue, 24 Mar 2026 10:47:52 +0100 Message-ID: <20260324094801.3092968-2-vschneid@redhat.com> In-Reply-To: <20260324094801.3092968-1-vschneid@redhat.com> References: <20260324094801.3092968-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.4.1 on 10.30.177.4 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 3fd98c5b6e1a8..7c82934247484 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3388,7 +3388,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; @@ -3397,9 +3397,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_insn_adjusted_addend(insn, reloc) / sizeof(void *); snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx); return pvname; } @@ -3478,17 +3478,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.52.0