From patchwork Fri Oct 11 09:18:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 1995946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=pMItqUBA; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=HoF1+6rt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=u0us=rh=vger.kernel.org=sparclinux+bounces-2360-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XQ1KC1NlTz1xsc for ; Fri, 11 Oct 2024 20:19:11 +1100 (AEDT) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4XQ1KB28BDz4wb0 for ; Fri, 11 Oct 2024 20:19:10 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4XQ1KB26Mhz4wcy; Fri, 11 Oct 2024 20:19:10 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip="2604:1380:45d1:ec00::1" arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1728638350; cv=pass; b=ggg+xu3e3Vg645UU6TzKOwtT928u4K+DslxRi2cv6WTjFzDov0gRlH7wDN9fhMd5pe9HnzJfoONBc/HG8x9lNXzMSs4yjS7LYvXph3hVpVqCeksaw5HFxcjGPN3F4ulPnGp1DtHDO6n9OYku1zElinSWDGeDG9cp8vwPVbJbek/S7SuBL+P53Y7ccLbjtVnMBVi3L/04GasMVpAQbNTDuf0cIl97DUnJWcG1PclHL4d7lJKQf1k6bocYdQ39JVlC/yf0UEAaNMOzJOEqwAnduHHsU/SUu3fJBTUodXDoXnKFw9Brqc39Kud7sa8avBo9cjFu1j0lSghoiRrx4Jg9ug== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1728638350; c=relaxed/relaxed; bh=WofKWQfIubfeHKDL8Z7mLX9FYWEFQjb7A3Rqqw9UA/8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hTwH4BWMBtqsmySAZ+x9eiBkDTrcdOTaFay5YWSCYMqUYrgf7fgJZixvdsd3xu5xodMXmy5T3UwN6migt+Cw6niuVWGtDmvGgZg7o2Iw0sy5rXe6NR3/XJfQpbCY3Iiym2bNd637ZVMlf5HKNkCJ63R1tIHY1zRvSfYngKMahR6iu8963htbTTalt0BQFjMt71zwCR9w5Z0+u7/KrwPIv9JrxSwKeKVWwiInH3lW+61g0XqGCeX2b53Wi/Vtk5pFr60w07b4+IWUMbAU8IYRTya4nCB0s2BCgg8v3T9z4AHK5+MoyYONXnyMuon8rUv2kHPUWbdKVoZapDLfn4L+Sg== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=pMItqUBA; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=HoF1+6rt; dkim-atps=neutral; spf=pass (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=sparclinux+bounces-2360-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=pMItqUBA; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=HoF1+6rt; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=sparclinux+bounces-2360-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4XQ1K96669z4wb0 for ; Fri, 11 Oct 2024 20:19:09 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F28D41C222A1 for ; Fri, 11 Oct 2024 09:19:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DF3920CCE6; Fri, 11 Oct 2024 09:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pMItqUBA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="HoF1+6rt" X-Original-To: sparclinux@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 89EA020A5F0; Fri, 11 Oct 2024 09:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728638336; cv=none; b=SxzovbsQDCjSqW3vlJu9P9NTBNlgmXB0iAAtEunHuAXLw57J4T2wlWe9Utth65x0sR0Q0MjgzOtTW0yUVu8I4yyj2YlSbBqC2cqXPm+j+eNnw9WWo+4t+mBlPdCJLV2AKM2UYY1YQviXgxtqpl5gewHGJ5a/Jj0XsMcXqBBGlbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728638336; c=relaxed/simple; bh=8graJ88b/1tuzP7zyilPImJgtI4+2y3oe5+fECRuaC4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cuES5QMSCtu8145bI/xFFUjNeetL7Mj8aJxmecdVUxY7mtVM/z0vIh8Zcsi/wBM9JwIya+kJytvii5h8eDAJcKziEsi/0xFurHiehMPmP7lhXKuyupofEQh6QxeDWPVfIcq+3ViTtN4gigBIrI3kJc8pZ+0ufZpcs1egeggZ9Bo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pMItqUBA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=HoF1+6rt; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1728638332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WofKWQfIubfeHKDL8Z7mLX9FYWEFQjb7A3Rqqw9UA/8=; b=pMItqUBA1FGTHUAJGwjQLn8u28ELmvCCdkFJp61+T44IQEHQy66+ju6NrDUBJuj5paWP44 DDlqLPIjTe3ZR/YONfALP5fDqWR30q+BWI6oPxvifwN/K1EnqauT7SJ/Wzwos6LCdH3J93 dUJSpqzQpBYWDbgyLMQwbxhV80N8NqA63cnwzTeMOjoZPC/8RHBbxmbnnp+2nl0GVN0A7W AmSHIhIaVy/+MwcvHjJwVq6/C/iefgkWzROQhiVwLTjotScE4f7CEE2XGLkCDX+5gBaGOl Ewb6fz46k4VD8RM0BZYlR9Oseo89C2IEEr6+1c9GvtL/3mYDBDjK1dopCiz9MA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1728638332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WofKWQfIubfeHKDL8Z7mLX9FYWEFQjb7A3Rqqw9UA/8=; b=HoF1+6rtA7cY8FPUyY2ENIq3BU8v1ZjnYJVrIo3MatrHGR4E19nKDGVeWzMY0exIp1C2fT UCYWjl88JJqu3jAg== Date: Fri, 11 Oct 2024 11:18:25 +0200 Subject: [PATCH 1/3] x86: vdso: Always reject undefined references in during linking Precedence: bulk X-Mailing-List: sparclinux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241011-vdso-checkundef-v1-1-1a46e0352d20@linutronix.de> References: <20241011-vdso-checkundef-v1-0-1a46e0352d20@linutronix.de> In-Reply-To: <20241011-vdso-checkundef-v1-0-1a46e0352d20@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , "David S. Miller" , Andreas Larsson Cc: linux-kernel@vger.kernel.org, linux-um@lists.infradead.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1728638330; l=2103; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=8graJ88b/1tuzP7zyilPImJgtI4+2y3oe5+fECRuaC4=; b=QbuErtNhAAXbGdrRJr2jxflgPuO9hwjLb0cgTtUeTw+X0nZP2svxJLWcPCHmCWk1cJA1jKJ/P /VPOOwcIsHfAUDmveF3GaogL7lYf0UB7b3T4G7lZ5MxpZ4eetTYT+JB X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Instead of using a custom script to detect and fail on undefined references, use --no-undefined for all VDSO linker invocations. Drop the now unused checkundef.sh script. Signed-off-by: Thomas Weißschuh --- arch/x86/entry/vdso/Makefile | 7 +++---- arch/x86/entry/vdso/checkundef.sh | 10 ---------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index c9216ac4fb1eb8c1e5bc5e33b41e9e40c7924cbf..99de18d88bc39f8f83f35e554028efd0a76fccec 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -32,7 +32,7 @@ targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg CPPFLAGS_vdso.lds += -P -C -VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \ +VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 \ -z max-page-size=4096 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE @@ -151,10 +151,9 @@ $(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE quiet_cmd_vdso = VDSO $@ cmd_vdso = $(LD) -o $@ \ $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ - -T $(filter %.lds,$^) $(filter %.o,$^) && \ - sh $(src)/checkundef.sh '$(NM)' '$@' + -T $(filter %.lds,$^) $(filter %.o,$^) -VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 \ +VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 --no-undefined \ $(call ld-option, --eh-frame-hdr) -Bsymbolic -z noexecstack quiet_cmd_vdso_and_check = VDSO $@ diff --git a/arch/x86/entry/vdso/checkundef.sh b/arch/x86/entry/vdso/checkundef.sh deleted file mode 100755 index 7ee90a9b549da32c9c12d694215b89d08645574c..0000000000000000000000000000000000000000 --- a/arch/x86/entry/vdso/checkundef.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -nm="$1" -file="$2" -$nm "$file" | grep '^ *U' > /dev/null 2>&1 -if [ $? -eq 1 ]; then - exit 0 -else - echo "$file: undefined symbols found" >&2 - exit 1 -fi