Small adjustements to let various tests pass in overloaded Fedora infra and related changes
read and even write access to all these otherwise unmappable files,
which is quite likely a major security problem.
+ * tmpfs mounts automatically created by systemd (/tmp, /run, /dev/shm,
+ and others) now have a size and inode limits applied (50% of RAM for
+ /tmp, 10% of RAM for /dev/shm, etc.)
+
* nss-mymachines lost support for resolution of users and groups, and
now only does resolution of hostnames. This functionality is now
provided by nss-systemd. Thus, the 'mymachines' entry should be
zwłaszcza na komputerach używających NFS lub mających kontenery. Należy
przydzielić identyfikator użytkownika dla tej konkretnej usługi, statycznie
przez systemd-sysusers lub dynamicznie przez ustawienie usługi DynamicUser=.
+
+-- 1c0454c1bd2241e0ac6fefb4bc631433
+Subject: Usługa systemd-udev-settle.service jest przestarzała.
+Defined-By: systemd
+Support: %SUPPORT_URL%
+
+Użycie jednostki usługi systemd „systemd-udev-settle.service” jest
+przestarzałe. Wstawia ona sztuczne opóźnienie do procesu uruchamiania
+bez dostarczania gwarancji, które były oczekiwane przez pozostałe
+podsystemy. Korzystanie z tej usługi może prowadzić do hazardów,
+i zasadniczo jest błędem.
+
+W przeszłości zadaniem tej usługi było oczekiwanie, aż wszystkie urządzenia
+komputera zostaną w pełni wykryte i zainicjowane, opóźniając uruchamianie
+do ukończenia tego etapu. Jednakże, współczesne komputery i urządzenia
+na ogół nie działają już w ten sposób, tylko mogą pojawić się w dowolnej
+chwili i zająć dowolny czas na wykrycie i inicjację. Z tego powodu,
+w ogólnym przypadku, nie jest już możliwe poprawne opóźnienie uruchamiania
+do przetworzenia „wszystkich urządzeń”, ponieważ nie jest jasne, co znaczy
+„wszystkie urządzenia” i kiedy zostały odnalezione. Dotyczy to zwłaszcza
+urządzeń podłączonych przez USB lub sieć.
+
+Nowoczesne oprogramowanie wymagające określonego sprzętu (takiego jak
+urządzenie sieciowe lub urządzenie blokowe) do działania powinno oczekiwać
+tylko na pojawienie się danego urządzenia, a w przeciwnym razie działać
+asynchronicznie, inicjując urządzenia, kiedy te pojawiają się w trakcie
+uruchamiania i w trakcie działania systemu bez opóźniania procesu uruchamiania.
+
+Jest to wada danego oprogramowania, jeśli nie działa ono w ten sposób
+i nadal wciąga usługę systemd-udev-settle.service do procesu uruchamiania.
+
+Prosimy zgłosić błąd w następujących jednostkach z prośbą
+o ich aktualizację tak, aby działały w sposób dynamiczny
+bez zależności od usługi systemd-udev-settle.service:
+
+ @OFFENDING_UNITS@
return 0;
}
+static int find_shell(const char *path, const char *root) {
+ int r;
+
+ assert(path);
+
+ if (!valid_shell(path))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "%s is not a valid shell", path);
+
+ r = chase_symlinks(path, root, CHASE_PREFIX_ROOT, NULL, NULL);
+ if (r < 0) {
+ const char *p;
+ p = prefix_roota(root, path);
+ return log_error_errno(r, "Failed to resolve shell %s: %m", p);
+ }
+
+ return 0;
+}
+
static int prompt_root_shell(void) {
int r;
break;
}
- if (!valid_shell(s)) {
- log_error("Specified shell invalid.");
+ r = find_shell(s, arg_root);
+ if (r < 0)
continue;
- }
arg_root_shell = TAKE_PTR(s);
break;
" --root-password=PASSWORD Set root password from plaintext password\n"
" --root-password-file=FILE Set root password from file\n"
" --root-password-hashed=HASHED_PASSWORD Set root password from hashed password\n"
+ " --root-shell=SHELL Set root shell\n"
" --prompt-locale Prompt the user for locale settings\n"
" --prompt-keymap Prompt the user for keymap settings\n"
" --prompt-timezone Prompt the user for timezone\n"
" --prompt-hostname Prompt the user for hostname\n"
" --prompt-root-password Prompt the user for root password\n"
+ " --prompt-root-shell Prompt the user for root shell\n"
" --prompt Prompt for all of the above\n"
" --copy-locale Copy locale from host\n"
" --copy-keymap Copy keymap from host\n"
" --copy-timezone Copy timezone from host\n"
" --copy-root-password Copy root password from host\n"
+ " --copy-root-shell Copy root shell from host\n"
" --copy Copy locale, keymap, timezone, root password\n"
" --setup-machine-id Generate a new random machine ID\n"
" --force Overwrite existing files\n"
break;
case ARG_ROOT_SHELL:
- if (!valid_shell(optarg))
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "%s is not a valid shell path", optarg);
+ r = find_shell(optarg, arg_root);
+ if (r < 0)
+ return r;
r = free_and_strdup(&arg_root_shell, optarg);
if (r < 0)
cur = p;
+ /* If RAs have already been sent, send an RA immediately to announce the newly-added prefix */
+ if (ra->ra_sent > 0) {
+ r = radv_send(ra, NULL, ra->lifetime);
+ if (r < 0)
+ log_radv_errno(r, "Unable to send Router Advertisement for added prefix: %m");
+ else
+ log_radv("Sent Router Advertisement for added prefix");
+ }
+
update:
r = sd_event_now(ra->event, clock_boottime_or_monotonic(), &time_now);
if (r < 0)
return 0;
}
+ /* If RAs have already been sent, send an RA immediately to announce the newly-added route prefix */
+ if (ra->ra_sent > 0) {
+ r = radv_send(ra, NULL, ra->lifetime);
+ if (r < 0)
+ log_radv_errno(r, "Unable to send Router Advertisement for added route prefix: %m");
+ else
+ log_radv("Sent Router Advertisement for added route prefix");
+ }
+
update:
r = sd_event_now(ra->event, clock_boottime_or_monotonic(), &time_now);
if (r < 0)
test_config_parse_duid_rawdata_one("11::", 0, &(DUID){0, 1, {0x11}}); /* FIXME: should this be an error? */
test_config_parse_duid_rawdata_one("abcdef", 0, &(DUID){});
test_config_parse_duid_rawdata_one(BYTES_0_128, 0, &(DUID){});
- test_config_parse_duid_rawdata_one(BYTES_0_128 + 2, 0, &(DUID){0, 128, BYTES_1_128});
+ test_config_parse_duid_rawdata_one(&BYTES_0_128[2], 0, &(DUID){0, 128, BYTES_1_128});
}
static void test_config_parse_hwaddr(void) {
return bus_log_create_error(r);
r = sd_bus_call(bus, req, 0, error, NULL);
- if (r < 0 && extended && sd_bus_error_has_name(error, SD_BUS_ERROR_UNKNOWN_METHOD))
+ if (r < 0 && extended && sd_bus_error_has_name(error, SD_BUS_ERROR_UNKNOWN_METHOD)) {
+ sd_bus_error_free(error);
return call_dns(bus, dns, locator, error, false);
+ }
return r;
}
#include "errno-util.h"
#include "macro.h"
-/* 4MB for contents of regular files, 64k inodes for directories, symbolic links and device specials,
- using large storage array systems as a baseline */
+/* 4MB for contents of regular files, 64k inodes for directories, symbolic links and device specials, using
+ * large storage array systems as a baseline */
#define TMPFS_LIMITS_DEV ",size=4m,nr_inodes=64k"
+
/* Very little, if any use expected */
#define TMPFS_LIMITS_EMPTY_OR_ALMOST ",size=4m,nr_inodes=1k"
#define TMPFS_LIMITS_SYS TMPFS_LIMITS_EMPTY_OR_ALMOST
#define TMPFS_LIMITS_SYS_FS_CGROUP TMPFS_LIMITS_EMPTY_OR_ALMOST
-/* On an extremely small device with only 256MB of RAM, 20% of RAM for /run should be enough for re-exec of
- PID1 because 16MB of free space is required. */
+
+/* On an extremely small device with only 256MB of RAM, 20% of RAM should be enough for the re-execution of
+ * PID1 because 16MB of free space is required. */
#define TMPFS_LIMITS_RUN ",size=20%,nr_inodes=800k"
-/* 10% of RAM (using 16GB of RAM as a baseline) translates to 400k inodes (assuming 4k each) and 25%
- translates to 1M inodes */
+
+/* The limit used for various tmpfs mounts, but not /tmp itself.
+ * 10% of RAM (using 16GB of RAM as a baseline) translates to 400k inodes (assuming 4k each) and 25%
+ * translates to 1M inodes.
+ * /tmp is configured through a .mount unit file. */
#define TMPFS_LIMITS_TMP ",size=10%,nr_inodes=400k"
#define TMPFS_LIMITS_DEV_SHM TMPFS_LIMITS_TMP
#define TMPFS_LIMITS_TEMPORARY_FS TMPFS_LIMITS_TMP
+
/* More space for volatile root and /var */
#define TMPFS_LIMITS_VAR ",size=25%,nr_inodes=1m"
#define TMPFS_LIMITS_ROOTFS TMPFS_LIMITS_VAR
static void test_auto_erase_memory(void) {
_cleanup_(erase_and_freep) uint8_t *p1, *p2;
+ /* print address of p2, else e.g. clang-11 will optimize it out */
+ log_debug("p1: %p p2: %p", &p1, &p2);
+
assert_se(p1 = new(uint8_t, 1024));
assert_se(p2 = new(uint8_t, 1024));
int r;
r = cg_path_decode_unit(path, &unit);
- printf("%s: %s → %s %d expected %s %d\n", __func__, path, unit, r, result, code);
+ printf("%s: %s → %s %d expected %s %d\n", __func__, path, unit, r, strnull(result), code);
assert_se(r == code);
assert_se(streq_ptr(unit, result));
}
int r;
r = cg_path_get_unit(path, &unit);
- printf("%s: %s → %s %d expected %s %d\n", __func__, path, unit, r, result, code);
+ printf("%s: %s → %s %d expected %s %d\n", __func__, path, unit, r, strnull(result), code);
assert_se(r == code);
assert_se(streq_ptr(unit, result));
}
int r;
r = cg_path_get_user_unit(path, &unit);
- printf("%s: %s → %s %d expected %s %d\n", __func__, path, unit, r, result, code);
+ printf("%s: %s → %s %d expected %s %d\n", __func__, path, unit, r, strnull(result), code);
assert_se(r == code);
assert_se(streq_ptr(unit, result));
}
log_info("scenario #%zu:, expected result %i", i, scenarios[i].expected_result);
log_info("%s", scenarios[i].contents);
rewind(f);
- ftruncate(fileno(f), 0);
+ assert_se(ftruncate(fileno(f), 0) == 0);
assert_se(write_string_stream(f, scenarios[i].contents, WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
assert_se(clock_is_localtime(adjtime) == scenarios[i].expected_result);
}
What=tmpfs
Where=/tmp
Type=tmpfs
-Options=mode=1777,strictatime,nosuid,nodev,size=10%,nr_inodes=400k
+Options=mode=1777,strictatime,nosuid,nodev,size=50%,nr_inodes=400k