Find a file
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
.cirrus-ci Cirrus-CI: add some timing info on pkg install failure 2021-08-04 15:02:00 -04:00
.github MAINTAINERS: Add myself to stand 2023-05-07 22:30:10 -06:00
bin ls: Improve POSIX compatibility for -g and -n. 2023-07-18 10:03:09 -07:00
cddl dtrace: Add WITH_DTRACE_ASAN 2023-07-27 16:07:34 -04:00
contrib arm64 lib32: change clang to allow -m32 on arm64 2023-07-25 18:58:51 -05:00
crypto sshd: do not resolve refused client hostname 2023-07-20 14:56:20 -07:00
etc etc: Automatically generate BSD.lib${libcompat}.dist lists 2023-07-27 05:10:44 +01:00
gnu Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
include arm64 lib32: prepare arm64 headers to redirect to arm 2023-07-25 18:59:26 -05:00
kerberos5 kerberos5: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT 2023-07-09 18:49:21 +01:00
lib msun: Fix typo in math_private.h comment 2023-07-27 02:21:44 +08:00
libexec libexec: Automatically generate rtld-elf list and generalise TAGS 2023-07-27 05:10:45 +01:00
release release: Fix make :@ modifier syntax 2023-07-27 08:36:12 +01:00
rescue Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
sbin Add diagnostics to fsck_ffs(8) for journaled soft-updates debugging. 2023-07-26 14:50:02 -07:00
secure libcrypto: add missing symbols to the FIPS provider 2023-07-20 15:05:12 -04:00
share mk: fix unnecessary library relinking with incremental builds 2023-07-27 14:55:16 -07:00
stand base: Remove support for the VTOC8 partitioning scheme 2023-07-26 13:16:12 +02:00
sys Pre-quote macros passed to .incbin to avoid unwanted substitution 2023-07-28 05:08:43 +01:00
targets local.dirdeps.mk skip N_host_libs for non-FreeBSD host 2023-05-04 11:58:39 -07:00
tests mac_ipacl: new MAC policy module to limit jail/vnet IP configuration 2023-07-26 00:07:57 +00:00
tools dtrace: Add WITH_DTRACE_ASAN 2023-07-27 16:07:34 -04:00
usr.bin netstat -i: compute most field widths dynamically 2023-07-26 10:56:52 -05:00
usr.sbin etcupdate: Remove redundant semicolons 2023-07-27 07:55:13 +01:00
.arcconfig arcanist: use FreeBSD/git project repository instead of FreeBSD/svn 2022-08-23 14:16:41 +00:00
.arclint arc lint: ignore /tests/ in chmod 2017-12-19 03:38:06 +00:00
.cirrus.yml Cirrus-CI: use llvm16 job by default and make llvm15 manual 2023-06-22 20:26:34 -04:00
.clang-format clang-format: Add bitset loop macros 2021-09-21 12:08:01 -04:00
.git-blame-ignore-revs Add git-blame ignore file 2023-01-23 15:27:25 -05:00
.gitattributes Add a basic clang-format configuration file 2019-06-07 15:23:52 +00:00
.gitignore .gitignore: Ignore LSP generated .cache 2023-03-07 10:04:18 -05:00
CONTRIBUTING.md CONTRIBUTING.md: reinsert double spaces 2023-07-10 12:24:24 -06:00
COPYRIGHT Happy New Year 2023! 2023-01-01 13:44:43 +08:00
LOCKS LOCKS: update current locks 2018-06-09 03:08:04 +00:00
MAINTAINERS MAINTAINERS: Add myself to stand 2023-05-07 22:30:10 -06:00
Makefile Makefile.inc1: Add new buildetc and installetc targets 2023-07-27 05:10:49 +01:00
Makefile.inc1 Makefile.inc1: Fix list-old-libs by deleting stray pipe 2023-07-28 00:14:19 +01:00
Makefile.libcompat arm64 lib32: enable building of lib32 on arm64 2023-07-25 18:59:52 -05:00
Makefile.sys.inc AUTO_OBJ: For all top-level targets enforce using an OBJDIR. 2017-12-05 21:29:47 +00:00
ObsoleteFiles.inc ObsoleteFiles.inc: Automatically generate OpenSSL 3 obsoleted libcompat dirs 2023-07-27 05:10:44 +01:00
README.md README.md: link to the list of supported platforms 2022-11-01 12:20:55 -03:00
RELNOTES RELNOTES: add a note about lua config files in loader 2023-07-24 23:35:25 -05:00
UPDATING UPDATING: Update nvd info 2023-07-24 22:32:39 -06:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Various commands and libraries under the Common Development and Distribution License.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc.
gnu Commands and libraries under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see gnu/COPYING and gnu/COPYING.LIB for more information.
include System include files.
kerberos5 Kerberos5 (Heimdal) package.
lib System libraries.
libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Regression tests which can be run by Kyua. See tests/README for additional information.
tools Utilities for regression testing and miscellaneous tasks.
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.