From nobody Wed Jun 05 18:52:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvc6F6xLyz5LbN9 for ; Wed, 05 Jun 2024 18:52:53 +0000 (UTC) (envelope-from bounce.et14jdlz6vmqrc0=ip426riv613n=cvnaskdkq7eeti@em790814.fubar.geek.nz) Received: from e3i74.smtp2go.com (e3i74.smtp2go.com [158.120.84.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvc6F3kpxz4ZgB for ; Wed, 5 Jun 2024 18:52:53 +0000 (UTC) (envelope-from bounce.et14jdlz6vmqrc0=ip426riv613n=cvnaskdkq7eeti@em790814.fubar.geek.nz) Authentication-Results: mx1.freebsd.org; none Received: from [10.99.243.232] (helo=morbo.fubar.geek.nz) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97.1-S2G) (envelope-from ) id 1sEvkE-4o5NDgrgnEd-nLPb; Wed, 05 Jun 2024 18:52:22 +0000 Received: from smtpclient.apple (92.40.184.0.threembb.co.uk [92.40.184.0]) by morbo.fubar.geek.nz (Postfix) with ESMTPSA id A26C9108AA; Wed, 05 Jun 2024 18:52:21 +0000 (UTC) From: Andrew Turner Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.100.2.1.4\)) Subject: Re: git: bed65d85c631 - main - linux64: Fix the build on arm64 with bti checking Date: Wed, 5 Jun 2024 19:52:10 +0100 In-Reply-To: <20240605153714.5161218F@slippy.cwsent.com> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Cy Schubert References: <202406050929.4559TFj0027386@gitrepo.freebsd.org> <20240605153714.5161218F@slippy.cwsent.com> X-Mailer: Apple Mail (2.3774.100.2.1.4) X-Report-Abuse: Please forward a copy of this message, including all headers, to Feedback-ID: 790814m:790814amQcrys:790814s9DKRXVPkQ X-smtpcorp-track: 2ToIrm-8da7V.wSDK-lsXQYNE.9VknOA2ZrD0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smtpservice.net; i=@smtpservice.net; q=dns/txt; s=a1-4; t=1717613561; h=feedback-id : x-smtpcorp-track : date : message-id : to : subject : from : reply-to : sender : list-unsubscribe : list-unsubscribe-post; bh=//crtbKMkuOORpg8umoOjhwxPeHlZtYnVCf/M19gf1g=; b=dobwEhqFujJbR6dpzV73Op0NuGQFS7Qf5WmXO5Alfmg6HpzhlIoJgRbtvfl+0NxIWOnHb GnbT3/HEhjbN3xWt8flm9Uhz5P9wtMl2xMRE3YsFtyDvL9lGbNjDDq2mGmnT9+UtwqB9QJf LyeYshRaEHcARIcprv4DXHzAL0/YUoMj8V8oRQe3zK33PrL935yxMt7b99QmWbT1SzilXnt GCnymmPGNV8lmmwJLcbD0skaYRExiMDyVSg5I7K+cC2PYzJqDZ+gN4wZp8DfOd9BShPqhuC RwN7tFtiSEOGVFpWqjuUv4MsWhsgXml34A5sZ/JGYstWqQ8FKnSIWOisrxFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; i=@fubar.geek.nz; q=dns/txt; s=s790814; t=1717613561; h=from : subject : to : message-id : date; bh=//crtbKMkuOORpg8umoOjhwxPeHlZtYnVCf/M19gf1g=; b=bI+4FFQk06l3pVeiTWs9JJD0CJAi+t1Iyh8We2FG+nMs7eNbxNMAnAaqSDim6/ufJ9LNy KgDj7KG/zM6iQb0VlL33s4fJ60zdPFK3VnRxqP4Zdho9hF/jdxiKMJCosWhscJzxBf9Ab1J ChoFFc1DC2o/VaA7XQpW05To7XuJ2OTde2w/fAM3+gEfb0TcJr1vRLat2DjV+H2llNovE+i 0cCYOsOPPbTt+NCUqaAgZl9vllQkAp9LRHubs4WbzkBZqB0k76qiqRrU9T7fvvyCjgYbZeP 1XVODmYSoB9Bmkl7BIWXma22E+SjDhu49cymivCOhbJ4uDSn7WNPHCdLJLNA== X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:23352, ipnet:158.120.84.0/22, country:US] X-Rspamd-Queue-Id: 4Vvc6F3kpxz4ZgB --Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 5 Jun 2024, at 16:37, Cy Schubert = wrote: >=20 > In message <202406050929.4559TFj0027386@gitrepo.freebsd.org>, Andrew = Turner=20 > wri > tes: >> The branch main has been updated by andrew: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dbed65d85c631c3a8e60a81a15a5a745c= >> 8ef92fbe >>=20 >> commit bed65d85c631c3a8e60a81a15a5a745c8ef92fbe >> Author: Andrew Turner >> AuthorDate: 2024-06-04 12:47:52 +0000 >> Commit: Andrew Turner >> CommitDate: 2024-06-05 09:23:40 +0000 >>=20 >> linux64: Fix the build on arm64 with bti checking >>=20 >> When we enable checking for BTI on arm64 we need to include an ELF >> note in all object files linked into a module. >>=20 >> As using objcopy from a binary to an ELF object file doesn't add = the >> note switch to using .incbin from an assembly file. This allows us = to >> add the needed note without affecting the included object. >>=20 >> Reviewed by: imp, kib, emaste >> Sponsored by: Arm Ltd >> Differential Revision: https://reviews.freebsd.org/D45468 >> --- >> sys/arm64/linux/linux_support.S | 4 ++++ >> sys/compat/linux/linux_vdso_inc.S | 39 = +++++++++++++++++++++++++++++++++++++ >> ++ >> sys/modules/linux64/Makefile | 17 +++-------------- >> 3 files changed, 46 insertions(+), 14 deletions(-) >>=20 >> diff --git a/sys/arm64/linux/linux_support.S = b/sys/arm64/linux/linux_support. >> S >> index 151ede7e1c19..3b16583e9d54 100644 >> --- a/sys/arm64/linux/linux_support.S >> +++ b/sys/arm64/linux/linux_support.S >> @@ -26,6 +26,8 @@ >> * SUCH DAMAGE. >> */ >>=20 >> +#include >> + >> #include >> #include >> #include >> @@ -172,3 +174,5 @@ ENTRY(futex_xorl) >> str w4, [x2] >> ret >> END(futex_xorl) >> + >> = +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) >> diff --git a/sys/compat/linux/linux_vdso_inc.S = b/sys/compat/linux/linux_vdso_ >> inc.S >> new file mode 100644 >> index 000000000000..af10907f0b60 >> --- /dev/null >> +++ b/sys/compat/linux/linux_vdso_inc.S >> @@ -0,0 +1,39 @@ >> +/*- >> + * SPDX-License-Identifier: BSD-2-Clause >> + * >> + * Copyright (C) 2020 Arm Ltd >> + * >> + * Redistribution and use in source and binary forms, with or = without >> + * modification, are permitted provided that the following = conditions >> + * are met: >> + * 1. Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * 2. Redistributions in binary form must reproduce the above = copyright >> + * notice, this list of conditions and the following disclaimer = in the >> + * documentation and/or other materials provided with the = distribution. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS = IS'' AND >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOS >> E >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIA >> L >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRIC >> T >> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN = ANY WAY >> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >> + * SUCH DAMAGE. >> + */ >> + >> + .section .rodata >> + .globl _binary_linux_vdso_so_o_start >> +_binary_linux_vdso_so_o_start: >> + .incbin "linux_vdso.so.o" >> + .globl _binary_linux_vdso_so_o_end >> +_binary_linux_vdso_so_o_end: >> + >> +#if defined(__aarch64__) >> +#include >> +#include >> = +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) >> +#endif >> diff --git a/sys/modules/linux64/Makefile = b/sys/modules/linux64/Makefile >> index 62e3b464d39f..beed5ec59c4b 100644 >> --- a/sys/modules/linux64/Makefile >> +++ b/sys/modules/linux64/Makefile >> @@ -35,7 +35,8 @@ SRCS=3D linux_dummy_machdep.c \ >> bus_if.h \ >> device_if.h \ >> vnode_if.h \ >> - linux_support.S >> + linux_support.S \ >> + linux_vdso_inc.S >> .if ${MACHINE_CPUARCH} =3D=3D "amd64" >> SRCS+=3D linux_dummy_x86.c >> .endif >> @@ -47,7 +48,6 @@ SRCS+=3D opt_kstack_pages.h opt_nfs.h = opt_hwpmc_hooks.h >> CLEANFILES=3D linux_assym.h linux_genassym.o linux_locore.o \ >> genassym.o linux_vdso_gtod.o linux_vdso.so.o >>=20 >> -OBJS=3D linux_vdso.so >>=20 >> linux_assym.h: linux_genassym.o >> sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} >> @@ -83,18 +83,7 @@ linux_vdso.so.o: linux_locore.o linux_vdso_gtod.o >> -T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \ >> -o ${.TARGET} ${.ALLSRC:M*.o} >>=20 >> -.if ${MACHINE_CPUARCH} =3D=3D "aarch64" >> -OBJCOPY_TARGET=3D--output-target elf64-littleaarch64 = --binary-architecture aar >> ch64 >> -.elif ${MACHINE_CPUARCH} =3D=3D "amd64" >> -OBJCOPY_TARGET=3D--output-target elf64-x86-64 --binary-architecture = i386:x86-6 >> 4 >> -.else >> -.error ${MACHINE_CPUARCH} not yet supported by linux64 >> -.endif >> - >> -linux_vdso.so: linux_vdso.so.o >> - ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \ >> - linux_vdso.so.o ${.TARGET} >> - ${STRIPBIN} -N _binary_linux_vdso_so_o_size ${.TARGET} >> +linux_vdso_inc.o: linux_vdso.so.o >>=20 >> linux_support.o: linux_support.S assym.inc linux_assym.h >> ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ >>=20 >=20 > kldload linux64.ko results in the following panic on amd64. Reverting = this=20 > revision addresses the regression. >=20 Does the attached patch fix it? I didn=E2=80=99t see this when testing. Andrew --Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302 Content-Disposition: attachment; filename=0001-linux-Allows-writing-to-the-vdso-from-the-kernel.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-linux-Allows-writing-to-the-vdso-from-the-kernel.patch" Content-Transfer-Encoding: quoted-printable =46rom=20fd684f8b907077b6ee83fe510b9163edddb645d0=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Andrew=20Turner=20=0ADate:=20= Wed,=205=20Jun=202024=2018:47:48=20+0000=0ASubject:=20[PATCH]=20linux:=20= Allows=20writing=20to=20the=20vdso=20from=20the=20kernel=0A=0AWe=20need=20= to=20write=20to=20the=20vdso=20in=20the=20kernel=20to=20perform=20= fixups.=20Move=20it=0Afrom=20.rodata=20to=20.data=20so=20these=20can=20= be=20run.=0A=0ASponsored=20by:=09Arm=20Ltd=0A---=0A=20= sys/compat/linux/linux_vdso_inc.S=20|=202=20+-=0A=201=20file=20changed,=20= 1=20insertion(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/sys/compat/linux/linux_vdso_inc.S=20= b/sys/compat/linux/linux_vdso_inc.S=0Aindex=20af10907f0b60..44cc357b4a4a=20= 100644=0A---=20a/sys/compat/linux/linux_vdso_inc.S=0A+++=20= b/sys/compat/linux/linux_vdso_inc.S=0A@@=20-25,7=20+25,7=20@@=0A=20=20*=20= SUCH=20DAMAGE.=0A=20=20*/=0A=20=0A-=09.section=20.rodata=0A+=09.section=20= .data=0A=20=09.globl=20_binary_linux_vdso_so_o_start=0A=20= _binary_linux_vdso_so_o_start:=0A=20=09.incbin=20"linux_vdso.so.o"=0A--=20= =0A2.44.0=0A=0A= --Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302--