[PATCH 2/8] kconfig: merge_config.sh: sync with Linux v6.9

2024-05-17 Thread Ahmad Fatoum
This gives us support for the new -s (strict mode) and -Q (disable warnings) options. The latter will be used in the follow-up commit. Signed-off-by: Ahmad Fatoum --- scripts/kconfig/merge_config.sh | 40 + 1 file changed, 31 insertions(+), 9 deletions(-) diff --

[PATCH 3/8] kbuild: add support for merged defconfigs

2024-05-17 Thread Ahmad Fatoum
We currently use scripts/kconfig/merge_config.sh only in MAKEALL. Linux has been using it inside Kbuild as well to derive new defconfigs from the existing ones that differ only by a few options, e.g. to enable virtualization or to switch endianness. This is useful for us in barebox as well to cut

[PATCH 4/8] MIPS: make use of merged defconfigs

2024-05-17 Thread Ahmad Fatoum
QEmu's Malta emulation can be used in four flavors depending on endianness and CPU register width. So far we only had two defconfigs and expected users to adjust the config to arrive at the other two flavors to cut down on duplication in the config files. Let's use the new merged defconfigs mechani

[PATCH 1/8] test: move common config fragments into common/boards/configs

2024-05-17 Thread Ahmad Fatoum
We'll start using these fragments inside Kbuild too for merged defconfigs to cut down on defconfigs that are largely duplicated, but differ only in a few options. To share such configs between architectures, we add common/boards/configs as a common fragment directory here and standardize on using .

[PATCH 8/8] sandbox: add headless_defconfig

2024-05-17 Thread Ahmad Fatoum
Build with no console whatsoever is not a common configuration for development, but is used in some verified boot scenarios. Some configurations go even further and disable the shell altogether. Add headless.config and noshell.config fragments that describes these configurations and sandbox targets

[PATCH 0/8] kconfig: cut down on duplication with merged defconfigs

2024-05-17 Thread Ahmad Fatoum
We currently use scripts/kconfig/merge_config.sh only in MAKEALL. Linux has been using it inside Kbuild as well to derive new defconfigs from the existing ones that differ only by a few options, e.g. to enable virtualization or to switch endianness. This is useful for us in barebox as well to cut

[PATCH 7/8] power: reset: reboot-mode: fix link error without globalvar

2024-05-17 Thread Ahmad Fatoum
The reboot_mode_add_globalvar initcall would run even without CONFIG_GLOBALVAR if it didn't fail at link time, because it references the global_device. Fix this by only registering the initcall if global variable support is enabled. Signed-off-by: Ahmad Fatoum --- drivers/power/reset/reboot-mode

[PATCH 5/8] sandbox: stdio: fix ctrlc link error when CONFIG_CONSOLE_NONE=y

2024-05-17 Thread Ahmad Fatoum
While sandbox defines arch_ctrlc() unconditionally, ctrlc() is not defined when CONFIG_CONSOLE_NONE=y for all architectures, so we need the inline stub on sandbox too to avoid a link error. Signed-off-by: Ahmad Fatoum --- include/stdio.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/inclu

[PATCH 6/8] net: fix build with CONFIG_SHELL_NONE

2024-05-17 Thread Ahmad Fatoum
Some common networking code like fastboot over UDP calls ifup_all(0) to bring up all interfaces. ifup_all(0) in turn runs commands to execute interface discovery scripts and source network configurations. This leads to a link error, because run_command is not defined in a CONFIG_SHELL_NONE build a

[PATCH] treewide: use an unsigned type for ioctl commands

2024-05-17 Thread Ahmad Fatoum
Linux & BSD define the ioctl command parameter to be always unsigned. POSIX differs and uses a signed integer instead, but as we are importing Linux code, it makes sense to use the same signedness to avoid false positive warnings about sign-extended constants that get truncated. Signed-off-by: Ahm

[PATCH] pbl: compile PBL decompression code optionally

2024-05-17 Thread Ahmad Fatoum
There's no point in compiling PBL decompression code when CONFIG_HAVE_IMAGE_COMPRESSION is not selected, so reflect that in Kbuild to save some build time. Signed-off-by: Ahmad Fatoum --- pbl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbl/Makefile b/pbl/Makefile

[PATCH] sandbox: enable frame pointers unconditionally

2024-05-17 Thread Ahmad Fatoum
We have no size constraints on sandbox, so enable frame pointers for easier debugging. Signed-off-by: Ahmad Fatoum --- arch/sandbox/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 3419b6e4f686..d82027e75047 100644 --- a/arch/sandbox/K

[PATCH 1/2] FIT: fix build with sandbox

2024-05-17 Thread Ahmad Fatoum
As FIT is built only for ARM so far, this sandbox-related code has bitrotted. To prepare allowing it to build for other platforms, adjust the API to the current state. Signed-off-by: Ahmad Fatoum --- common/image-fit.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff

[PATCH 2/2] common: fit: don't have BOOTM_FITIMAGE depend on ARM

2024-05-17 Thread Ahmad Fatoum
There's no reason to restrict FIT to ARM. In preparation for adding fuzzing infrastructure for FIT images, allow its selection on other architectures as well. Signed-off-by: Ahmad Fatoum --- common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/Kconfig b/commo

[PATCH 5/7] regulator: of_regulator: remove unused allocation

2024-05-17 Thread Ahmad Fatoum
We leak this allocation, but we don't actually need it, so drop it. Signed-off-by: Ahmad Fatoum --- drivers/regulator/of_regulator.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 10f75a4f1c60..c037f85c439d 10064

[PATCH 1/7] of: free unflattened overlays after application

2024-05-17 Thread Ahmad Fatoum
of_unflatten_dtb allocates an unflattened tree and of_overlay_apply_tree copies it into another tree. The unflattened tree is then usually leaked. Add a function that takes care of these two steps and then frees the tree. Signed-off-by: Ahmad Fatoum --- arch/riscv/boards/riscvemu/board.c | 4 +-

[PATCH 3/7] test: self: digest: don't leak digest buffers

2024-05-17 Thread Ahmad Fatoum
The selftest leaks memory by letting the pointers go out of scope. Signed-off-by: Ahmad Fatoum --- test/self/digest.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/self/digest.c b/test/self/digest.c index 4cda5b09637b..32815c85ba70 100644 --- a/test/self/digest.

[PATCH 7/7] power: reset: reboot-mode: fix memory leak

2024-05-17 Thread Ahmad Fatoum
magicbuf is only used for comparisons and debug output in reboot_mode_register() and is then leaked after its return. Free it instead once no longer needed. Signed-off-by: Ahmad Fatoum --- drivers/power/reset/nvmem-reboot-mode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/powe

[PATCH 6/7] globalvar: fix memory leak

2024-05-17 Thread Ahmad Fatoum
val is copied and then goes out of scope, thereby leaking the buffer it points at. Free it before that happens. Signed-off-by: Ahmad Fatoum --- common/globalvar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/globalvar.c b/common/globalvar.c index a83529f98fe0..79624adcfe6f 100644 -

[PATCH 4/7] test: self: ramfs: fix memory leak

2024-05-17 Thread Ahmad Fatoum
Like many other tests, ramfs also leaks memory. Fix this. Signed-off-by: Ahmad Fatoum --- test/self/ramfs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/self/ramfs.c b/test/self/ramfs.c index 1bc2b3b068f0..239e3e690740 100644 --- a/test/self/ramfs.c +++ b/test/sel

[PATCH 2/7] of: overlay: do not leak fixed up path

2024-05-17 Thread Ahmad Fatoum
new_path is freshly allocated in every iteration and then leaked after of_property_write_string() takes a copy from it. Fix the leak by freeing it before it goes out of scope. Signed-off-by: Ahmad Fatoum --- drivers/of/overlay.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/ove

[PATCH 2/2] x86: lib: setjmp: mark as not needing executable stack

2024-05-17 Thread Ahmad Fatoum
We don't require an executable stack for our x86 setjmp implementations. Note that, so we don't get a warning when we start using this implementation for sandbox when compiled on x86. Signed-off-by: Ahmad Fatoum --- arch/x86/lib/setjmp_32.S | 2 ++ arch/x86/lib/setjmp_64.S | 2 ++ 2 files change

[PATCH 1/2] images: sha_sum: mark as not needing executable stack

2024-05-17 Thread Ahmad Fatoum
The hash section contains only data, so add a note that an executable stack is not needed. This will suppress a warning when we start using this on sandbox. Signed-off-by: Ahmad Fatoum --- images/sha_sum.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/images/sha_sum.S b/images/sha_sum.S

[PATCH master] filetype: fix OOB read when detecting type of truncated kernel images

2024-05-17 Thread Ahmad Fatoum
The ARM and RISC-V kernel Image format features a 64-byte header and places the 32-bit magic value identifying it at offset 56. The check for the magic values should thus ensure that at least 56 bytes are guaranteed to be available in the buffer, thus move it into the >= 64 byte segment of the fun