From nobody Sun Dec 28 08:17:39 2025 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 4dfBzm34P8z6LQjR for ; Sun, 28 Dec 2025 08:17:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dfBzl6wBhz3TFD for ; Sun, 28 Dec 2025 08:17:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766909860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1aEJsJtZBVxJrRPEh+nlisj5ebk8j6rCCqyg3gXkGII=; b=DFzEABdYFL6RPdsxzB7SXkCjotmk6Y9h0ffMyaNLqgmsAZjgIddSc/W0C6VvotiZlopQIs 2hISfTfSM+UG6Y1VsixjROhleTAiyijVRe8gWKQFNm5WbZnKy0ISQdNLLzmwqeRbqnKRrq fc5yxFBQJ6Xjf4t6G7uJ49ozFXnzXXFvVuZMiq6JEeKR3Q0cm+zMbRfvKdvtm0AWrRq1LK FA0KOvawUv3ND0KSg1RnRbuD1kjYi7fCdFIkqPrkQBKEhiUIqSlKhe9o/gBdBnIGJ2SrFV TZPVIexkQEV85p6Rqfp0Bu7K3+3222kz+3n5v7XIumQbN8b//n41xo9WQmtvJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766909860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1aEJsJtZBVxJrRPEh+nlisj5ebk8j6rCCqyg3gXkGII=; b=BDyVlML55IwgbuL9Un9gerO5ZAsb06YrO+WXLkWPUPBnvxLEQ1FxV4O4vb1zRVUMVb9poR 7xn3FQcX+xIwr6zCrmgBldHEiIb/ABImaT9AZxNhGmMnU3v/buY+ZFYqE3NqhnPKoZr14P mIOBVT+oDFT9kpMCQ5FDeP0uDuy0tOyf7zCt26IPo5EcfaNlLyt4XKJuwhLv1+BpH3m/hx b4klXaHn65h08ITWacRuFOJaxb5T8UjPEIpoEJXevcLJNFKeYusjW5TA2Pcq4n6UeUR4eq 9eFMxRBIfP1OvDd9a+v0HNCBNE9DMVd2yfkUDP30MwSA0CfUqo+Pdzl4hnCa9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766909860; a=rsa-sha256; cv=none; b=HQfbpVFAskajbZAZdo41MMiWbi1ka+jAZ6X+MajWR0FFEeNIN3bEXH17GD5Hr5QnwqeOt6 +p4wp78PgCEI83c03OuLhOiCEBTLpXTtMdoOcK+pXFZl9FLUNeeiBz5QFjBYGLWa+vbq5c X4eJTyJRHNPN2tap2PbAGZuV2y0WS2WUqeSrfNAHuJKPXpfpJ9e9p95N4iUbwP5xra5ZaT HdrGpqv38MCdMX1mMjxVXnK5iYIKY7qYM9Imja3aSBSlYtk3DnRUjvRvEJ6bBirCNrRKmL t6T5s1UhOWlaZc0Y+h36BqzjP8YKOW/e0PZ+zBawA3Im69ICRxfVUbwxEMYLTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dfBzl5kW8zcS2 for ; Sun, 28 Dec 2025 08:17:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b044 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Dec 2025 08:17:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: faeaa25f5624 - main - kernel: MK_REPRODUCIBLE_PATHS for full paths vs /usr/src 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: faeaa25f562493370a5da84b429ab0a117c3213a Auto-Submitted: auto-generated Date: Sun, 28 Dec 2025 08:17:39 +0000 Message-Id: <6950e7a3.3b044.1eb2b705@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=faeaa25f562493370a5da84b429ab0a117c3213a commit faeaa25f562493370a5da84b429ab0a117c3213a Author: Warner Losh AuthorDate: 2025-12-28 07:31:05 +0000 Commit: Warner Losh CommitDate: 2025-12-28 08:16:39 +0000 kernel: MK_REPRODUCIBLE_PATHS for full paths vs /usr/src There are many environments that you do not want the paths to be canonicalized. For example, if I always build a product from a specific path in a jail that's dependent on the product version, I don't want that to be sanitized to /usr/src because when I have profiling tools run against multiple kernels, I can't do A/B testing and results processing if everything points to /usr/src (sadly, the profiling tools cannot remap back to the original like gdb can). Since we need both active at the same time, symbloic link fallbacks don't work. We do want the rest of the build to be reproducible, however. We'll get the same binaries if we rebuild later since we always rebuild with the same path. Turn them both on for maximum reproduction for environments where that cannot be guaranteed. Sponsored by: Netflix Input from: emaste, ivy Differential Revision: https://reviews.freebsd.org/D52959 --- share/man/man5/src.conf.5 | 9 ++++++++- share/mk/bsd.debug.mk | 2 +- share/mk/src.opts.mk | 1 + sys/conf/kern.opts.mk | 1 + sys/conf/kern.post.mk | 2 +- sys/conf/kmod.mk | 2 +- tools/build/options/WITH_REPRODUCIBLE_PATHS | 6 ++++++ 7 files changed, 19 insertions(+), 4 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 1d55ab074a45..a047dfb528fd 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd December 21, 2025 +.Dd December 28, 2025 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1590,6 +1590,13 @@ option. Exclude build metadata (such as the build time, user, or host) from the kernel, boot loaders, and uname output, so that builds produce bit-for-bit identical output. +.It Va WITH_REPRODUCIBLE_PATHS +Modify the paths encoded in binary artifacts to be standard path + +Normaly, the actual path is encoded in the binary. However, this makes the build +differ depending on the path it was built from. With this option enabled, the +paths recorded are /usr/src, regardless of the actual path. With this option +disabled, the actual paths are recorded. .It Va WITHOUT_RESCUE Do not build .Xr rescue 8 . diff --git a/share/mk/bsd.debug.mk b/share/mk/bsd.debug.mk index cf2fb4356aef..9f4dc5d90484 100644 --- a/share/mk/bsd.debug.mk +++ b/share/mk/bsd.debug.mk @@ -16,7 +16,7 @@ MK_WERROR= no # If reproducible build mode is enabled, map the root of the source # directory to /usr/src and the root of the object directory to # /usr/obj. -.if ${MK_REPRODUCIBLE_BUILD} != "no" && !defined(DEBUG_PREFIX) +.if ${MK_REPRODUCIBLE_PATHS} != "no" && !defined(DEBUG_PREFIX) .if defined(SRCTOP) DEBUG_PREFIX+= ${SRCTOP:S,/$,,}=/usr/src .endif diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 0d806702417f..0805c88976da 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -217,6 +217,7 @@ __DEFAULT_NO_OPTIONS = \ MALLOC_PRODUCTION \ OFED_EXTRA \ OPENLDAP \ + REPRODUCIBLE_PATHS \ RPCBIND_WARMSTART_SUPPORT \ SORT_THREADS \ ZONEINFO_LEAPSECONDS_SUPPORT \ diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index cef4dd11ba58..81b117492916 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -56,6 +56,7 @@ __DEFAULT_NO_OPTIONS = \ KERNEL_RETPOLINE \ RATELIMIT \ REPRODUCIBLE_BUILD \ + REPRODUCIBLE_PATHS \ VERIEXEC # Some options are totally broken on some architectures. We disable them. If you diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 7cdfd17778db..343abc5853f7 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -372,7 +372,7 @@ _ILINKS+= x86 _ILINKS+= i386 .endif -.if ${MK_REPRODUCIBLE_BUILD} != "no" +.if ${MK_REPRODUCIBLE_PATHS} != "no" PREFIX_SYSDIR=/usr/src/sys PREFIX_OBJDIR=/usr/obj/usr/src/${MACHINE}.${MACHINE_CPUARCH}/sys/${KERN_IDENT} CFLAGS+= -ffile-prefix-map=${SYSDIR}=${PREFIX_SYSDIR} diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 6e20dce0653f..edc311348971 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -303,7 +303,7 @@ all: ${PROG} beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} -.if ${MK_REPRODUCIBLE_BUILD} != "no" +.if ${MK_REPRODUCIBLE_PATHS} != "no" PREFIX_SYSDIR=/usr/src/sys CFLAGS+= -ffile-prefix-map=${SYSDIR}=${PREFIX_SYSDIR} .if defined(KERNBUILDDIR) diff --git a/tools/build/options/WITH_REPRODUCIBLE_PATHS b/tools/build/options/WITH_REPRODUCIBLE_PATHS new file mode 100644 index 000000000000..e71ebff204d7 --- /dev/null +++ b/tools/build/options/WITH_REPRODUCIBLE_PATHS @@ -0,0 +1,6 @@ +Modify the paths encoded in binary artifacts to be standard path + +Normaly, the actual path is encoded in the binary. However, this makes the build +differ depending on the path it was built from. With this option enabled, the +paths recorded are /usr/src, regardless of the actual path. With this option +disabled, the actual paths are recorded.