freebsd-dev/sys/conf
Jessica Clarke 8a6ab0f71f Pre-quote macros passed to .incbin to avoid unwanted substitution
Currently for the MFS, firmware and VDSO template assembly files we pass
the path to include with .incbin unquoted and use __XSTRING within the
assembly file to stringify it. However, __XSTRING doesn't just perform a
single level of expansion, it performs the normal full expansion of the
macro, and so if the path itself happens to tokenise to something that
includes a defined macro in it that will itself be substituted. For
example, with #define MACRO 1, a path like /path/containing/MACRO/in/it
will expand to /path/containing/1/in/it and then, when stringified, end
up as "/path/containing/1/in/it", not the intended string. Normally,
macros have names that start or end witih underscores and are unlikely
to appear in a tokenised path (even if technically they could), but now
that we've switched to GNU C as of commit ec41a96daa ("sys: Switch the
kernel's C standard from C99 to GNU99.") there are a few new macros
defined which don't start or end with underscores: unix, which is always
defined to 1, and i386, which is defined to 1 on i386. The former
probably doesn't appear in user paths in practice, but the latter has
been seen to and is likely quite common in the wild.

Fix this by defining the macro pre-quoted instead of using __XSTRING.
Note that technically we don't need to do this for vdso_wrap.S today as
all the paths passed to it are safe file names with no user-controlled
prefix but we should do it anyway for consistency and robustness against
future changes.

This allows make tinderbox to pass when built with source and object
directories inside ~/path-with-unix, which would otherwise expand to
~/path-with-1 and break.

PR:	272744
Fixes:	ec41a96daa ("sys: Switch the kernel's C standard from C99 to GNU99.")
2023-07-28 05:08:43 +01:00
..
config.mk config.mk: All options in DEFAULTS are now defined in opt_global.h 2022-10-24 12:13:04 -06:00
dtb.build.mk dtb: Be much less verbose in the building of dtb 2022-10-29 10:13:54 -06:00
dtb.mk
files base: Remove support for the VTOC8 partitioning scheme 2023-07-26 13:16:12 +02:00
files.amd64 superio+ncthwm: Add hardware monitoring support 2023-07-01 11:19:53 -06:00
files.arm zfs: merge openzfs/zfs@431083f75 2023-04-03 16:49:30 +02:00
files.arm64 arm64: Enable the Hyper-V keyboard driver 2023-06-21 13:17:40 +01:00
files.i386 Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
files.powerpc Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
files.riscv Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
files.x86 ipmi: add Block Transfer interface support 2023-06-07 12:30:47 +03:00
kern.mk sys: Switch the kernel's C standard from C99 to GNU99. 2023-07-01 12:21:13 -07:00
kern.opts.mk kern.opts.mk: rationalize i386 EFI default with src.opts.mk 2023-05-12 11:04:00 -04:00
kern.post.mk Pre-quote macros passed to .incbin to avoid unwanted substitution 2023-07-28 05:08:43 +01:00
kern.pre.mk Pre-quote macros passed to .incbin to avoid unwanted substitution 2023-07-28 05:08:43 +01:00
kmod_syms_prefix.awk
kmod_syms.awk
kmod.mk Pre-quote macros passed to .incbin to avoid unwanted substitution 2023-07-28 05:08:43 +01:00
kmod.opts.mk
ldscript.amd64
ldscript.arm
ldscript.arm64
ldscript.i386
ldscript.kmod.amd64
ldscript.kmod.i386
ldscript.powerpc
ldscript.powerpc64
ldscript.powerpc64le
ldscript.powerpcspe
ldscript.riscv
Makefile.amd64 Clarify DTR_ENABLED make variable 2023-01-12 11:03:49 -04:00
Makefile.arm
Makefile.arm64 arm64: Use FULLKERNEL instead of .ALLSRC in .bin target 2023-04-18 11:41:57 -04:00
Makefile.i386
Makefile.powerpc
Makefile.riscv riscv: always include frame pointer 2023-01-12 11:04:24 -04:00
newvers.sh kern.post.mk allow NEWVERS_{ENV,ARGS} 2023-07-17 12:03:35 -07:00
NOTES base: Remove support for the VTOC8 partitioning scheme 2023-07-26 13:16:12 +02:00
options base: Remove support for the VTOC8 partitioning scheme 2023-07-26 13:16:12 +02:00
options.amd64 x86: Add MPTABLE_LINUX_BUG_COMPAT option 2022-10-17 23:02:22 -07:00
options.arm arm: Remove useless armv6/armv7 options 2022-10-20 10:48:31 -06:00
options.arm64 arm64: emulate swp/swpb instructions 2023-05-15 10:42:10 -05:00
options.i386 x86: Add MPTABLE_LINUX_BUG_COMPAT option 2022-10-17 23:02:22 -07:00
options.powerpc
options.riscv riscv: retire the FPE kernel option 2023-05-02 15:01:31 -03:00
std.nodebug
sysent.mk
systags.sh
vdso_amd64_ia32.ldscript spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vdso_amd64.ldscript spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
WITHOUT_SOURCELESS
WITHOUT_SOURCELESS_HOST
WITHOUT_SOURCELESS_UCODE retire cp(4) driver 2022-12-13 15:24:52 -05:00