Lennart Poettering
c24f405ace
tree-wide: don't play games with alignment around file_handle
...
The payload of a file_handle structure is not 64bit aligned. So far used
_alignas_() to align it to 64bit as a whole, which by accident has the
side-effect that the payload ends up being aligned to 64bit too, but
this is ugly, because it's really just an accident...
Let's do this properly, and just use proper unaligned 64bit reads to
access the field, and do not assume aligning the structure as a whole
also aligns the payload part of it.
Follow-up for: fd51a7d8b5b1c710c3b59e877bc35b2739dcc350
2025-08-18 21:50:55 +09:00
Yu Watanabe
73c4350fda
ptyfwd: do not try to read from PTYForward.input_fd when read-only mode
...
Fixes the following error message (the last line):
```
[FAILED] Failed to start TEST-60-MOUNT-RATELIMIT.service.
Sending SIGTERM to remaining processes...
Sending SIGKILL to remaining processes...
All filesystems, swaps, loop devices, MD devices and DM devices detached.
Exiting container.
Failed to read from pty input fd: Bad file descriptor
```
Follow-up for b823809bca6cd531a54fcf0f02427aea7cd3e651 and
cf89e48028ed3b651f63ba624175394c3c0d8efa.
2025-08-18 13:05:12 +01:00
Antonio Alvarez Feijoo
a83ba27b89
test-nss-hosts: do not call seccomp functions if HAVE_SECCOMP is not set
...
Otherwise, the build fails:
```
Features
...
disabled : ACL, SECCOMP, ...
...
[1592/2115] Compiling C object test-nss-hosts.p/src_test_test-nss-hosts.c.o
FAILED: test-nss-hosts.p/src_test_test-nss-hosts.c.o
...
In file included from ../src/test/test-nss-hosts.c:27:
../src/test/test-nss-hosts.c: In function ‘run’:
../src/test/test-nss-hosts.c:497:43: error: implicit declaration of function ‘seccomp_filter_set_add_by_name’ [-Werror=implicit-function-declaration]
497 | ASSERT_OK(seccomp_filter_set_add_by_name(filter, /* add = */ true, s));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:497:43: warning: nested extern declaration of ‘seccomp_filter_set_add_by_name’ [-Wnested-externs]
497 | ASSERT_OK(seccomp_filter_set_add_by_name(filter, /* add = */ true, s));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:498:35: error: implicit declaration of function ‘seccomp_load_syscall_filter_set_raw’ [-Werror=implicit-function-declaration]
498 | ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:498:35: warning: nested extern declaration of ‘seccomp_load_syscall_filter_set_raw’ [-Wnested-externs]
498 | ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:498:71: error: ‘SCMP_ACT_ALLOW’ undeclared (first use in this function)
498 | ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
| ^~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:498:71: note: each undeclared identifier is reported only once for each function it appears in
498 | ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
| ^~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:498:95: error: implicit declaration of function ‘SCMP_ACT_ERRNO’ [-Werror=implicit-function-declaration]
498 | ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
| ^~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
../src/test/test-nss-hosts.c:498:95: warning: nested extern declaration of ‘SCMP_ACT_ERRNO’ [-Wnested-externs]
498 | ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
| ^~~~~~~~~~~~~~
../src/shared/tests.h:181:24: note: in definition of macro ‘ASSERT_OK’
181 | typeof(expr) _result = (expr); \
| ^~~~
cc1: some warnings being treated as errors
```
Fixes 788b3e030e717404cbb65b4261bff2ef7ddb1b90
2025-08-18 13:02:21 +01:00