100 Commits
Author SHA1 Message Date
Simon J. Gerraty b22b999afc libsecureboot restore default trust anchors
If site.trust.mk does not set VE_SIGNATURE_LIST
initialize it based on content of VE_SIGNATURE_EXT_LIST
which is in turn initialized from TRUST_ANCHORS.

Sponsored by:	Hewlett Packard Enterprise Development LP

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61245
2026-11-05 16:27:00 -08:00
Simon J. Gerraty 9ca2cfeb4e libsecureboot: add support for more signatures
For 2027 we need to support new, stronger signatures and hashes.

Re-work Makefile.inc and local.trust.mk to define
VE_SIGN_URL_LIST or VE_SIGNATURE_LIST (can be derrived from
VE_SIGN_URL_LIST) containing tuples of sig/method/hash/flags and
for VE_SIGN_URL_LIST the same plus /url.

From VE_SIGNATURE_LIST we derrive VE_SIGNATURE_EXT_LIST used to populate
signature_ext_list which defines the order in which we look for
signatures for a manifest.

We also populate signature_info_list which maps a signature ext to the
needed hash and flags to indicate whether that hash needs to be repeated.

verify_sig will lookup signature_info_list, no match means not
supported.  For asc we just call verify_asc() otherwise we call
verify_ec() or verify_rsa() depending on the key type found in the
certificate chain, we pass the signature_info entry to these so they
know which hash to use and whether to repeat it.

The need to repeat the hash is a consequence of sending a hash to a
server using signature methods that insiste on hashing their input.
To-date only our original ECDSA signatures use this.
A FakeHash class added in 2012 avoids that wrinkle.

This is a much more flexible arrangement and should be more
readily usable by others.

Sponsored by:	Hewlett Packard Enterprise Development LP.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61007
2026-11-04 15:07:09 -08:00
Simon J. Gerraty 34e92fb6bd hooks.sh allow running DebugO{n,ff} from hooks_run
We need to watch out for _debugO{n,ff}_hooks.

Also add add_list (hook lists are just lists).

Fix bug in hooks_has() - should look for $2 in list.
2026-10-13 16:59:32 -07:00
Simon J. Gerraty 064edc2ceb debug.sh avoid trouble from set -e
The setting of _TTY ran afoul of set -e.

Also the handling of Myname blew up if debug.sh included by
a login sheel (eg in .profile).

For non-posix shell, leave false alone if it is a builtin.
2026-10-13 16:08:15 -07:00
Simon J. Gerraty 5efc40dd13 safe_eval.sh: safe_set_var add allow list for values
Complete the controls with -v "values":

sh ./safe_eval.sh set_var -a "knob" -v "no yes" knob=yes knob=no knob=ok ok=yes
knob=yes
knob=no
denied value 'ok' for 'knob'
denied variable 'ok'
2026-10-13 16:05:21 -07:00
Simon J. Gerraty 58a8f100a6 safe_eval.sh: safe_set_var use [:space:] if possible
Also use $ssv_extra$ssv_only as the default for $ssv_only has '-'
which must be last in the character class.
2026-10-11 14:55:11 -07:00
Simon J. Gerraty 7c75c96d17 safe_eval.sh: safe_set_var avoid positional args
Use options to set ssv_{allow,only,extra}
Improve the documentation.
Add a test harness for safe_set_var.
2026-10-11 11:12:59 -07:00
Simon J. Gerraty 9f0432041b safe_eval.sh fix description of safe_set_var returns.
The description was out of sync wrt return values.
1. invalid var
2. invalid val
3. var not in allowed list
2026-10-10 23:05:52 -07:00
Simon J. Gerraty 475e3bc18a safe_eval.sh: add safe_set_var
Get the log message right!
Fix default allowed chars (untabify clobbered TAB)
Add a couple more : messages to help debugging.
2026-10-10 22:55:16 -07:00
Simon J. Gerraty 0fa0966b6a safe_eval.sh add safe_var_set
safe_var_set can be used to safely handle var=val args from command line.
eg.

	while :
	do
		case "$1" in
		*=*)	# eval "$1" can be very dangerous
			# safe_var_set will only eval if
			# both var and value are sane.
			if ! safe_var_set "$1"; then
				case "$?" in
				1) echo invalid variable name;;
				2) echo invalide value;;
				3) echo variabel not allowed;;
				esac
			fi
			shift
			;;
		*)	break
			;;
		esac
	done
2026-10-10 21:58:50 -07:00
Simon J. Gerraty 5dfe1956df Merge bmake-20260704
Merge commit 'e988c5eab5231646c612d35ff5b16122cebfbf6a'
2026-07-05 11:31:49 -07:00
Simon J. Gerraty e988c5eab5 Import bmake-20260704
Intersting/relevant changes since bmake-20260508

ChangeLog since bmake-20260508

2026-07-04  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260704

2026-07-03  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260703
	Merge with NetBSD make, pick up
	o meta.c: do a better job of resolving relative paths
	o var.c: add alternation support to :M
	eg. :M*{Makefile*,.mk} matches any *Makefile* or *.mk

2026-07-02  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260702
	Merge with NetBSD make, pick up
	o meta.c: .MAKE.META.FILTER can be used to more generally filter
	relevant content of .meta file in meta_oodate.

2026-06-19  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260619
	Merge with NetBSD make, pick up
	o make.1: fix description of .MADE it is a source not a target.

	* update mk files

2026-06-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260609
	Merge with NetBSD make, pick up
	o parse.c: allow semicolons and parentheses in dependency line
	expressions

mk/ChangeLog since bmake-20260508

2026-07-04  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260704

2026-07-03  Simon J Gerraty  <[email protected]>

	* dirdeps.mk: make use of alternation support in latest bmake
	when setting .MAKE.META.IGNORE_FILTER so we can get both
	Makefile.depend* and *.mk to make cache out-of-date.

2026-07-02  Simon J Gerraty  <[email protected]>

	* meta2deps.py: detect corrupted filemon data on Linux,
	caused by lost newlines.

2026-06-21  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260621

	* gendirdeps.mk: more debug output

	* meta.autodep.mk: remove extra } from GENDIRDEPS_ENV

2026-06-19  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260619

	* install-new.mk: for POSIX_SHELL we need .new*
	rather than just .new

2026-05-21  Simon J Gerraty  <[email protected]>

	* meta2deps.{py,sh}: skip pathnames with spaces - not worth the pain.
2026-07-05 11:22:31 -07:00
Simon J. Gerraty c37839dc7b meta.autodep.mk remove extra }
remove extra } from GENDIRDEPS_ENV

more debug output for gendirdeps.mk

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D57727
2026-06-21 12:19:29 -07:00
Simon J. Gerraty 7386c0675c Update dirdpes.mk et al
Update to latest dirdeps related makefiles.

dirdeps.mk tweaks useful for universe among other corner cases.
	   also additional filtering for bogus paths ending in /

gendirdeps.mk allow more debugging
	   also additional filtering for bogus paths ending in /

install-new.mk fix bug when isPOSIX_SHELL is true

meta2deps.?? handle file names with spaces by ignoring them

Reviewed by: stevek
Differential Revision:	https://reviews.freebsd.org/D57683
2026-06-19 13:29:25 -07:00
Simon J. Gerraty 389c124fec imgact_elf.c indicate that interpreter is an interpreter
Use a value that do_execve will ignore since there's nothing there to do.
With this we can set the 'indirect' flag on rtld, to prevent direct execution
being used to bypass the 'indirect' flag on python3:

root@vuefi:~ # /libexec/ld-elf32.so.1 /usr/bin/python3 -c 'print("pwned")'
pwned
root@vuefi:~ # veriexec -z enforce
root@vuefi:~ # /libexec/ld-elf32.so.1 /usr/bin/python3 -c 'print("pwned")'
/libexec/ld-elf32.so.1: Operation not permitted.
root@vuefi:~ #

load_file seems missnamed since it is only used by load_interp
so rename it to load_interp_file.

Reviewed by:	imp
Sponsored by:	Hewlett Packard Enterprise Development LP
Differential Revision:	https://reviews.freebsd.org/D57649
2026-06-19 13:21:46 -07:00
Simon J. Gerraty 701d7be6e4 Add test cases for safe_eval.sh
safe_set is the routine that does all the work.

In safe_set; if we replace one=`cmd arg` or two=$(cmd arg) add quotes
around the result eg. one="_cmd arg_"
Also lines containing `` or $() are too likely to result in syntax
errors, so just delete them.

Differential Revision:	https://reviews.freebsd.org/D56795
2026-05-18 10:51:18 -07:00
Simon J. Gerraty 1729d2f741 Merge bmake-20260508
Merge commit 'ef402bba84260816d3e8d6e2439b0bc7eddc9446'
2026-05-12 21:26:44 -07:00
Simon J. Gerraty ef402bba84 Import bmake-20260508
Intersting/relevant changes since bmake-20260313

ChangeLog since bmake-20260313

2026-05-08  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260508
	Merge with NetBSD make, pick up
	o make.1: fix description of '-' handling in jobs-mod
	by intenting it correctly.

2026-04-13  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260406
	Merge with NetBSD make, pick up
	o cleanup unnecessary parens

	* configure.in: add --with-save-dollars to control default for
	.MAKE.SAVE.DOLLARS - address FreeBSD PR 294436

mk/ChangeLog since bmake-20260313

2026-05-09  Simon J Gerraty  <[email protected]>

	* gendirdeps.mk: also apply ':S,/$,,' and ':C,/(\.[^.]*)$,\1,'
	when setting DIRDEPS prior to saving.

	* dirdeps.mk: when debugging it is handy to be able to skip
	recursing so if DEBUG_DIRDEPS contains 'norecurse' we will only
	process the immediate DIRDEPS.
	Also if DEBUG_DIRDEPS contains '-V' we process sections normally
	skipped when doing 'make -V'.
	o ensure we do not get duplicate build dirs due to someone
	adding a trailing '/' or '/.${TARGET_SPEC}' to a DIRDEPS entry.
	Add ':S,/$,,' when setting '__depdirs' and
	add ':C,/(\.[^.]*)$,\1,' when setting '__qual_depdirs'.

2026-04-24  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260424

	* Use MK_META_AUTODEP to control use of meta.autodep.mk
	so it can be used independently of MK_DIRDEPS_BUILD for
	bootstrapping.

	* sys.vars.mk (M_type): use :sh rather than :sh1 to avoid
	surprises in a .for loop.
2026-05-12 21:20:50 -07:00
Simon J. Gerraty 586838724e Remove PROC_CHECK_PRIV macro from sys_process.c
Just put the priv_check calls in the code.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D56864
2026-05-06 20:49:06 -07:00
Simon J. Gerraty 8334d46162 Fix typo in curthread 2026-05-05 13:14:36 -07:00
Simon J. Gerraty adad686222 mac_veriexec_priv_check block proc_write_*regs*
Writing to /proc/$pid/regs can also be leveraged to mess with memory.

Only allow a trusted process to do so.

Sponsored by: Hewlett Packard Enterprise Development LP.

Reviewed by:	olce
Differential Revision:	https://reviews.freebsd.org/D56763
2026-05-05 10:29:54 -07:00
Simon J. Gerraty 566cc00581 safe_set treat ':' and '#' differently
Treat '#' as a comment anywhere,
but ':' only at start of line.
2026-04-22 09:37:35 -07:00
Simon J. Gerraty 69cc351c4c safe_set ignore leading white-space
Also treate ':' at the start of a line as for '#'
ie. a comment.
2026-04-22 09:15:13 -07:00
Simon J. Gerraty e272f4a61e Fix default for .MAKE.SAVE_DOLLARS
NetBSD make defaults this to "yes",
bmake defauts it to "no" to retain the traditional behavior.

The default is dealt with in bmake's Makefile but that does not
address boot-strap.

For now, just change the ifdef in main.

PR: 294436
2026-04-13 10:38:50 -07:00
Simon J. Gerraty 35bbdfad28 Pass severity to vectx_open() rather than vectx_close()
file_loadraw() can have a need to load unverified files
like "dtrace_dof".  Allow severity_guess() to look at the filename
but if it returns less than VE_MUST check that the type is not
one we insist on verifying.

In vectx_open if severity < VE_MUST we can allow it to be unverified.
If passed VE_GUESS we call severity_guess().
Regardless, we record severity in ctx so it is available to vectx_close().

Sponsored by: Hewlett Packard Enterprise Development LP

Reviewed by:	khng
Differential Revision:	https://reviews.freebsd.org/D56297
2026-04-10 10:46:54 -07:00
Simon J. Gerraty de9fe28ab8 Allow passing xtras to safe_set
This allows safe_set to be leveraged in other contexts
where additional chars like '*' or '!' or even '\[\]' need to
be preserved in the result.
2026-04-10 09:11:21 -07:00
Simon J. Gerraty a371b008d1 Add boot_setenv
Move is_restricted_var() to libsa/environment.c so it can be leveraged
by boot_setenv called from subr_boot with not truted input.

Also, allow for local tuning via ENV_IS_RESTRICTED_ALLOWED_LIST and
ENV_IS_RESTRICTED_LIST

Sponsored by:	Hewlett Packard Enterprise Development LP.

Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D56287
2026-04-07 09:29:07 -07:00
Simon J. Gerraty b2751d956e We also get _HOST_OSREL from host-target.mk 2026-04-06 11:50:11 -07:00
Simon J. Gerraty 34a3834ead Merge bmake-20260313
Merge commit 'fe271bdb43cf88ee129d94c0e286fe618fd28e89'
2026-04-06 11:32:43 -07:00
Simon J. Gerraty fe271bdb43 Import bmake-20260313
Intersting/relevant changes since bmake-20251111

ChangeLog since bmake-20251111

2026-03-12  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260313
	Merge with NetBSD make, pick up
	o make: ensure .MAKE.SAVE_DOLLARS is initialized so makefiles like
	sys.vars.mk can test its value to know how to deal with macros
	that need to save '$' during ':='.

	* Makefile: default MAKE_SAVE_DOLLARS_DEFAULT to "no"
	for traditional behavior.

2026-03-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260310
	Merge with NetBSD make, pick up
	o unit-tests ensure TEST_MAKE is absolute path
	and tests that make symlink for ${MAKE} can run in parallel.

2026-03-03  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260303
	Merge with NetBSD make, pick up
	o job.c: MaybeSubMake: Look for expansion of ${.MAKE}
	and if necessary its basename, and only match if at start of line
	or preceded by space.

2026-02-28  Simon J Gerraty  <[email protected]>

	* Makefile: mark ${PROG} and ${OBJS} as .META
	MaybeSubMake will otherwise mistake them for sub-makes

	* VERSION (_MAKE_VERSION): 20260301
	Merge with NetBSD make, pick up
	o job.c: MaybeSubMake: skip control chars [@+-] at start of line
	when checking for ${MAKE}

2026-02-22  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260222
	o mk file update

2026-02-16  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260216
	Merge with NetBSD make, pick up
	o minor cleanups

2026-02-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260210
	Merge with NetBSD make, pick up
	o document that multiple variables can be set on command line.
	o move MaybeSubMake to job.c so it can be called on expanded
	commands for more accuracy and less overhead.
	o main.c: set .MAKE.VERSION as read-only.

	* unit-tests/opt-{chdir,where-am-i}.mk: use MAKEOBJDIRPREFIX=/
	to avoid tripping over an unreadable /usr/obj

2026-02-04  Simon J Gerraty  <[email protected]>

	* unit-tests/varname-make_stack_trace.mk: for
	FreeBSD and similar set .MAKE.ALWAYS_PASS_JOB_QUEUE=no
	to ensure we get the expected errors.

	* VERSION (_MAKE_VERSION): 20260202
	Merge with NetBSD make, pick up
	o on error avoid duplicate stack trace to stderr

2026-01-11  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260111
	Merge with NetBSD make, pick up
	o var.c: add explicit check for empty re as not all
	regex libs throw an error as expected, in this case.

2026-01-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260110
	Merge with NetBSD make, pick up
	o minor cleanups

mk/ChangeLog since bmake-20251111

2026-03-12  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260313

	* sys.vars.mk: use .MAKE.VERSION
	M_type can simply use '$x'

2026-02-22  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260222

	* dirdeps.mk, sys.mk: add dependent option
	UPDATE_DIRDEPS_CACHE/DIRDEPS_CACHE.
	It can be useful to use -DWITHOUT_UPDATE_DIRDEPS_CACHE to
	temporarily treat dynamic DIRDEPS_CACHE as static.

2026-01-10  Simon J Gerraty  <[email protected]>

	* meta.autodep.mk (${_DEPENDFILE}): add .NOMETA

2026-01-08  Simon J Gerraty  <[email protected]>

	* rust.mk: better accommodation for RUST_LIBS.
	Set RUST_{LIBS,PROGS}_CARGO_BUILD_OUTPUT_LIST to
	simplify staging.

2025-12-08  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20251207

	* sys.vars.mk: replace MAKE_POSIX_SHELL usage with isPOSIX_SHELL
	Using ${isPOSIX_SHELL:U:Nfalse} provides a boolean for make
	and ${isPOSIX_SHELL:Ufalse} does the same for target scripts.
	Both will be false if isPOSIX_SHELL is not set or set to false.

	This has the advantage that if only POSIX shells are expected
	sys.mk (or something it includes) can simply do isPOSIX_SHELL?=:
2026-04-06 11:25:05 -07:00
Simon J. Gerraty 9fed072b44 bsd.man.mk simplify staging
We actually only need the high level targets stage_files and stage_links
meta.stage.mk will take care of the details.
2026-01-10 18:59:20 -08:00
Simon J. Gerraty 9cd89fc5aa bsd.man.mk fix staging
The STAGE_SETS and STAGE_TARGETS need to match
STAGE_DIR.

For each STAGE_SET we have STAGE_DIR.${STAGE_SET}
and create a target stage_files.${STAGE_SET},
the settings all need to be self consistent to work.
2026-01-10 18:44:40 -08:00
Simon J. Gerraty 9bbb08f905 Update share/mk files from bmake
Update to the latest makefiles etc from bmake.
Mostly this just replaces sjg license with an SPDX tag.

There are also some improvements to meta2deps* and optimizations
to leverage POSIX shell features in some target scripts.
Default isPOSIX_SHELL to ':' in sys.mk to enable these.

Use :sh1 in M_type if possible.

bsd.progs.mk has diverged too much to touch beyond making the
SPDX tag update.

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D54150
2025-12-09 21:06:31 -08:00
Simon J. Gerraty c60f6422ff Update to bmake-20251111
Merge commit '638c66de4a0faa4c2e815e81cd4021c2387c7e0f'
2025-12-03 10:15:46 -08:00
Simon J. Gerraty 638c66de4a Import bmake-20251111
Intersting/relevant changes since bmake-20250804

ChangeLog since bmake-20250804

2025-11-15  Simon J Gerraty  <[email protected]>

	* boot-strap: unset more things from env and save a copy
	to env.out for debugging.

2025-11-12  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20251111
	Merge with NetBSD make, pick up
	o var.c: add :sh1 which only evaluates command on first reference.

2025-11-11  Simon J Gerraty  <[email protected]>

	* configure.in: Force filemon=no for Cygwin and MINGW64_NT

2025-11-10  Simon J Gerraty  <[email protected]>

	* unit-tests/Makefile: handle MINGW64_NT
	mark some tests broken, filter others as per Cygwin.

2025-10-23  Simon J Gerraty  <[email protected]>

	* make.1: document MAKE_VERSION.

2025-10-22  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20251022

	* configure.in: Add a check that lua is version 5.2 or later
	if not we want to skip running check-expect.lua

2025-09-16  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250916
	Merge with NetBSD make, pick up
	o var.c: avoid compiler warning from hexdigits

mk/ChangeLog since bmake-20250804

2025-11-18  Simon J Gerraty  <[email protected]>

	* sys.vars.mk: set MAKE_POSIX_SHELL to 1 if .SHELL is POSIX, 0 if not.
	set isPOSIX_SHELL for use in target scripts.

	* meta.stage.mk: set MAKE_POSIX_SHELL if needed.

	* install-new.mk: use ${isPOSIX_SHELL:Ufalse} to see if we can
	avoid running 'expr'.

	* install-new.mk: Allow use of cp or mv - controlled by CPMV_OP
	(default mv).

2025-11-13  Simon J Gerraty  <[email protected]>

	* sys.vars.mk: add M_sh1 so we can handle older bmake that does
	not support :sh1

2025-11-11  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20251111

	* meta2deps.sh: reset some vars for each new meta file
	set meta_file to path of meta file.
	If meta2deps appears in DEBUG_SH set -x.

2025-09-16  Simon J Gerraty  <[email protected]>

	* options.mk: Add OPTIONS_DEFAULT_DEPENDENT_REQUIRED of the form
	OPTION/REQUIRED[/VALUE]
	if OPTION is $VALUE (default is "yes"), then REQUIRED must be too.
	We add OPTIONS_DEFAULT_DEPENDENT_REQUIRED (sans any /{yes,no}) to
	OPTIONS_DEFAULT_DEPENDENT so DEPENDENT/REQUIRED follow the same
	processing.

	Also add OPTIONS_FORCED_VALUES of the form OPTION/{yes,no}
	we add any OPTIONS_FORCED_NO and OPTIONS_FORCED_YES before
	processing.

	Simplify the processing of OPTIONS_DEFAULT_VALUES and
	OPTIONS_DEFAULT_DEPENDENT by splitting the tuples and use two
	iterator variables in the .for loops.

2025-08-09  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250808

	* replace sjg license with just BSD-2-Clause SPDX tag
2025-12-03 09:57:57 -08:00
Simon J. Gerraty a797702be0 rc.subr set dot_dir and dot_file in dot
Files read by '.' cannot workout for themselves where they are
or what they are called, so set dot_dir and dot_file to pass
this information to them.

Reviewed by:	obrien, stevek
Differential Revision:	https://reviews.freebsd.org/D53476
2025-10-30 11:09:13 -07:00
Simon J. Gerraty 027be99b1f Stub is_tftp when LOADER_NET_SUPPORT is not enabled
common/misc.c is a non-optional part of loader.
If LOADER_NET_SUPPORT is not defined provide a stub that always returns
false.

Reviewed by:	kevans, des
Differential Revision:	https://reviews.freebsd.org/D52060
2025-08-21 08:08:53 -07:00
Simon J. Gerraty 5bfb3045d2 Allow secure-netboot
When doing file verification, tftp needs to be able to handle multiple
open files concurrently.
We also need tftp_stat() to provide useful values for st_dev and st_ino.

Allow an architecture to define NETPROTO_DEFAULT.
The default is NET_NFS for backwards compatability.

In net_parse_rootpath() fix parsing of
<scheme>://<ip>[:<port]/<path>
and ensure we return INADDR_NONE unless we successfully
parsed an addr, so we don't end up clobbering rootip obtained
from bootp().

Sponsored by:   Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51187
2025-08-20 15:49:53 -07:00
Simon J. Gerraty b44cc1b479 loader: do not try to open directories with TFTP
Attempting to mount or even open / with some tftp servers
causes a several minute delay in boot.

Since opening a directory via TFTP does not make sense, we
avoid it.  We don't know if using TFTP until after net_open()
has been called.

Add an is_tftp() accessor to avoid everyone having to include
all the net* headers.

Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51447
2025-08-20 15:45:54 -07:00
Simon J. Gerraty aaf65a13c0 stand: add fs_ops.fs_flag
To avoid a layering violation in open() allow fs_ops to
indicate that devopen() should be skipped.

This is only true for pkgfs.

Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51684
2025-08-20 15:42:35 -07:00
Simon J. Gerraty 787302bde4 Import bmake-20250804
Intersting/relevant changes since bmake-20250707

ChangeLog since bmake-20250707

2025-08-04  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250804
	Merge with NetBSD make, pick up
	o meta.c: allow printing only partial string to meta file
	in jobs mode, otherwise we end up with duplicated output when
	buffer does not end in newline.
	Add a suitable unit test.

mk/ChangeLog since bmake-20250707

2025-07-24  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250724

	* meta2deps: Allow X record to have 3 or 4 args.
	V4 filemon on Linux produces 3
	V5 filemon on FreeBSD produces 4

2025-07-22  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250721

	* meta2deps.{py,sh}: detect corrupted filemon output (an issue on
	Linux) by checking each record type has the correct number of
	words.  Throw an error if necessary so that gendirdeps.mk will not
	update Makefile.depend
2025-08-05 15:31:51 -07:00
Simon J. Gerraty 5c4d1c8584 Replace license with just SPDX BSD-2-Clause 2025-08-07 15:15:37 -07:00
Simon J. Gerraty b4894eca1a Merge bmake-20250804
Fixes bug in meta mode output capture.

Merge commit '787302bde4d89279180303b753eb73b9bc6820b9'
2025-08-05 15:57:12 -07:00
Simon J. Gerraty cae98cf683 install: allow ENV in metatags
The metatags file informs install of kernel and modules to load,
allow it to also case variables to be set in env.

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc
Differential Revision:	https://reviews.freebsd.org/D51446
2025-07-21 10:14:00 -07:00
Simon J. Gerraty 3717484168 bsd.subdir.mk skip _SUBDIR for DIRDEPS_BUILD
For DIRDEPS_BUILD we want to ignore _SUBDIR regardless of
.MAKE.LEVEL

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D51454
2025-07-21 09:11:44 -07:00
Simon J. Gerraty a8c56be471 Merge bmake-20250707
Merge commit '3d772e596c1acf76f555c1f51fd8d834e56b0c35'
2025-07-19 10:41:12 -07:00
Simon J. Gerraty 3d772e596c Import bmake-20250707
Intersting/relevant changes since bmake-20250618

ChangeLog since bmake-20250618

2025-07-07  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250707
	Merge with NetBSD make, pick up
	o cond.c: improve debug log message for 'exists' function.
	complain about unfinished escape sequences or string literals.

2025-07-04  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250704
	Merge with NetBSD make, pick up
	o make.1: add a DIAGNOSTICS section for make to reference.
	o main.c: simplify the warning for invalid -J by refering to
	manual page.

2025-06-30  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250630
	Merge with NetBSD make, pick up
	o consistently use double quotes in error messages
	o cond.c: if a condition is erroneous, skip the whole .if/.endif
	o make_malloc.c: in cleanup mode, initialize freshly allocated memory
	o str.c: error out on an ":M" modifier whose pattern ends with
	backslash
	o var.c: fix parsing of modifier parts for :gmtime and :localtime
	add POSIX $^ support

mk/ChangeLog since bmake-20250618

2025-07-04  Simon J Gerraty  <[email protected]>

	* prog.mk: .MADE is a special source not a target!
2025-07-19 10:08:57 -07:00
Simon J. Gerraty e67aef4190 Add DEBUG_PRINTF to stand.h
stand/ is mostly debugged with printfs, in an ad hoc and sometimes
fragile manner. For example BOOTP_DEBUG in bootp.c cannot be defined
unless NETIF_DEBUG is defined in dev_net.c or build fails for lack of the
symbol debug.

The DEBUG_PRINTF implementation in stand.h addresses that and allows
for more control over debug output.  It is compatible with the
usage in libsecureboot.

Simply define _DEBUG_LEVEL to the desired level of debug
or in the case of libsecureboot _DEBUG_LEVEL_VAR to the variable that
will hold that value - default is _debug which is static so each
translation unit can be controlled independently.

The 1st arg to DEBUG_PRINTF is a level which must be greater than or
equal to _DEBUG_LEVEL_VAR if the printf is to be called.
See libsecureboot for more examples.

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51269
2025-07-17 16:36:17 -07:00
Simon J. Gerraty d1f0ee548c Allow net_cleanup for loader.efi
While netbooting with loader.efi on at least one arm64 platform
which uses u-boot emulating UEFI, the kernel gets corrupted, we
suspected the u-boot ethernet driver was still running.

Use netdev.dv_cleanup for efinet_dev to address this.

This in turn requires calling dev_cleanup() before bi_load() to avoid
a loader crash since bi_load() calls ExitBootServices.

Reviewed by:	imp
Sponsored by:   Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51186
2025-07-10 11:14:38 -07:00
Simon J. Gerraty 4f8f2bc294 Import bmake-20250618
Intersting/relevant changes since bmake-20250414

ChangeLog since bmake-20250414

2025-06-18  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250618
	Merge with NetBSD make, pick up
	o parse.c: in a warning without location information,
	print the stack trace

2025-06-15  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250615
	Merge with NetBSD make, pick up
	o add on-demand inter-process stack traces
	o job.c,meta.c: do not discard empty lines in the output of a command
	o job.c: add job prefix if necessary in non-default filtered mode
	o parse.c,var.c: skip inter-process stack trace when
	MAKE_STACK_TRACE=no

2025-06-12  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250612
	Merge with NetBSD make, pick up
	o use a common style for unexpected error messages
	o parse.c: add program name to stack traces from sub-makes
	add quotes to "in directory" line in stack traces
	o var.c: check variable names for invalid characters when there
	are no modifiers to apply.  This detects and warns about gmake
	syntax like: $(addprefix -I, $(LIST))

2025-06-09  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250606
	Merge with NetBSD make, pick up
	o main.c: fix bug in handling of output of children in jobs mode

2025-05-28  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250528
	Merge with NetBSD make, pick up
	o show contents of MAKEFLAGS in the stack trace.
	o main.c: delay warning about bogus -J flag, if we end up in
	compat mode before the call to InitMaxJobs, the warning isn't
	necessary.

2025-05-25  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250525
	Merge with NetBSD make, pick up
	o main.c: set .CURDIR earlier so it can be reported in some errors.

2025-05-20  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250520
	Merge with NetBSD make, pick up
	o rename variables, remove now-redundant comments
	o job.c: clean up building the shell commands in parallel mode
	remove timeout for polling in parallel mode
	o main.c: clean up error message for malformed internal -J option

2025-05-11  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250511
	Merge with NetBSD make, pick up
	o job.c: rename token pool variables to be more descriptive
	move ContinueJobs further up, to eliminate a forward declaration
	error out if writing to an internal pipe fails
	clean up constant names and function names
	use uniform debug log messages for the token pool
	in the debug log, replace magic numbers with identifiers
	o main.c: clean up error message for malformed internal -J option
	o make.c: replace bitset in trace output with descriptive node
	attributes
	o targ.c: add end marker for -dg1, -dg2 and -dg3 debug log
	o var.c: fix order of error messages in the ":?" modifier

2025-04-25  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250424
	Merge with NetBSD make, pick up
	o cleanup; replace unsigned int with just unsigned
	Inline the TMPPAT macro, as it is only needed in a single place
	o move struct Job from job.h to job.c
	o job.c: group the code for handling the job token pool
	avoid excessive values of -j
	o make.c: fix grammar in debug log message

mk/ChangeLog since bmake-20250414

2025-05-28  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250528

	* add dirdeps2dplibs.mk

2025-05-18  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250518

	* meta.autodep.mk (META_FILES): re-work to fix filtering.
	if OPTIMIZE_OBJECT_META_FILES==yes
	provide a default META_FILE_OBJ_FILTER that selects a valid
	.SUFFIX to match *o.meta, there's no guarantee that it will be as
	simple as .o or .So etc.
	We have to defer evaluation until the target script is run
	for any of these filters to have any effect.
	Use :S,${.OBJDIR}/,, rather than :T incase there are objects
	in sub-dirs.

	* lib.mk: leverage ${.SUFFIXES} when setting dependencies.

	* add UPDATE_DEPENDFILE as a dependent option - follows
	DIRDEPS_BUILD and use MK_UPDATE_DEPENDFILE as default for
	UPDATE_DEPENDFILE when we think it should be yes.
	This allows override with -DWITH[OUT]_UPDATE_DEPENDFILE
	without overriding UPDATE_DEPENDFILE directly - which can lead to
	trouble.

2025-05-16  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250515

	* meta2deps.py: resolve the target of a Move or Link first
	and track the last path resolved, then if the src is a relative
	path we can easily use that last path to resolve the src correctly.

	* meta2deps.sh: for a Move or Link add the dir of target path to
	the list used to resolve the src path.
2025-06-27 19:38:49 -07:00
Simon J. Gerraty 0b46a53a2f Merge bmake-20250618 2025-06-27 19:49:16 -07:00
Simon J. Gerraty ac05fc3953 local.dirdeps.mk remove stray .endif 2025-06-04 20:35:59 -07:00
Simon J. Gerraty bf407f36c5 local.dirdeps.mk move MK_RUN_TESTS .endif
The MK_RUN_TESTS check should bound all of the logic
relevant to hooking tests into the graph.
2025-06-04 20:27:39 -07:00
Simon J. Gerraty 8e1e989c77 Add host.test.mk for DIRDEPS_BUILD
If we are doing DIRDEPS_BUILD and MK_RUN_TESTS is yes
we can hook tests associated with dirs to be built into the graph
such that we avoid circular dependencies but the build will fail
should any test fail.

Make MK_RUN_TESTS independent of MK_TESTS
also for non-DIRDEPS_BUILD ensure we have RELDIR and check it
against patterns in HOST_RUN_TESTS.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D50387
2025-06-04 12:56:44 -07:00
Simon J. Gerraty a40d73475b Export SB_OBJROOT for later reference
The build varies MAKEOBJDIRPREFIX at times which
can make it difficult to track the original OBJROOT.
This is easier when we get the original from env as SB_OBJROOT.
If SB_OBJROOT did not come from env, set and export it
the first time we set OBJROOT.

This allows SB_OBJROOT to be used in .MAKE.META.IGNORE* variables
to tweak what should be considered as making a target out-of-date.

Update auto.obj.mk to latest from contrib/bmake - handles relative
objdirs more simply and reliably.

Also update jobs.mk and stage-install.sh

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D50313
2025-06-03 12:55:18 -07:00
Simon J. Gerraty 61d77e6c00 loader: allow for exceptions to restricted settings.
We restrict what an unverified loader.conf etc can set,
and the same restrictions are applied to interactive input.
We need to allow for exceptions (eg boot_verbose).
It is best if any allowed settings match up to '='.

If we do not allow it to be set, do not allow it to be unset

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
2025-06-01 22:48:43 -07:00
Simon J. Gerraty f9890204b5 install: must set netproto for tftp://
tftp_open requires netproto is NET_TFTP

Reviewed by:	stevek
2025-06-01 22:28:21 -07:00
Simon J. Gerraty b0ada425ef safe_eval allow : and + in values 2025-05-25 20:06:47 -07:00
Simon J. Gerraty 2982c70852 stand allow for local.defs.mk
This allows us to change the VERSION_FILE used for loaders
as well as set NEWVERS_DATE and BUILD_UTC to reflect the publish
date of loaders for secure-boot.

Sponsored by:	Juniper Networks, Inc.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D50478
2025-05-22 15:47:21 -07:00
Simon J. Gerraty 41cf74fe8c loader - guard against empty rootdev
At least one instance of u-boot pretending to be EFI
is passing empty rootdev to loader which does not end well.

A simple precaution is harmless.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D50334
2025-05-20 09:10:50 -07:00
Simon J. Gerraty 496b3c3a1c grantbylabel_syscall check p_textvp != NULL
kernel process will not have valid p_textvp

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D50368
2025-05-16 15:19:06 -07:00
Simon J. Gerraty 759b177aec Merge bmake-20250414
Merge commit '284d1f7d496806b18558ab55e4654fd5e96d6a3e'
2025-04-19 13:59:16 -07:00
Simon J. Gerraty 284d1f7d49 Import bmake-20250414
Intersting/relevant changes since bmake-20250308

ChangeLog since bmake-20250308

2025-04-14  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250414
	Merge with NetBSD make, pick up
	o job.c: clean up job and output handling
	o parse.c: after entering POSIX mode, don't leave it again

2025-04-11  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250411
	Merge with NetBSD make, pick up
	o convert more messages to file:line: format
	o for.c: condense code for parsing variable names in .for loops

2025-04-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250410
	Merge with NetBSD make, pick up
	o cond.c: remove redundant error counter when parsing a condition

2025-04-04  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250404
	Merge with NetBSD make, pick up
	o make.1: better document meta mode.
	o var.c: fix error message for undefined variable in conditional.

2025-03-30  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250330
	Merge with NetBSD make, pick up
	o in POSIX compatability mode, give preference to sysV style modifiers.
	o in stack trace with details and includes, list the current file
	o parse.c: report file location in more common file:line: format.
	o var.c: simplify error handling for unknown modifiers
	let the ":O" and ":t" modifiers fall back to the ":from=to" modifier
	stop parsing after seeing an unknown modifier in an expression
	fix error message for unclosed expression and invalid :[...]
	add details to errors about ::= modifier
	add details about indirect modifiers to the stack traces
	in stack traces from target commands, add the command level

2025-03-23  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250323
	Merge with NetBSD make, pick up
	o var.c: just ignore attempts to override a read-only global with
	the same value.

mk/ChangeLog since bmake-20250308

2025-04-18  Simon J Gerraty  <[email protected]>

	* init.mk: include Skipping ${RELDIR} when _SKIP_BUILD is not empty.

2025-04-14  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250414

	* init.mk: check ONLY_*_LIST and NOT_*_LIST for SKIP_BUILD_VAR_LIST
	to set _SKIP_BUILD

	* genfiles.mk: add FILTER support

	* rst2htm.mk: latest docutils drops .py extensions

2025-03-26  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250326

	* auto.obj.mk: fix and simplify handling of relative __objdir,
	convert it to absolute before checking against .OBJDIR
2025-04-19 13:53:59 -07:00
Simon J. Gerraty cf5f0744cd Add .NOTMAIN to guard targets
Avoid make mistaking a guard target for the .MAIN one.
2025-04-19 12:57:41 -07:00
Simon J. Gerraty 62671aa7d5 libsecureboot: avoid noise when looking for tust anchors
PR: 286160
2025-04-19 12:29:30 -07:00
Simon J. Gerraty d9a65c5de1 Merge bmake-20250308 2025-03-19 14:10:44 -07:00
Simon J. Gerraty 397f57656d Import bmake-20250308
Intersting/relevant changes since bmake-20250125

ChangeLog since bmake-20250125

2025-03-08  Simon J Gerraty  <[email protected]>

	* bsd.after-import.mk: by default generate makefiles
	closer to BSD style.

	* VERSION (_MAKE_VERSION): 20250308
	Merge with NetBSD make, pick up
	o clean up comments and code for parallel mode
	o job.c: avoid SIGPIPE for children, call Job_Wait befor abort.

2025-02-27  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250225
	Merge with NetBSD make, pick up
	o job.c: reliably remove targets on interrupt,
	by passing signal to children first.

mk/ChangeLog since bmake-20250125

2025-03-14  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250314

	* meta.stage.mk: StageFiles --subdir: preserve the dir part of
	each file under $dest

2025-03-12  Simon J Gerraty  <[email protected]>

	* meta.autodep.mk: do a better job of handling MAKESYSPATH in
	GENDIRDEPS_ENV.  If we have MAKE_VERSION >= 20230123 we can just
	use .SYSPATH, otherwise it is a bit more complicated.
2025-03-19 14:01:12 -07:00
Simon J. Gerraty e9c2838d93 Add newlog.sh and setops.sh to share/mk
jobs.mk makes use of newlog.sh if found.

Set NEWLOG_SH in local.sys.env.mk to save jobs.mk searching for it.

PR:	284390
Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D48737
2025-02-11 09:42:17 -08:00
Simon J. Gerraty f8f5b658bc rc.subr:rc_trace take advantage of sdot
Since we now have sdot, use it to get RC_LEVEL from rc.conf.d/rc_trace
also avoid logging execution of ':' when RC_LEVEL > 0

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D48856
2025-02-10 14:23:38 -08:00
Simon J. Gerraty c8245ceb47 Update dirdeps.mk et al
Update dirdeps.mk and friends to match latest contrib/bmake/mk

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D48855
2025-02-10 14:20:06 -08:00
Simon J. Gerraty a69ac6ee79 Fix mangled bmake makefile 2025-01-30 17:02:45 -08:00
Simon J. Gerraty 6a7405f5a6 Merge bmake-20250125
Merge commit '5ad769f660f3d00853bc739f82d9bc62f6a682cb'
2025-01-30 15:51:52 -08:00
Simon J. Gerraty 5ad769f660 Import bmake-20250125
Intersting/relevant changes since bmake-20240711

ChangeLog since bmake-20240711

2025-01-25  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250125
	Merge with NetBSD make, sync up below change.

	* unit-tests/Makefile: remove $TMPDIR via .END
	to avoid failure in test on NFS - since the temp file for the
	target script is open and thus gets renamed by the server rather
	than removed.

2025-01-20  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250120
	Merge with NetBSD make, pick up
	o use FORK_FUNCTION so it can be forced to fork when doing coverage.
	o main.c: avoid memory allocation in error path after exec failure.

2025-01-16  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250116
	Merge with NetBSD make, pick up
	o clarify that undefined expressions are allowed in dependencies
	o simplify code for evaluating the '!=' variable assignment

2025-01-11  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250111
	Merge with NetBSD make, pick up
	o replace "Malformed conditional" with "Variable is undefined"
	when appropriate

2025-01-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250110
	Merge with NetBSD make, pick up
	o job.c: remove some unnecessary layers in job handling
	o unit-tests: test expressions based on undefined variables

2025-01-01  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20250101
	Merge with NetBSD make, pick up
	o var.c: reduce pointer indirections when unexporting a variable

2024-12-12  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20241212
	* mk/ updates

2024-11-24  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20241124
	Merge with NetBSD make, pick up
	o var.c: fix confusing error message when overriding a read-only
	variable

2024-11-22  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20241122
	Merge with NetBSD make, pick up
	o unit-tests/Makefile: optimize running of tests skip extra cat
	in 99% of cases.

2024-11-15  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20241114
	Merge with NetBSD make, pick up
	o make.1: note that MAKEOBJPREFIX should be absolute path
	also that it can be set via makefile if suitable care taken.

2024-11-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20241110
	Merge with NetBSD make, pick up
	o make: allow .../ (search here and above) in
	.MAKE.MAKEFILE_PREFERENCE and -f argument.

2024-11-03  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20241101
	Merge with NetBSD make, pick up
	o parse.c: report filename:linenumber in parse debug output

2024-09-21  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240921
	Merge with NetBSD make, pick up
	o make.1: Only list the defaults for MAKEFILE_PREFERENCE once.

	* Makefile: use genfiles.mk to generate ${MAN}
	so that it can be tuned for local site.
	Ensure MAN  is defined before including Makefile.inc

	* Makefile: use MK_GEN_MAN to make it easier to control whether we
	generate ${MAN}

2024-09-16  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240909

	* arch.c: fix NetBSD PR 58597

2024-09-01  Simon J Gerraty  <[email protected]>

	* Makefile: use SUBDIR.${MK_TESTS} so that we skip
	unit-tests for obj and clean when FreeBSD is building WITHOUT_TESTS

	* VERSION (_MAKE_VERSION): 20240901
	Merge with NetBSD make, pick up
	o reduce line length in error messages
	o var.c: simplify printing of an evaluation stack element

2024-08-29  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240828
	Merge with NetBSD make, pick up
	o add more context to error message about recursive variables
	o treat recursive variables non-fatally - continue parsing to end
	of makefile

2024-08-12  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240808
	Merge with NetBSD make, pick up
	o improve some error messages for better clarify and readability

2024-07-22  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240722
	Merge with NetBSD make, pick up
	o job.c: remove dead code

2024-07-21  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240720
	Merge with NetBSD make, pick up
	o compat.c: do not run commands that have parse or evaluation errors.
	o var.c: remove wrong error message about an undefined variable

mk/ChangeLog since bmake-20240711

2025-01-10  Simon J Gerraty  <[email protected]>

	* rust.mk: use RUST_LIBS and RUST_PROGS

2025-01-01  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20250101

	* use W flag to :S and :C rather than :tW

2024-12-16  Simon J Gerraty  <[email protected]>

	* rust.mk: add RUSTFLAGS if needed

2024-12-12  Simon J Gerraty  <[email protected]>

	* init.mk (OBJS_SRCS_FILTER): apply this as
	${OBJS_SRCS_FILTER:ts:} as we do in FreeBSD.

2024-12-03  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20241202

	* setopts.sh: needed by newlog.sh

2024-11-22  Simon J Gerraty  <[email protected]>

	* meta.sys.mk: add META_MODE_XTRAS to META_MODE to make it
	easier to add things like 'env' when debugging.

	* install-mk (MK_VERSION): 20241122

	* rust.mk: rename CARGO* to RUST_CARGO* so I don't feel
	like this makefile should be renamed to cargo.mk

2024-11-11  Simon J Gerraty  <[email protected]>

	* dirdeps.mk: add DIRDEPS_CACHED_ENV to dirdeps-cached and
	DIRDEP_USE_EPILOGUE to _DIRDEP_USE

2024-10-30  Simon J Gerraty  <[email protected]>

	* meta.sys.mk: if MK_META_ERROR_TARGET is yes and NEWLOG_SH is
	set, and ERROR_LOGDIR already exists, hook _rotateErrorLog to
	.BEGIN target.

2024-10-27  Simon J Gerraty  <[email protected]>

	* options.mk: add support for DEBUG_OPTIONS (similar to
	DEBUG_DIRDEPS) to allow us to see where options get set.
	Eg. DEBUG_OPTIONS="STAGING*" gives:

	bmake[1]: "mk/options.mk" line 89: sys.mk: MK_STAGING=yes (MK_DIRDEPS_BUILD=no)
	bmake[1]: "mk/options.mk" line 66: local.init.mk: MK_STAGING=yes
	bmake[1]: "mk/options.mk" line 66: local.init.mk: MK_STAGING_PROG=no
	bmake[1]: "mk/options.mk" line 89: own.mk: MK_STAGING_MAN=yes (MK_STAGING=yes)
	bmake[1]: "mk/options.mk" line 89: own.mk: MK_STAGING_PROG=no (MK_STAGING=yes)
	bmake[1]: "mk/options.mk" line 89: own.mk: MK_STAGING_RUST=no (MK_STAGING_PROG=no)

	* own.mk: fix setting of STAGE_OBJTOP (normally set by sys.dirdeps.mk)

2024-10-26  Simon J Gerraty  <[email protected]>

	* rust.mk: add some documentation and support for staging

2024-10-25  Simon J Gerraty  <[email protected]>

	* rust.mk: a means of integrating Rust projects into a larger build.

2024-10-18  Simon J Gerraty  <[email protected]>

	* dirdeps-targets.mk: if DEBUG_DIRDEPS_TARGETS and we found
	STATIC_DIRDEPS_CACHE, report its relative path.

2024-09-30  Simon J Gerraty  <[email protected]>

	* dirdeps.mk: tweak the debug message for "Loading" a
	Makefile.depend file, always report what the actual makefile is
	with the DIRDEP it is for.
	Remove the redundant "Looking" message.

2024-09-26  Simon J Gerraty  <[email protected]>

	* meta2deps.py: when raising AssertionError include meta file name
	with $SB trimmed if possible.

2024-09-23  Simon J Gerraty  <[email protected]>

	* meta2deps.py: replace assert() with raise AssertionError when we
	detect missing eXits, to ensure a meaningful message gets into
	log.

2024-09-21  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20240921

	* FILES: add genfiles.mk

2024-09-20  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20240920

	* cython.mk: Get PYTHON_VERSION from PYTHON

2024-08-31  Simon J Gerraty  <[email protected]>

	* subdir.mk: add ${SUBDIR.yes} - allows for SUBDIR.${MK_*}
	  and handle subdir with '-' in its name.

2024-08-23  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20240820

	* links.mk: Allow a filter to be applied to SYMLINKS etc.
	It is up to [BUILD_][SYM]LINKS_FILTER to do something sane.
	Also only claim we are making a symlink if the value changed.
2025-01-30 15:38:13 -08:00
Simon J. Gerraty f486ebb5e3 libsecureboot/README.rst clarify use of gpg
Clarify some language and provide an example of gpg use to generate
a detached signature.
2025-01-22 19:10:10 -08:00
Simon J. Gerraty dae4eb623e libsecureboot add sha384 and sha512 for OpenPGP
gpg supports SHA384, SHA512 as well as SHA256 so allow for them.

Tweak Makefile.inc so we can build libsecureboot with only OpenPGP
trust anchors.

Reviewed by: imp
Differential Revision:	https://reviews.freebsd.org/D48546
2025-01-20 12:56:44 -08:00
Simon J. Gerraty 203027b2d5 Update libexec/rc/debug.sh and hooks.sh
Use local_works() to test if 'local' actually works for
current shell.
2024-12-31 10:47:06 -08:00
Simon J. Gerraty f239981ed5 proc_rwmem check PRIV_PROC_MEM_WRITE when writing
This will fail when mac_veriexec is enforced.

Move the check from procfs_doprocmem to proc_rwmem to ensure all
cases are covered.

Reviewed by:	olce, markj
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D47484
2024-11-08 16:11:33 -08:00
Simon J. Gerraty a4e7810f71 debug.sh check for :debug_add:
When we match a tag and turn tracing, see if we have any
$DEBUG_ON:debug_add:tag in DEBUG_SH and if so add the new tag.

This allows for more focused debugging during boot.

Reviewed by:	stevek
2024-11-04 12:30:01 -08:00
Simon J. Gerraty 02653835cd debug.sh add DebugAdd
Sometimes it is desirable while debugging one script for it to enable
debugging of a child.
We can do that with

$DEBUG_DO DebugAdd tag

to add tag to DEBUG_SH but only when we are already debugging.
2024-10-22 11:07:37 -07:00
Simon J. Gerraty 0aa4a9fc85 bootstrap-packages.sh escape ++
We need to escape + when egreping parent makefile too.

Reviewed by:	stevek
2024-10-16 09:26:29 -07:00
Simon J. Gerraty c5c0e79bb0 Add local.meta.stage.mk
We need to undo NO_OBJ if we are staging
as it causes us to drop the stage* target cookies in src tree
which is bad, and may break doing the same targets for multiple
architectures.

Reviewed by:	stevek
2024-10-16 09:26:29 -07:00
Simon J. Gerraty 45fe5580cd Updated and new Makefile.depend files
Reviewd by:	stevek
2024-10-16 09:26:29 -07:00
Simon J. Gerraty 2bdd404abe bootstrap-packages handle optional DIRDEPS
Add logic to bootstrap-packages.sh to handle constructs like:

SUBDIR.${MK_OPT}+= sub

and:

.if ${MK_OPT} == "yes"
SUBDIR+= sub
.endif

there are other methods used in various makefiles
so this will be better than nothing, but not complete coverage.

In either case a reldir will be added to
targets/packages/$package/Makefile.depend.options
rather than
targets/packages/$package/Makefile.depend

It does not matter that in many cases the Makefile.depend will end up
with no DIRDEPS.

Also check that parent Makefile does not have a subdir commented out,
before including it.

If BOOTSTRAP_PACKAGES_FLAGS is -v we report each Makefile.depend[.options]
we create.

Reviewed by:	stevek
2024-10-14 14:58:12 -07:00
Simon J. Gerraty ec7e7ee868 local.dirdeps-targets.mk include src.opts.mk
Include src.opts.mk to ensure we have options defined for when
assessing dirdeps-options.

Reviewed by:	stevek
2024-10-14 11:34:55 -07:00
Simon J. Gerraty ad34c4d882 targets/Makefile.inc skip updates
When PKG_METHOD is "no" or "none" we should *not*
attempt to update Makefile.depend.

Reviewed by:	stevek
2024-10-14 11:34:55 -07:00
Simon J. Gerraty 6b135dd607 local.gendirdeps.mk skip awk and xinstall for host
Do not record DIRDEPS for awk.host or xinstall.host
if we ever need them they can be dealt with specially.

Reviewed by: stevek
2024-10-14 11:34:55 -07:00
Simon J. Gerraty 498dac0ace Update dirdeps.mk for better debug output
Latest dirdeps.mk provides better clue as to which makefile
is being read for a given DIRDEP.

Reviewed by: stevek
2024-10-14 10:30:39 -07:00
Simon J. Gerraty a64729f507 Update Makefile.depend files
After building packages we have a number of new
and updated Makefile.depend files

Reviewed by:	stevek
2024-10-14 10:26:17 -07:00
Simon J. Gerraty 87b759f0fa Add targets/pseudo/bootstrap-packages
Try to compensate for the lack any origin for a DIRDEPS build.

bootstrap-packages will extract the PACKAGE lines from
the tree's Makefiles and use them to populate
targets/packages/Makefile.depend and targets/packages/*/Makefile.depend
so we can at least try to keep the Makefile.depend files throughout
the tree up to date.

This is far from ideal, as we cannot (easily) take into account
options that affect the contents of various packages.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D47065
2024-10-11 14:15:47 -07:00
Simon J. Gerraty 4a5fa10861 procfs require PRIV_PROC_MEM_WRITE to write mem
Add a priv_check for PRIV_PROC_MEM_WRITE which will be blocked
by mac_veriexec if being enforced, unless the process has a maclabel
to grant priv.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D46692
2024-09-19 13:10:27 -07:00
Simon J. Gerraty 7e1c014a9e debug.sh take advantage of hooks.sh
Allow Debug{On,Off} to run associated hooks.
This makes it feasible to collect extra debug info at runtime
without needing to modify any potentially verified and hence immutable
scripts.

Like debug.sh, hooks.sh is extremely handy and used extensively
in many parts of Junos and its build environment.
It is provided here in the hope that others may benefit.

We do not dot hooks.sh by default to reduce overhead, but it can
but done from rc.conf et al using

$_HOOKS_SH . /libexec/hooks.sh

to avoid including more than once.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D46552
2024-09-10 12:04:15 -07:00
Simon J. Gerraty bd8486b9fe kern.pre.mk include local.kern.pre.mk
Allow for local customization.

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D46423
2024-08-23 10:31:16 -07:00
Simon J. Gerraty 35399f68c8 safe_dot check file is a file
Since we are being paranoid, check that each arg to safe_dot is
actually a file as well as non-empty.

Check for white-space in filenames - these require special handling.
2024-08-16 13:15:20 -07:00
Simon J. Gerraty 82cb2a4158 Update safe_eval.sh to support --export
This update allows

safe_dot --export file ...

to export any variables that get set.

Reviewed by: obrien
2024-08-15 15:42:39 -07:00
Simon J. Gerraty 6502c60c22 Move fetch of DEBUG_SH from kenv to rc
We only need to check kenv for DEBUG_SH once.
We also need to export DEBUG_SH to be useful.

Sponsored by:	Juniper Networks, Inc.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D46219
2024-08-03 10:56:48 -07:00
Simon J. Gerraty b77f618568 Add examples to veriexec(8)
Add missing flags to veriexec(8) as well as some examples to
help explain usage.

Also add veriexec.4

Sponsored by:	Juniper Networks, Inc.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D46207
2024-08-01 14:59:52 -07:00
Simon J. Gerraty a2b67d4a6e Update dirdeps.mk to latest
Also add meta2deps.{py,sh} to FILES so they get installed/staged

Reviewed by: stevek
2024-07-29 12:48:56 -07:00
Simon J. Gerraty 226192822c Merge bmake-20240711
Merge commit '84691af93185c692058ba55fa81a04103f5bf71b'
2024-07-20 12:45:48 -07:00
Simon J. Gerraty 84691af931 Import bmake-20240711
Intersting/relevant changes since bmake-20240625

ChangeLog since bmake-20240625

2024-07-13  Simon J Gerraty  <[email protected]>

	* cleanup redundant differences from NetBSD make
	o parse.c: no longer uses mmap
	o var.c: check __STDC_VERSION__ not __STDC__

2024-07-12  Simon J Gerraty  <[email protected]>

	* Apply some patches from NetBSD pkgsrc to reduce divergence
	o meta.c: requires sys/select.h if available
	o var.c: ensure SIZE_MAX has a value
	o util.c: ensure SA_RESTART is defined

	* configure.in: use *ksh* rather than just *ksh to match
	ksh shell specification.

	* unit-tests/Makefile: expand BROKEN_TESTS for ksh and
	mksh in particular

2024-07-11  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240711
	Merge with NetBSD make, pick up
	o compat.c: allow Compat_RunCommand to also handle very long
	commands by writing to a temp file when needed.
	o main.c: extract the temp file logic recently added to Cmd_Exec
	to Cmd_Argv so it can be leveraged by Compat_RunCommand.

2024-07-09  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240709
	Merge with NetBSD make, pick up
	o error out on parse/evaluation errors in shell commands
	o var.c: error out on syntax errors in ':M' and ':N' modifiers

2024-07-07  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240707
	Merge with NetBSD make, pick up
	o only generate code for cleanup functions in CLEANUP mode
	o hash.c: don't track hash table chain lengths during lookup
	unless debugging
	o main.c: move initialization of variable scopes to targ.c
	o var.c: remove Var_End as it is now unnecessary

2024-07-06  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240706
	Merge with NetBSD make, pick up
	o reduce lint comments about ARGSUSED
	o cond.c: error out on conditions containing the operators '&' and '|'
	o str.c: error out on a matching malformed matching pattern '[['
	o var.c: in error messages, distinguish parsing from evaluating
	in error messages for anonymous variables, log the value
	error out on unclosed expressions during parse time

2024-07-04  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240704
	Merge with NetBSD make, pick up
	o add more context information to error messages
	o main.c: on error, print the targets to be made
	add detailed exit status to message for failed sub-commands
	o var.c: error out on the "Bad modifier" error message

2024-07-01  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20240701
	Merge with NetBSD make, pick up
	o var.c: add :tt for Title case

2024-06-30  Simon J Gerraty  <[email protected]>

	* configure.in: 20240630 further refine check for whether
	TZ=Europe/Berlin works

	* VERSION (_MAKE_VERSION): 20240630
	Merge with NetBSD make, pick up
	o job.c: reduce use of UNCONST
	o main.c: add detailed exit status to message for failed sub-commands
	o var.c: error out on some more syntax errors
	add more context to "returned non-zero status" message
2024-07-20 12:41:55 -07:00
Simon J. Gerraty 8d5c8e21c6 Merge bmake-20240625
Merge commit 'dbb5be7f07456d02ce444484c683b130439acb45'
2024-06-28 17:22:11 -07:00