1
0
mirror of https://github.com/systemd/systemd synced 2026-04-11 17:44:58 +02:00

Compare commits

..

6 Commits

Author SHA1 Message Date
Luca Boccassi
743814d7a2
Merge pull request #21858 from yuwata/fix-test-home
test: workaround for TEST-46-HOMED
2021-12-22 16:14:53 +00:00
Jan Janssen
2ef28d054d boot: Use -fvisibility=hidden instead of -fwhole-program
It's functionally the same for sd-boot, but using visibilty
is generally preferred over whole-program.
2021-12-23 00:26:25 +09:00
Evgeny Vereshchagin
d2c3f14fed meson: make it compatible with AFL and honggfuzz again
afl-clang and hufzz-clang try to instrument the code and the
underlying compilers don't like it. It should probably be
fixed in both afl and honggfuzz eventually but until then
let's just use "raw" clang to build bpf-skeletons.

It's a follow-up to https://github.com/systemd/systemd/pull/21607
2021-12-22 15:03:18 +00:00
Yu Watanabe
de27f4c8b8 test: wait for user inactive
The user may be busy when auto-rebalancing the user's home device.

Workaround for #21589.

---
Dec 01 15:03:15 H systemd-homework[1078]: Provided password unlocks user record.
Dec 01 15:03:15 H systemd-homework[1078]: Image file '/home/test-user.home' already locked, can't use.
Dec 01 15:03:15 H systemd-homed[240]: Worker reported error code EADDRINUSE.
Dec 01 15:03:15 H systemd-homed[240]: Activation failed: Address already in use
---
2021-12-22 17:30:10 +09:00
Yu Watanabe
a75a4148a8 test: remove test-user2
Otherwise, we cannot run the test multiple times.
2021-12-22 17:30:03 +09:00
Yu Watanabe
367649ee66 home: update log message
The ratelimit hits even when the all previous attempts are successfull.
2021-12-22 17:29:30 +09:00
5 changed files with 29 additions and 3 deletions

View File

@ -997,6 +997,9 @@ else
# Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
# (like clang-10/llvm-strip-10) # (like clang-10/llvm-strip-10)
clang_bin = cc.get_id() == 'clang' ? cc.cmd_array()[0] : 'clang' clang_bin = cc.get_id() == 'clang' ? cc.cmd_array()[0] : 'clang'
if clang_bin.contains('afl-clang') or clang_bin.contains('hfuzz-clang')
clang_bin = 'clang'
endif
clang = find_program(clang_bin, required : bpf_framework_required) clang = find_program(clang_bin, required : bpf_framework_required)
if clang.found() if clang.found()
llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip', llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',

View File

@ -225,6 +225,7 @@ efi_cflags = cc.get_supported_arguments(
'-std=gnu99', '-std=gnu99',
'-ffreestanding', '-ffreestanding',
'-fshort-wchar', '-fshort-wchar',
'-fvisibility=hidden',
'-isystem', efi_incdir, '-isystem', efi_incdir,
'-isystem', efi_incdir / efi_arch[1], '-isystem', efi_incdir / efi_arch[1],
'-I', fundamental_path, '-I', fundamental_path,
@ -281,7 +282,7 @@ efi_ldflags = [
efi_crt0, efi_crt0,
] ]
if efi_arch[1] in ['aarch64', 'arm', 'riscv64'] if efi_arch[1] in ['aarch64', 'arm', 'riscv64']
efi_ldflags += ['-shared', '-fwhole-program'] efi_ldflags += ['-shared']
# Aarch64, ARM32 and 64bit RISC-V don't have an EFI capable objcopy. # Aarch64, ARM32 and 64bit RISC-V don't have an EFI capable objcopy.
# Use 'binary' instead, and add required symbols manually. # Use 'binary' instead, and add required symbols manually.
efi_ldflags += ['-Wl,--defsym=EFI_SUBSYSTEM=0xa'] efi_ldflags += ['-Wl,--defsym=EFI_SUBSYSTEM=0xa']

View File

@ -383,7 +383,7 @@ static int handle_generic_user_record_error(
else if (sd_bus_error_has_name(error, BUS_ERROR_AUTHENTICATION_LIMIT_HIT)) else if (sd_bus_error_has_name(error, BUS_ERROR_AUTHENTICATION_LIMIT_HIT))
return log_error_errno(SYNTHETIC_ERRNO(ETOOMANYREFS), return log_error_errno(SYNTHETIC_ERRNO(ETOOMANYREFS),
"Too frequent unsuccessful login attempts for user %s, try again later.", user_name); "Too frequent login attempts for user %s, try again later.", user_name);
else if (sd_bus_error_has_name(error, BUS_ERROR_BAD_PASSWORD)) { else if (sd_bus_error_has_name(error, BUS_ERROR_BAD_PASSWORD)) {

View File

@ -293,7 +293,7 @@ static int handle_generic_user_record_error(
return PAM_PERM_DENIED; return PAM_PERM_DENIED;
} else if (sd_bus_error_has_name(error, BUS_ERROR_AUTHENTICATION_LIMIT_HIT)) { } else if (sd_bus_error_has_name(error, BUS_ERROR_AUTHENTICATION_LIMIT_HIT)) {
(void) pam_prompt(handle, PAM_ERROR_MSG, NULL, "Too frequent unsuccessful login attempts for user %s, try again later.", user_name); (void) pam_prompt(handle, PAM_ERROR_MSG, NULL, "Too frequent login attempts for user %s, try again later.", user_name);
pam_syslog(handle, LOG_ERR, "Failed to acquire home for user %s: %s", user_name, bus_error_message(error, ret)); pam_syslog(handle, LOG_ERR, "Failed to acquire home for user %s: %s", user_name, bus_error_message(error, ret));
return PAM_MAXTRIES; return PAM_MAXTRIES;

View File

@ -26,6 +26,13 @@ inspect() {
homectl inspect --json=pretty "$USERNAME" homectl inspect --json=pretty "$USERNAME"
} }
wait_for_state() {
for ((i=0;i<10;i++)) ; do
homectl inspect "$1" | grep -qF "State: $2" && break
sleep .5
done
}
systemd-analyze log-level debug systemd-analyze log-level debug
systemd-analyze log-target console systemd-analyze log-target console
systemctl service-log-level systemd-homed debug systemctl service-log-level systemd-homed debug
@ -146,18 +153,33 @@ if ! systemd-detect-virt -cq ; then
inspect test-user2 inspect test-user2
fi fi
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \ PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; } && { echo 'unexpected success'; exit 1; }
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
wait_for_state test-user inactive
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \ PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; } && { echo 'unexpected success'; exit 1; }
wait_for_state test-user inactive
homectl remove test-user homectl remove test-user
if ! systemd-detect-virt -cq ; then
wait_for_state test-user2 active
homectl deactivate test-user2
wait_for_state test-user2 inactive
homectl remove test-user2
fi
systemd-analyze log-level info systemd-analyze log-level info
echo OK >/testok echo OK >/testok