pidfd-util: force alignment of file_handle union to avoid assert on 32bit

On 32bit the union won't be aligned automatically, needs to be enforced:

Assertion '((uintptr_t) _p) % alignof(uint64_t) == 0' failed at src/basic/pidfd-util.c:251, function pidfd_get_inode_id_impl(). Aborting.

Follow-up for 9c039ef5ff
This commit is contained in:
Luca Boccassi
2025-08-15 12:36:20 +01:00
parent 57aeb4a403
commit fd51a7d8b5
+1 -1
View File
@@ -239,7 +239,7 @@ int pidfd_get_inode_id_impl(int fd, uint64_t *ret) {
union {
struct file_handle file_handle;
uint8_t space[offsetof(struct file_handle, f_handle) + sizeof(uint64_t)];
} fh = {
} _alignas_(uint64_t) fh = {
.file_handle.handle_bytes = sizeof(uint64_t),
.file_handle.handle_type = FILEID_KERNFS,
};