[PATCH 0/5] More toolchain issue resolutions, CI update

11 views
Skip to first unread message

Jan Kiszka

unread,
Jul 24, 2022, 9:44:04 AM7/24/22
to efibootg...@googlegroups.com
On top of the already posted warning/error suppression for recent
binutils, this prepares for and performs the update of the CI build
container to Ubuntu 22.04.

The update triggered some test suite failures due to a fragile
overloading of symbols. Not that I fully understand why it failed, but
now it seems sanely resolved.

Jan

Jan Kiszka (5):
Mark stack non-executable in init_array_* modules
tests: Only weaken symbols we actually want to override
tests: Drop no longer needed prototypes from test-interface.h
ci: Add ccpcheck exceptions for constParameter warnings
ci: Update base image to Ubuntu 22.04

.github/workflows/main.yaml | 38 +++++++++++++----------------
drivers/watchdog/init_array_end.S | 4 ++-
drivers/watchdog/init_array_start.S | 4 ++-
env/env_api_fat.c | 5 ++--
include/test-interface.h | 4 ---
tools/tests/Makefile.am | 10 +++++++-
6 files changed, 35 insertions(+), 30 deletions(-)

--
2.35.3

Jan Kiszka

unread,
Jul 24, 2022, 9:44:04 AM7/24/22
to efibootg...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

Those are now available via regular internal headers as well.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
include/test-interface.h | 4 ----
1 file changed, 4 deletions(-)

diff --git a/include/test-interface.h b/include/test-interface.h
index 9d43b1f..8baacd6 100644
--- a/include/test-interface.h
+++ b/include/test-interface.h
@@ -19,8 +19,4 @@
bool read_env(CONFIG_PART *part, BG_ENVDATA *env);
bool write_env(CONFIG_PART *part, BG_ENVDATA *env);

-bool probe_config_file(CONFIG_PART *cfgpart);
-bool probe_config_partitions(CONFIG_PART *cfgparts);
-bool mount_partition(CONFIG_PART *cfgpart);
-
EBGENVKEY bgenv_str2enum(char *key);
--
2.35.3

Jan Kiszka

unread,
Jul 24, 2022, 9:44:05 AM7/24/22
to efibootg...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

Otherwise, recent ld may leave some other symbols unresolved and cause
NULL pointer jumps during the test. Seen with github's Ubuntu 22.04
toolchain and with OpenSUSE 15.4.

Weakening config_parts and envdata does not work reliably via the
objcopy trick because some compilers already resolve the symbols locally
if they are in the same module, preventing overloading them for the
tests.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
env/env_api_fat.c | 5 +++--
tools/tests/Makefile.am | 10 +++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/env/env_api_fat.c b/env/env_api_fat.c
index 886d2d2..1c01a52 100644
--- a/env/env_api_fat.c
+++ b/env/env_api_fat.c
@@ -129,8 +129,9 @@ bool write_env(CONFIG_PART *part, BG_ENVDATA *env)
return result;
}

-CONFIG_PART config_parts[ENV_NUM_CONFIG_PARTS];
-BG_ENVDATA envdata[ENV_NUM_CONFIG_PARTS];
+/* Weaken the symbols in order to permit overloading in the test cases. */
+CONFIG_PART __attribute__((weak)) config_parts[ENV_NUM_CONFIG_PARTS];
+BG_ENVDATA __attribute__((weak)) envdata[ENV_NUM_CONFIG_PARTS];

static bool initialized;

diff --git a/tools/tests/Makefile.am b/tools/tests/Makefile.am
index 3947ab5..71f7159 100644
--- a/tools/tests/Makefile.am
+++ b/tools/tests/Makefile.am
@@ -48,7 +48,15 @@ check_LIBRARIES = libtest_env_api_fat.a
libtest_env_api_fat_a_SOURCES = $(libtest_env_api_fat_a_SRC)

libenvapi_testlib_fat.a: libtest_env_api_fat.a
- $(OBJCOPY) --weaken $^ $@
+ $(OBJCOPY) \
+ --weaken-symbol=read_env \
+ --weaken-symbol=ped_device_probe_all \
+ --weaken-symbol=ped_device_get_next \
+ --weaken-symbol=write_env \
+ --weaken-symbol=get_mountpoint \
+ --weaken-symbol=bgenv_init \
+ --weaken-symbol=bgenv_write \
+ $^ $@

check_PROGRAMS = test_bgenv_init_retval \
test_probe_config_partitions \
--
2.35.3

Jan Kiszka

unread,
Jul 24, 2022, 9:44:05 AM7/24/22
to efibootg...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

This does not obsolete the related ignore switch for now, but it will
help to drop it once gnu-efi adopted that as well.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
drivers/watchdog/init_array_end.S | 4 +++-
drivers/watchdog/init_array_start.S | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/init_array_end.S b/drivers/watchdog/init_array_end.S
index d91969c..702231c 100644
--- a/drivers/watchdog/init_array_end.S
+++ b/drivers/watchdog/init_array_end.S
@@ -1,7 +1,7 @@
/*
* EFI Boot Guard
*
- * Copyright (c) Siemens AG, 2017
+ * Copyright (c) Siemens AG, 2017-2022
*
* Authors:
* Jan Kiszka <jan.k...@siemens.com>
@@ -12,6 +12,8 @@
* SPDX-License-Identifier: GPL-2.0
*/

+.section .note.GNU-stack,"",%progbits
+
.section .init_array
.global init_array_end
init_array_end:
diff --git a/drivers/watchdog/init_array_start.S b/drivers/watchdog/init_array_start.S
index 6d4b7cd..b723074 100644
--- a/drivers/watchdog/init_array_start.S
+++ b/drivers/watchdog/init_array_start.S
@@ -1,7 +1,7 @@
/*
* EFI Boot Guard
*
- * Copyright (c) Siemens AG, 2017
+ * Copyright (c) Siemens AG, 2017-2022
*
* Authors:
* Jan Kiszka <jan.k...@siemens.com>
@@ -12,6 +12,8 @@
* SPDX-License-Identifier: GPL-2.0
*/

+.section .note.GNU-stack,"",%progbits
+
.section .init_array
/* Dummy value to avoid zero-size .init_array section linker error on
* architectures having no watchdog drivers */
--
2.35.3

Jan Kiszka

unread,
Jul 24, 2022, 9:44:05 AM7/24/22
to efibootg...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

Allows to drop the meanwhile broken update of cppcheck.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.github/workflows/main.yaml | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 19fe3a5..b123c85 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -22,7 +22,7 @@ on:

jobs:
build:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
strategy:
matrix:
target:
@@ -58,12 +58,12 @@ jobs:
sudo dpkg --add-architecture arm64
sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list
sudo sh -c "cat <<EOF > /etc/apt/sources.list.d/ports.list
- deb [arch=arm64] http://ports.ubuntu.com/ focal main restricted
- deb [arch=arm64] http://ports.ubuntu.com/ focal-updates main restricted
- deb [arch=arm64] http://ports.ubuntu.com/ focal universe
- deb [arch=arm64] http://ports.ubuntu.com/ focal-updates universe
- deb [arch=arm64] http://ports.ubuntu.com/ focal multiverse
- deb [arch=arm64] http://ports.ubuntu.com/ focal-updates multiverse
+ deb [arch=arm64] http://ports.ubuntu.com/ jammy main restricted
+ deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main restricted
+ deb [arch=arm64] http://ports.ubuntu.com/ jammy universe
+ deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates universe
+ deb [arch=arm64] http://ports.ubuntu.com/ jammy multiverse
+ deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates multiverse
EOF"
sudo apt-get update
sudo apt-get install --no-install-recommends \
@@ -76,12 +76,12 @@ jobs:
sudo dpkg --add-architecture armhf
sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list
sudo sh -c "cat <<EOF > /etc/apt/sources.list.d/ports.list
- deb [arch=armhf] http://ports.ubuntu.com/ focal main restricted
- deb [arch=armhf] http://ports.ubuntu.com/ focal-updates main restricted
- deb [arch=armhf] http://ports.ubuntu.com/ focal universe
- deb [arch=armhf] http://ports.ubuntu.com/ focal-updates universe
- deb [arch=armhf] http://ports.ubuntu.com/ focal multiverse
- deb [arch=armhf] http://ports.ubuntu.com/ focal-updates multiverse
+ deb [arch=armhf] http://ports.ubuntu.com/ jammy main restricted
+ deb [arch=armhf] http://ports.ubuntu.com/ jammy-updates main restricted
+ deb [arch=armhf] http://ports.ubuntu.com/ jammy universe
+ deb [arch=armhf] http://ports.ubuntu.com/ jammy-updates universe
+ deb [arch=armhf] http://ports.ubuntu.com/ jammy multiverse
+ deb [arch=armhf] http://ports.ubuntu.com/ jammy-updates multiverse
EOF"
sudo apt-get update
sudo apt-get install --no-install-recommends \
@@ -91,15 +91,8 @@ jobs:
- name: Install cppcheck
if: ${{ matrix.target == 'cppcheck' }}
run: |
- sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu hirsute main universe' \
- > /etc/apt/sources.list.d/hirsute.list"
- sudo sh -c "cat <<EOF > /etc/apt/preferences.d/hirsute.pref
- Package: *
- Pin: release n=hirsute
- Pin-Priority: -1
- EOF"
sudo apt-get update
- sudo apt-get install --no-install-recommends libz3-4/hirsute cppcheck/hirsute
+ sudo apt-get install --no-install-recommends cppcheck

- name: Prepare build
run: |
--
2.35.3

Jan Kiszka

unread,
Jul 24, 2022, 9:44:05 AM7/24/22
to efibootg...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

None of both can be changes as the API is not defined by the users where
cppcheck has its findings.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.github/workflows/main.yaml | 3 +++
1 file changed, 3 insertions(+)

diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 429557b..19fe3a5 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -172,6 +172,9 @@ jobs:
suppress+=" --suppress=nullPointerRedundantCheck:kernel-stub/main.c"
# Avoid noise regarding Ignore* fields
suppress+=" --suppress=unusedStructMember:kernel-stub/main.c"
+ # Not applicable because of API requirements
+ suppress+=" --suppress=constParameter:drivers/watchdog/ipc4x7e_wdt.c"
+ suppress+=" --suppress=constParameter:kernel-stub/initrd.c"

enable="--enable=warning \
--enable=style \
--
2.35.3

Jan Kiszka

unread,
Jul 27, 2022, 1:53:13 AM7/27/22
to efibootg...@googlegroups.com
From: Jan Kiszka <jan.k...@siemens.com>

Otherwise, recent ld may leave some other symbols unresolved and cause
NULL pointer jumps during the test. Seen with github's Ubuntu 22.04
toolchain and with OpenSUSE 15.4.

Weakening config_parts and envdata does not work reliably via the
objcopy trick because some compilers already resolve the symbols locally
if they are in the same module, preventing overloading them for the
tests.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
Reply all
Reply to author
Forward
0 new messages