From a46ec24ddb64ae1a837fe2fe1669c6811ed7d588 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 29 May 2026 19:06:44 +0100 Subject: [PATCH 1/2] core: avoid false maybe-uninitialized warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2026-05-29T18:00:43.7496388Z ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’: 2026-05-29T18:00:43.7497098Z ../src/core/dynamic-user.c:436:29: error: ‘new_uid’ may be used uninitialized [-Werror=maybe-uninitialized] 2026-05-29T18:00:43.7497758Z 436 | num = new_uid; 2026-05-29T18:00:43.7498026Z | ~~~~^~~~~~~~~ 2026-05-29T18:00:43.7498465Z ../src/core/dynamic-user.c:361:23: note: ‘new_uid’ was declared here 2026-05-29T18:00:43.7498802Z 361 | uid_t new_uid; 2026-05-29T18:00:43.7499039Z | ^~~~~~~ 2026-05-29T18:00:43.7499315Z In file included from ../src/core/dynamic-user.c:23: 2026-05-29T18:00:43.7499651Z In function ‘dynamic_user_push’, 2026-05-29T18:00:43.7500063Z inlined from ‘dynamic_user_realize’ at ../src/core/dynamic-user.c:453:13: 2026-05-29T18:00:43.7501021Z ../src/basic/socket-util.h:131:63: error: ‘new_uid_lock_fd’ may be used uninitialized [-Werror=maybe-uninitialized] 2026-05-29T18:00:43.7501897Z 131 | #define send_one_fd_iov(transport_fd, fd, iov, iovlen, flags) send_one_fd_iov_sa(transport_fd, fd, iov, iovlen, NULL, 0, flags) 2026-05-29T18:00:43.7502530Z | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2026-05-29T18:00:43.7503145Z ../src/core/dynamic-user.c:320:16: note: in expansion of macro ‘send_one_fd_iov’ 2026-05-29T18:00:43.7503647Z 320 | return send_one_fd_iov(d->storage_socket[1], lock_fd, &iov, 1, MSG_DONTWAIT); 2026-05-29T18:00:43.7504027Z | ^~~~~~~~~~~~~~~ 2026-05-29T18:00:43.7504397Z ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’: 2026-05-29T18:00:43.7504888Z ../src/core/dynamic-user.c:360:21: note: ‘new_uid_lock_fd’ was declared here 2026-05-29T18:00:43.7505256Z 360 | int new_uid_lock_fd; 2026-05-29T18:00:43.7505511Z | ^~~~~~~~~~~~~~~ 2026-05-29T18:00:43.7505882Z ../src/core/dynamic-user.c: In function ‘dynamic_user_current’: 2026-05-29T18:00:43.7506461Z ../src/core/dynamic-user.c:468:15: error: ‘uid’ may be used uninitialized [-Werror=maybe-uninitialized] 2026-05-29T18:00:43.7506895Z 468 | uid_t uid; 2026-05-29T18:00:43.7507096Z | ^~~ 2026-05-29T18:26:14.2420944Z In function ‘dynamic_user_push’, 2026-05-29T18:26:14.2421730Z inlined from ‘dynamic_user_realize’ at ../src/core/dynamic-user.c:453:13: 2026-05-29T18:26:14.2435240Z ../src/basic/socket-util.h:131:63: error: ‘new_uid_lock_fd’ may be used uninitialized [-Werror=maybe-uninitialized] 2026-05-29T18:26:14.2440497Z 131 | #define send_one_fd_iov(transport_fd, fd, iov, iovlen, flags) send_one_fd_iov_sa(transport_fd, fd, iov, iovlen, NULL, 0, flags) 2026-05-29T18:26:14.2442511Z | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2026-05-29T18:26:14.2445002Z ../src/core/dynamic-user.c:320:16: note: in expansion of macro ‘send_one_fd_iov’ 2026-05-29T18:26:14.2445727Z 320 | return send_one_fd_iov(d->storage_socket[1], lock_fd, &iov, 1, MSG_DONTWAIT); 2026-05-29T18:26:14.2448345Z | ^~~~~~~~~~~~~~~ 2026-05-29T18:26:14.2448952Z ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’: 2026-05-29T18:26:14.2451781Z ../src/core/dynamic-user.c:360:21: note: ‘new_uid_lock_fd’ was declared here 2026-05-29T18:26:14.2452287Z 360 | int new_uid_lock_fd; 2026-05-29T18:26:14.2454430Z | ^~~~~~~~~~~~~~~ 2026-05-29T18:26:14.2454960Z ../src/core/dynamic-user.c: In function ‘dynamic_user_current’: 2026-05-29T18:26:14.2457632Z ../src/core/dynamic-user.c:468:15: error: ‘uid’ may be used uninitialized [-Werror=maybe-uninitialized] 2026-05-29T18:26:14.2458207Z 468 | uid_t uid; 2026-05-29T18:26:14.2460327Z | ^~~ --- src/core/dynamic-user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/dynamic-user.c b/src/core/dynamic-user.c index 921622d92c..eb4235637e 100644 --- a/src/core/dynamic-user.c +++ b/src/core/dynamic-user.c @@ -357,8 +357,8 @@ static int dynamic_user_realize( r = dynamic_user_pop(d, &num, &uid_lock_fd); if (r < 0) { - int new_uid_lock_fd; - uid_t new_uid; + int new_uid_lock_fd = -EBADF; /* avoid false maybe-uninitialized warning */ + uid_t new_uid = UID_INVALID; /* avoid false maybe-uninitialized warning */ if (r != -EAGAIN) return r; @@ -465,7 +465,7 @@ static int dynamic_user_realize( int dynamic_user_current(DynamicUser *d, uid_t *ret) { _cleanup_close_ int lock_fd = -EBADF; - uid_t uid; + uid_t uid = UID_INVALID; /* avoid false maybe-uninitialized warning */ int r; assert(d); From 3f4b72634826552bb2554a5782977143f6daa61d Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 29 May 2026 18:17:25 +0100 Subject: [PATCH 2/2] ci: add build coverage for riscv64 This is already a primary architecture in Ubuntu, and more distributions are adding support for it. It's too slow for emulation, but we can at least verify that compilation works. Use the arm worker, for two reasons: - it is already set up with ports.ubuntu.com so we don't have to muck with apt sources manually - it is used a lot less than the x86 worker --- .github/workflows/build-test.sh | 3 +++ .github/workflows/build-test.yml | 3 +++ .github/workflows/riscv64-gcc.cross | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .github/workflows/riscv64-gcc.cross diff --git a/.github/workflows/build-test.sh b/.github/workflows/build-test.sh index 784340ec45..9c3d2e7338 100755 --- a/.github/workflows/build-test.sh +++ b/.github/workflows/build-test.sh @@ -96,6 +96,9 @@ if [[ -n "$CROSS_ARCH" ]]; then armhf) triplet=arm-linux-gnueabihf ;; + riscv64) + triplet=riscv64-linux-gnu + ;; *) fatal "Unsupported cross architecture: $CROSS_ARCH" ;; diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2596b3edb5..a5b2027139 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -42,6 +42,9 @@ jobs: - env: { COMPILER: "gcc", COMPILER_VERSION: "13", LINKER: "bfd", CROSS_ARCH: "armhf" } runner: [ ubuntu-24.04-arm ] python-version: '' + - env: { COMPILER: "gcc", COMPILER_VERSION: "13", LINKER: "bfd", CROSS_ARCH: "riscv64" } + runner: [ ubuntu-24.04-arm ] + python-version: '' - env: { COMPILER: "clang", COMPILER_VERSION: "18", LINKER: "lld" } runner: [ ubuntu-24.04-s390x ] python-version: '' diff --git a/.github/workflows/riscv64-gcc.cross b/.github/workflows/riscv64-gcc.cross new file mode 100644 index 0000000000..8096e45192 --- /dev/null +++ b/.github/workflows/riscv64-gcc.cross @@ -0,0 +1,21 @@ +[binaries] +c = 'riscv64-linux-gnu-gcc' +cpp = 'riscv64-linux-gnu-g++' +ar = 'riscv64-linux-gnu-gcc-ar' +nm = 'riscv64-linux-gnu-gcc-nm' +strip = 'riscv64-linux-gnu-strip' +pkgconfig = 'pkg-config' + +[properties] +needs_exe_wrapper = true +pkg_config_libdir = '/usr/lib/riscv64-linux-gnu/pkgconfig:/usr/share/pkgconfig' +c_args = ['-O2', '-pipe', '-g', '-feliminate-unused-debug-types'] +c_link_args = ['-fuse-ld=bfd', '-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed', '-Wl,-z,relro,-z,now,-z,noexecstack'] +cpp_args = [] +cpp_link_args = ['-fuse-ld=bfd', '-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed', '-Wl,-z,relro,-z,now,-z,noexecstack'] + +[host_machine] +system = 'linux' +cpu_family = 'riscv64' +cpu = 'riscv64' +endian = 'little'