diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/debian/changelog systemd-251.635.g1f7eed4c3504+22.10.20220707173420/debian/changelog --- systemd-251.614.g132b63bd3131+22.10.20220706180724/debian/changelog 2022-07-06 18:07:10.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/debian/changelog 2022-07-07 17:34:07.000000000 +0000 @@ -1,14 +1,14 @@ -systemd (251.614.g132b63bd3131+22.10.20220706180724) kinetic; urgency=medium +systemd (251.635.g1f7eed4c3504+22.10.20220707173420) kinetic; urgency=medium * Daily build - -- Daily Builder Wed, 06 Jul 2022 18:07:24 +0000 + -- Daily Builder Thu, 07 Jul 2022 17:34:20 +0000 -systemd (1.0.0+202207061807~ubuntu22.10.1) kinetic; urgency=low +systemd (1.0.0+202207071734~ubuntu22.10.1) kinetic; urgency=low * Auto build. - -- Ubuntu Support Team Wed, 06 Jul 2022 18:07:10 +0000 + -- Ubuntu Support Team Thu, 07 Jul 2022 17:34:07 +0000 systemd (1.0.0) UNRELEASED; urgency=medium diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/debian/git-build-recipe.manifest systemd-251.635.g1f7eed4c3504+22.10.20220707173420/debian/git-build-recipe.manifest --- systemd-251.614.g132b63bd3131+22.10.20220706180724/debian/git-build-recipe.manifest 2022-07-06 18:07:10.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/debian/git-build-recipe.manifest 2022-07-07 17:34:07.000000000 +0000 @@ -1,3 +1,3 @@ -# git-build-recipe format 0.4 deb-version {debversion}+202207061807 -lp:systemd git-commit:132b63bd3131bc72b92adfcfa434fc2ed8648487 +# git-build-recipe format 0.4 deb-version {debversion}+202207071734 +lp:systemd git-commit:1f7eed4c3504ea6e852d64057c1e6b8df2091eeb nest-part daily-build lp:~ubuntu-support-team/ubuntu/+source/daily-build debian debian git-commit:b1cdf35d6b2761fcb9bc167ea875fe77daee325c diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/man/os-release.xml systemd-251.635.g1f7eed4c3504+22.10.20220707173420/man/os-release.xml --- systemd-251.614.g132b63bd3131+22.10.20220706180724/man/os-release.xml 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/man/os-release.xml 2022-07-07 17:32:56.000000000 +0000 @@ -351,6 +351,16 @@ + SUPPORT_END= + + The date at which support for this version of the OS ends. (What exactly "lack of + support" means varies between vendors, but generally users should assume that updates, including + security fixes, will not be provided.) The value is a date in the format + YYYY-MM-DD, and specifies the last day on which support is + provided. + + + LOGO= A string, specifying the name of an icon as defined by systemd-resolved.service8 resolver service. By default, the specified list of parameters will be resolved as hostnames, retrieving their IPv4 - and IPv6 addresses. If the parameters specified are formatted as IPv4 or IPv6 operation the reverse operation is + and IPv6 addresses. If the parameters specified are formatted as IPv4 or IPv6 addresses the reverse operation is done, and a hostname is retrieved for the specified addresses. The program's output contains information about the protocol used for the look-up and on which network diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/NEWS systemd-251.635.g1f7eed4c3504+22.10.20220707173420/NEWS --- systemd-251.614.g132b63bd3131+22.10.20220706180724/NEWS 2022-07-06 18:05:00.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/NEWS 2022-07-07 17:32:56.000000000 +0000 @@ -1,5 +1,13 @@ systemd System and Service Manager +CHANGES WITH 252: + Backwards-incompatible changes: + + * systemd-logind's background session class, which is by default used + for sessions started via cron, is no longer going to start systemd + --user instance. Note that because of that the user dbus instance + will not start either. Other session types remain unaffected. + CHANGES WITH 251: Backwards-incompatible changes: diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/boot.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/boot.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/boot.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/boot.c 2022-07-07 17:32:56.000000000 +0000 @@ -1806,7 +1806,7 @@ static bool is_sd_boot(EFI_FILE *root_dir, const char16_t *loader_path) { EFI_STATUS err; - const char *sections[] = { + static const char * const sections[] = { ".sdmagic", NULL }; @@ -1935,7 +1935,7 @@ /* Look for BitLocker magic string on all block drives. */ bool found = false; for (UINTN i = 0; i < n_handles; i++) { - EFI_BLOCK_IO *block_io; + EFI_BLOCK_IO_PROTOCOL *block_io; err = BS->HandleProtocol(handles[i], &BlockIoProtocol, (void **) &block_io); if (err != EFI_SUCCESS || block_io->Media->BlockSize < 512 || block_io->Media->BlockSize > 4096) continue; @@ -2082,7 +2082,7 @@ continue; /* look for .osrel and .cmdline sections in the .efi binary */ - err = pe_file_locate_sections(linux_dir, f->FileName, (const char **) sections, offs, szs); + err = pe_file_locate_sections(linux_dir, f->FileName, sections, offs, szs); if (err != EFI_SUCCESS || szs[SECTION_OSREL] == 0) continue; @@ -2328,7 +2328,7 @@ if (err != EFI_SUCCESS) return log_error_status_stall(err, L"Error registering initrd: %r", err); - EFI_LOADED_IMAGE *loaded_image; + EFI_LOADED_IMAGE_PROTOCOL *loaded_image; err = BS->HandleProtocol(image, &LoadedImageProtocol, (void **) &loaded_image); if (err != EFI_SUCCESS) return log_error_status_stall(err, L"Error getting LoadedImageProtocol handle: %r", err); @@ -2430,7 +2430,7 @@ } static void export_variables( - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, const char16_t *loaded_image_path, uint64_t init_usec) { @@ -2472,7 +2472,7 @@ static void config_load_all_entries( Config *config, - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, const char16_t *loaded_image_path, EFI_FILE *root_dir) { @@ -2527,7 +2527,7 @@ } EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { - EFI_LOADED_IMAGE *loaded_image; + EFI_LOADED_IMAGE_PROTOCOL *loaded_image; _cleanup_(file_closep) EFI_FILE *root_dir = NULL; _cleanup_(config_free) Config config = {}; char16_t *loaded_image_path; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/cpio.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/cpio.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/cpio.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/cpio.c 2022-07-07 17:32:56.000000000 +0000 @@ -305,7 +305,7 @@ } EFI_STATUS pack_cpio( - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, const char16_t *dropin_dir, const char16_t *match_suffix, const char *target_dir_prefix, @@ -325,7 +325,6 @@ _cleanup_freepool_ void *buffer = NULL; uint32_t inode = 1; /* inode counter, so that each item gets a new inode */ EFI_STATUS err; - EFI_FILE_IO_INTERFACE *volume; assert(loaded_image); assert(target_dir_prefix); @@ -339,23 +338,16 @@ return EFI_SUCCESS; } - err = BS->HandleProtocol(loaded_image->DeviceHandle, - &FileSystemProtocol, (void*)&volume); - /* Error will be unsupported if the bootloader doesn't implement the - * file system protocol on its file handles. - */ + err = open_volume(loaded_image->DeviceHandle, &root); if (err == EFI_UNSUPPORTED) { + /* Error will be unsupported if the bootloader doesn't implement the file system protocol on + * its file handles. */ *ret_buffer = NULL; *ret_buffer_size = 0; return EFI_SUCCESS; } if (err != EFI_SUCCESS) return log_error_status_stall( - err, L"Unable to load file system protocol: %r", err); - - err = volume->OpenVolume(volume, &root); - if (err != EFI_SUCCESS) - return log_error_status_stall( err, L"Unable to open root directory: %r", err); if (!dropin_dir) diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/cpio.h systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/cpio.h --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/cpio.h 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/cpio.h 2022-07-07 17:32:56.000000000 +0000 @@ -5,7 +5,7 @@ #include EFI_STATUS pack_cpio( - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, const char16_t *dropin_dir, const char16_t *match_suffix, const char *target_dir_prefix, diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/drivers.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/drivers.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/drivers.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/drivers.c 2022-07-07 17:32:56.000000000 +0000 @@ -8,7 +8,7 @@ static EFI_STATUS load_one_driver( EFI_HANDLE parent_image, - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, const char16_t *fname) { _cleanup_(unload_imagep) EFI_HANDLE image = NULL; @@ -74,7 +74,7 @@ EFI_STATUS load_drivers( EFI_HANDLE parent_image, - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, EFI_FILE *root_dir) { _cleanup_(file_closep) EFI_FILE *drivers_dir = NULL; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/drivers.h systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/drivers.h --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/drivers.h 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/drivers.h 2022-07-07 17:32:56.000000000 +0000 @@ -5,5 +5,5 @@ EFI_STATUS load_drivers( EFI_HANDLE parent_image, - EFI_LOADED_IMAGE *loaded_image, + EFI_LOADED_IMAGE_PROTOCOL *loaded_image, EFI_FILE *root_dir); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/linux.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/linux.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/linux.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/linux.c 2022-07-07 17:32:56.000000000 +0000 @@ -16,7 +16,7 @@ #include "pe.h" #include "util.h" -static EFI_LOADED_IMAGE * loaded_image_free(EFI_LOADED_IMAGE *img) { +static EFI_LOADED_IMAGE_PROTOCOL *loaded_image_free(EFI_LOADED_IMAGE_PROTOCOL *img) { if (!img) return NULL; mfree(img->LoadOptions); @@ -28,7 +28,7 @@ const void *linux_buffer, UINTN linux_length, EFI_HANDLE *ret_image) { - EFI_LOADED_IMAGE *loaded_image = NULL; + EFI_LOADED_IMAGE_PROTOCOL *loaded_image = NULL; EFI_STATUS err; assert(cmdline || cmdline_len > 0); @@ -36,8 +36,8 @@ assert(ret_image); /* create and install new LoadedImage Protocol */ - loaded_image = xnew(EFI_LOADED_IMAGE, 1); - *loaded_image = (EFI_LOADED_IMAGE) { + loaded_image = xnew(EFI_LOADED_IMAGE_PROTOCOL, 1); + *loaded_image = (EFI_LOADED_IMAGE_PROTOCOL) { .ImageBase = (void *) linux_buffer, .ImageSize = linux_length }; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/pe.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/pe.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/pe.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/pe.c 2022-07-07 17:32:56.000000000 +0000 @@ -30,7 +30,7 @@ # define TARGET_MACHINE_TYPE_COMPATIBILITY 0 #endif -struct DosFileHeader { +typedef struct DosFileHeader { uint8_t Magic[2]; uint16_t LastSize; uint16_t nBlocks; @@ -50,9 +50,9 @@ uint16_t OEMInfo; uint16_t reserved2[10]; uint32_t ExeHeader; -} _packed_; +} _packed_ DosFileHeader; -struct CoffFileHeader { +typedef struct CoffFileHeader { uint16_t Machine; uint16_t NumberOfSections; uint32_t TimeDateStamp; @@ -60,12 +60,12 @@ uint32_t NumberOfSymbols; uint16_t SizeOfOptionalHeader; uint16_t Characteristics; -} _packed_; +} _packed_ CoffFileHeader; #define OPTHDR32_MAGIC 0x10B /* PE32 OptionalHeader */ #define OPTHDR64_MAGIC 0x20B /* PE32+ OptionalHeader */ -struct PeOptionalHeader { +typedef struct PeOptionalHeader { uint16_t Magic; uint8_t LinkerMajor; uint8_t LinkerMinor; @@ -96,15 +96,15 @@ uint16_t Subsystem; uint16_t DllCharacteristics; /* fields with different sizes for 32/64 omitted */ -} _packed_; +} _packed_ PeOptionalHeader; -struct PeFileHeader { +typedef struct PeFileHeader { uint8_t Magic[4]; - struct CoffFileHeader FileHeader; - struct PeOptionalHeader OptionalHeader; -} _packed_; + CoffFileHeader FileHeader; + PeOptionalHeader OptionalHeader; +} _packed_ PeFileHeader; -struct PeSectionHeader { +typedef struct PeSectionHeader { uint8_t Name[8]; uint32_t VirtualSize; uint32_t VirtualAddress; @@ -115,14 +115,14 @@ uint16_t NumberOfRelocations; uint16_t NumberOfLinenumbers; uint32_t Characteristics; -} _packed_; +} _packed_ PeSectionHeader; -static inline bool verify_dos(const struct DosFileHeader *dos) { +static inline bool verify_dos(const DosFileHeader *dos) { assert(dos); return memcmp(dos->Magic, DOS_FILE_MAGIC, STRLEN(DOS_FILE_MAGIC)) == 0; } -static inline bool verify_pe(const struct PeFileHeader *pe, bool allow_compatibility) { +static inline bool verify_pe(const PeFileHeader *pe, bool allow_compatibility) { assert(pe); return memcmp(pe->Magic, PE_FILE_MAGIC, STRLEN(PE_FILE_MAGIC)) == 0 && (pe->FileHeader.Machine == TARGET_MACHINE_TYPE || @@ -132,16 +132,16 @@ IN_SET(pe->OptionalHeader.Magic, OPTHDR32_MAGIC, OPTHDR64_MAGIC); } -static inline UINTN section_table_offset(const struct DosFileHeader *dos, const struct PeFileHeader *pe) { +static inline UINTN section_table_offset(const DosFileHeader *dos, const PeFileHeader *pe) { assert(dos); assert(pe); - return dos->ExeHeader + offsetof(struct PeFileHeader, OptionalHeader) + pe->FileHeader.SizeOfOptionalHeader; + return dos->ExeHeader + offsetof(PeFileHeader, OptionalHeader) + pe->FileHeader.SizeOfOptionalHeader; } static void locate_sections( - const struct PeSectionHeader section_table[], + const PeSectionHeader section_table[], UINTN n_table, - const char **sections, + const char * const sections[], UINTN *addrs, UINTN *offsets, UINTN *sizes) { @@ -151,7 +151,7 @@ assert(sizes); for (UINTN i = 0; i < n_table; i++) { - const struct PeSectionHeader *sect = section_table + i; + const PeSectionHeader *sect = section_table + i; for (UINTN j = 0; sections[j]; j++) { if (memcmp(sect->Name, sections[j], strlen8(sections[j])) != 0) @@ -166,7 +166,7 @@ } } -static uint32_t get_compatibility_entry_address(const struct DosFileHeader *dos, const struct PeFileHeader *pe) { +static uint32_t get_compatibility_entry_address(const DosFileHeader *dos, const PeFileHeader *pe) { UINTN addr = 0, size = 0; static const char *sections[] = { ".compat", NULL }; @@ -174,7 +174,7 @@ * booting a 64bit kernel on 32bit EFI that is otherwise running on a 64bit CPU. The locations of any * such compat entry points are located in a special PE section. */ - locate_sections((const struct PeSectionHeader *) ((const uint8_t *) dos + section_table_offset(dos, pe)), + locate_sections((const PeSectionHeader *) ((const uint8_t *) dos + section_table_offset(dos, pe)), pe->FileHeader.NumberOfSections, sections, &addr, @@ -215,17 +215,17 @@ uint32_t *ret_size_of_image, uint32_t *ret_section_alignment) { - const struct DosFileHeader *dos; - const struct PeFileHeader *pe; + const DosFileHeader *dos; + const PeFileHeader *pe; assert(base); assert(ret_entry_point_address); - dos = (const struct DosFileHeader *) base; + dos = (const DosFileHeader *) base; if (!verify_dos(dos)) return EFI_LOAD_ERROR; - pe = (const struct PeFileHeader*) ((const uint8_t *)base + dos->ExeHeader); + pe = (const PeFileHeader *) ((const uint8_t *) base + dos->ExeHeader); if (!verify_pe(pe, /* allow_compatibility= */ true)) return EFI_LOAD_ERROR; @@ -247,13 +247,9 @@ return EFI_SUCCESS; } -EFI_STATUS pe_memory_locate_sections( - const char *base, - const char **sections, - UINTN *addrs, - UINTN *sizes) { - const struct DosFileHeader *dos; - const struct PeFileHeader *pe; +EFI_STATUS pe_memory_locate_sections(const void *base, const char * const sections[], UINTN *addrs, UINTN *sizes) { + const DosFileHeader *dos; + const PeFileHeader *pe; UINTN offset; assert(base); @@ -261,17 +257,21 @@ assert(addrs); assert(sizes); - dos = (const struct DosFileHeader*)base; + dos = (const DosFileHeader *) base; if (!verify_dos(dos)) return EFI_LOAD_ERROR; - pe = (const struct PeFileHeader*)&base[dos->ExeHeader]; + pe = (const PeFileHeader *) ((uint8_t *) base + dos->ExeHeader); if (!verify_pe(pe, /* allow_compatibility= */ false)) return EFI_LOAD_ERROR; offset = section_table_offset(dos, pe); - locate_sections((struct PeSectionHeader*)&base[offset], pe->FileHeader.NumberOfSections, - sections, addrs, NULL, sizes); + locate_sections((PeSectionHeader *) ((uint8_t *) base + offset), + pe->FileHeader.NumberOfSections, + sections, + addrs, + NULL, + sizes); return EFI_SUCCESS; } @@ -279,13 +279,13 @@ EFI_STATUS pe_file_locate_sections( EFI_FILE *dir, const char16_t *path, - const char **sections, + const char * const sections[], UINTN *offsets, UINTN *sizes) { - _cleanup_freepool_ struct PeSectionHeader *section_table = NULL; + _cleanup_freepool_ PeSectionHeader *section_table = NULL; _cleanup_(file_closep) EFI_FILE *handle = NULL; - struct DosFileHeader dos; - struct PeFileHeader pe; + DosFileHeader dos; + PeFileHeader pe; UINTN len, section_table_len; EFI_STATUS err; @@ -317,7 +317,7 @@ if (len != sizeof(pe) || !verify_pe(&pe, /* allow_compatibility= */ false)) return EFI_LOAD_ERROR; - section_table_len = pe.FileHeader.NumberOfSections * sizeof(struct PeSectionHeader); + section_table_len = pe.FileHeader.NumberOfSections * sizeof(PeSectionHeader); section_table = xmalloc(section_table_len); if (!section_table) return EFI_OUT_OF_RESOURCES; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/pe.h systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/pe.h --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/pe.h 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/pe.h 2022-07-07 17:32:56.000000000 +0000 @@ -5,15 +5,15 @@ #include EFI_STATUS pe_memory_locate_sections( - const char *base, - const char **sections, + const void *base, + const char * const sections[], UINTN *addrs, UINTN *sizes); EFI_STATUS pe_file_locate_sections( EFI_FILE *dir, const char16_t *path, - const char **sections, + const char * const sections[], UINTN *offsets, UINTN *sizes); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/stub.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/stub.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/stub.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/stub.c 2022-07-07 17:32:56.000000000 +0000 @@ -101,7 +101,7 @@ return EFI_SUCCESS; } -static void export_variables(EFI_LOADED_IMAGE *loaded_image) { +static void export_variables(EFI_LOADED_IMAGE_PROTOCOL *loaded_image) { char16_t uuid[37]; assert(loaded_image); @@ -173,7 +173,7 @@ _cleanup_freepool_ void *sysext_initrd = NULL; EFI_PHYSICAL_ADDRESS linux_base, initrd_base, dt_base; _cleanup_(devicetree_cleanup) struct devicetree_state dt_state = {}; - EFI_LOADED_IMAGE *loaded_image; + EFI_LOADED_IMAGE_PROTOCOL *loaded_image; UINTN addrs[_SECTION_MAX] = {}; UINTN szs[_SECTION_MAX] = {}; char *cmdline = NULL; @@ -195,7 +195,7 @@ if (err != EFI_SUCCESS) return log_error_status_stall(err, L"Error getting a LoadedImageProtocol handle: %r", err); - err = pe_memory_locate_sections(loaded_image->ImageBase, (const char **) sections, addrs, szs); + err = pe_memory_locate_sections(loaded_image->ImageBase, sections, addrs, szs); if (err != EFI_SUCCESS || szs[SECTION_LINUX] == 0) { if (err == EFI_SUCCESS) err = EFI_NOT_FOUND; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/xbootldr.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/xbootldr.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/boot/efi/xbootldr.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/boot/efi/xbootldr.c 2022-07-07 17:32:56.000000000 +0000 @@ -85,7 +85,7 @@ } static EFI_STATUS try_gpt( - EFI_BLOCK_IO *block_io, + EFI_BLOCK_IO_PROTOCOL *block_io, EFI_LBA lba, EFI_LBA *ret_backup_lba, /* May be changed even on error! */ HARDDRIVE_DEVICE_PATH *ret_hd) { @@ -195,7 +195,7 @@ EFI_DEVICE_PATH *p = disk_path = path_chop(partition_path, part_node); EFI_HANDLE disk_handle; - EFI_BLOCK_IO *block_io; + EFI_BLOCK_IO_PROTOCOL *block_io; err = BS->LocateDevicePath(&BlockIoProtocol, &p, &disk_handle); if (err != EFI_SUCCESS) return err; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/core/execute.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/core/execute.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/core/execute.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/core/execute.c 2022-07-07 17:32:56.000000000 +0000 @@ -1213,13 +1213,15 @@ if (getttyname_malloc(STDIN_FILENO, &q) >= 0) tty = strjoina("/dev/", q); + else + /* If everything else failed then let's just use value "systemd". This will cause that session + * isn't going to be marked as "background" and user manager will be started. */ + tty = "systemd"; } - if (tty) { - pam_code = pam_set_item(handle, PAM_TTY, tty); - if (pam_code != PAM_SUCCESS) - goto fail; - } + pam_code = pam_set_item(handle, PAM_TTY, tty); + if (pam_code != PAM_SUCCESS) + goto fail; STRV_FOREACH(nv, *env) { pam_code = pam_putenv(handle, *nv); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/fundamental/macro-fundamental.h systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/fundamental/macro-fundamental.h --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/fundamental/macro-fundamental.h 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/fundamental/macro-fundamental.h 2022-07-07 17:32:56.000000000 +0000 @@ -42,7 +42,7 @@ # define _alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__))) #endif -#if __GNUC__ >= 7 || __clang__ +#if __GNUC__ >= 7 || (defined(__clang__) && __clang_major__ >= 10) # define _fallthrough_ __attribute__((__fallthrough__)) #else # define _fallthrough_ diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind.c 2022-07-07 17:32:56.000000000 +0000 @@ -963,18 +963,33 @@ n = now(CLOCK_MONOTONIC); r = manager_get_idle_hint(m, &since); - if (r <= 0) + if (r <= 0) { /* Not idle. Let's check if after a timeout it might be idle then. */ elapse = n + m->idle_action_usec; - else { + m->was_idle = false; + } else { + /* Idle! Let's see if it's time to do something, or if * we shall sleep for longer. */ if (n >= since.monotonic + m->idle_action_usec && (m->idle_action_not_before_usec <= 0 || n >= m->idle_action_not_before_usec + m->idle_action_usec)) { - log_info("System idle. Will %s now.", handle_action_verb_to_string(m->idle_action)); + bool is_edge = false; - manager_handle_action(m, 0, m->idle_action, false, false); + /* We weren't idle previously or some activity happened while we were sleeping, and now we are + * idle. Let's remember that for the next time and make this an edge transition. */ + if (!m->was_idle || since.monotonic >= m->idle_action_not_before_usec) { + is_edge = true; + m->was_idle = true; + } + + if (m->idle_action == HANDLE_LOCK && !is_edge) + /* We are idle and we were before so we are actually not taking any action. */ + log_debug("System idle."); + else + log_info("System idle. Will %s now.", handle_action_verb_to_string(m->idle_action)); + + manager_handle_action(m, 0, m->idle_action, false, is_edge); m->idle_action_not_before_usec = n; } @@ -1026,7 +1041,6 @@ int r; Seat *seat; Session *session; - User *user; Button *button; Inhibitor *inhibitor; @@ -1103,9 +1117,7 @@ HASHMAP_FOREACH(seat, m->seats) (void) seat_start(seat); - HASHMAP_FOREACH(user, m->users) - (void) user_start(user); - + /* Users are started by respective sessions */ HASHMAP_FOREACH(session, m->sessions) (void) session_start(session, NULL, NULL); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-dbus.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-dbus.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-dbus.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-dbus.c 2022-07-07 17:32:56.000000000 +0000 @@ -1305,7 +1305,7 @@ return r; if (manager_add_user_by_uid(m, uid, &u) >= 0) - user_start(u); + user_start(u, /* want_user_instance= */ true); } else { User *u; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind.h systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind.h --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind.h 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind.h 2022-07-07 17:32:56.000000000 +0000 @@ -94,6 +94,7 @@ usec_t idle_action_usec; usec_t idle_action_not_before_usec; HandleAction idle_action; + bool was_idle; HandleAction handle_power_key; HandleAction handle_power_key_long_press; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-session.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-session.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-session.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-session.c 2022-07-07 17:32:56.000000000 +0000 @@ -664,12 +664,12 @@ description, /* These two have StopWhenUnneeded= set, hence add a dep towards them */ STRV_MAKE(s->user->runtime_dir_service, - s->user->service), + s->class != SESSION_BACKGROUND ? s->user->service : NULL), /* And order us after some more */ STRV_MAKE("systemd-logind.service", "systemd-user-sessions.service", s->user->runtime_dir_service, - s->user->service), + s->class != SESSION_BACKGROUND ? s->user->service : NULL), user_record_home_directory(s->user->user_record), properties, error, @@ -700,7 +700,7 @@ if (s->started) return 0; - r = user_start(s->user); + r = user_start(s->user, /* want_user_instance= */ s->class != SESSION_BACKGROUND); if (r < 0) return r; diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-user.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-user.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-user.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-user.c 2022-07-07 17:32:56.000000000 +0000 @@ -442,7 +442,7 @@ return 0; } -int user_start(User *u) { +int user_start(User *u, bool want_user_instance) { assert(u); if (u->started && !u->stopping) @@ -465,7 +465,8 @@ (void) user_update_slice(u); /* Start user@UID.service */ - user_start_service(u); + if (want_user_instance) + user_start_service(u); if (!u->started) { if (!dual_timestamp_is_set(&u->timestamp)) diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-user.h systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-user.h --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/logind-user.h 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/logind-user.h 2022-07-07 17:32:56.000000000 +0000 @@ -57,7 +57,7 @@ bool user_may_gc(User *u, bool drop_not_started); void user_add_to_gc_queue(User *u); -int user_start(User *u); +int user_start(User *u, bool need_user_instance); int user_stop(User *u, bool force); int user_finalize(User *u); UserState user_get_state(User *u); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/pam_systemd.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/pam_systemd.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/login/pam_systemd.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/login/pam_systemd.c 2022-07-07 17:32:56.000000000 +0000 @@ -790,7 +790,10 @@ * does the PAM session registration early for new connections, and registers a pty only * much later (this is because it doesn't know yet if it needs one at all, as whether to * register a pty or not is negotiated much later in the protocol). */ - + } else if (streq(tty, "systemd")) { + if (isempty(class)) + class = "user"; + tty = NULL; } else /* Chop off leading /dev prefix that some clients specify, but others do not. */ tty = skip_dev_prefix(tty); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/src/shared/dissect-image.c systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/shared/dissect-image.c --- systemd-251.614.g132b63bd3131+22.10.20220706180724/src/shared/dissect-image.c 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/src/shared/dissect-image.c 2022-07-07 17:32:56.000000000 +0000 @@ -3217,9 +3217,11 @@ * First, check the distro ID. If that matches, then check the new SYSEXT_LEVEL value if * available, or else fallback to VERSION_ID. If neither is present (eg: rolling release), * then a simple match on the ID will be performed. */ - if (!isempty(required_host_os_release_id)) { + if (required_host_os_release_id) { _cleanup_strv_free_ char **extension_release = NULL; + assert(!isempty(required_host_os_release_id)); + r = load_extension_release_pairs(dest, dissected_image->image_name, &extension_release); if (r < 0) return log_debug_errno(r, "Failed to parse image %s extension-release metadata: %m", dissected_image->image_name); diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/test/test-functions systemd-251.635.g1f7eed4c3504+22.10.20220707173420/test/test-functions --- systemd-251.614.g132b63bd3131+22.10.20220706180724/test/test-functions 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/test/test-functions 2022-07-07 17:32:56.000000000 +0000 @@ -1736,7 +1736,15 @@ # in Debian ldconfig is just a shell script wrapper around ldconfig.real image_install -o ldconfig.real # for TEST-35-LOGIN + image_install -o evemu-device evemu-event crond crontab image_install -o evemu-device evemu-event + if command -v expect >/dev/null && command -v tclsh >/dev/null ; then + # shellcheck disable=SC2016 + version="$(tclsh <<< 'puts $tcl_version')" + + image_install expect + inst_recursive /usr/lib64/tcl"$version" /usr/share/tcl"$version" + fi } install_debug_tools() { diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/test/units/testsuite-35.sh systemd-251.635.g1f7eed4c3504+22.10.20220707173420/test/units/testsuite-35.sh --- systemd-251.614.g132b63bd3131+22.10.20220706180724/test/units/testsuite-35.sh 2022-07-06 18:05:01.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/test/units/testsuite-35.sh 2022-07-07 17:32:56.000000000 +0000 @@ -360,6 +360,152 @@ fi } +setup_idle_action_lock() { + useradd testuser ||: + + mkdir -p /run/systemd/logind.conf.d/ + cat >/run/systemd/logind.conf.d/idle-action-lock.conf </dev/null ; then + echo >&2 "expect not installed, skipping test ${FUNCNAME[0]}" + return 0 + fi + + setup_idle_action_lock + trap teardown_idle_action_lock RETURN + + if loginctl --no-legend | awk '{ print $3; }' | sort -u | grep -q testuser ; then + echo >&2 "Session of the \'testuser\' is already present." + return 1 + fi + + # IdleActionSec is set 1s but the accuracy of associated timer is 30s so we + # need to sleep in worst case for 31s to make sure timer elapsed. We sleep + # here for 35s to accommodate for any possible scheduling delays. + cat > /tmp/test.exp < dbus.log & + + expect /tmp/test.exp & + + # Sleep a bit to give expect time to spawn systemd-run before we check for + # the presence of resulting session. + sleep 1 + if [ "$(loginctl --no-legend | awk '{ print $3; }' | sort -u | grep -c testuser)" != 1 ] ; then + echo >&2 "\'testuser\' is expected to have exactly one session running." + return 1 + fi + + wait %2 + kill %1 + + # We slept for 35s , in that interval all sessions should have become idle + # and "Lock" signal should have been sent out. Then we wrote to tty to make + # session active again and next we slept for another 35s so sessions have + # become idle again. 'Lock' signal is sent out for each session, we have at + # least one session, so minimum of 2 "Lock" signals must have been sent. + if [ "$(grep -c Member=Lock dbus.log)" -lt 2 ]; then + echo >&2 "Too few 'Lock' D-Bus signal sent, expected at least 2." + return 1 + fi + + journalctl -b -u systemd-logind.service --since="$ts" > logind.log + if [ "$(grep -c 'System idle. Will be locked now.' logind.log)" -lt 2 ]; then + echo >&2 "System haven't entered idle state at least 2 times." + return 1 + fi + + rm -f dbus.log logind.log +} + +setup_cron() { + # Setup test user and cron + useradd test || : + crond -s -n & + # Install crontab for the test user that runs sleep every minute. But let's sleep for + # 65 seconds to make sure there is overlap between two consecutive runs, i.e. we have + # always a cron session running. + crontab -u test - <&2 "Skipping test for background cron sessions because cron is missing." + return + fi + + trap teardown_cron EXIT + setup_cron + + if [[ $(loginctl --no-legend list-sessions | grep -c test) -lt 1 ]]; then + echo >&2 '"test" user should have at least one session' + loginctl list-sessions + return 1 + fi + + # Check that all sessions of test user have class=background and no user instance was started + # for the test user. + while read -r s _; do + local class + + class=$(loginctl --property Class --value show-session "$s") + if [[ "$class" != "background" ]]; then + echo >&2 "Session has incorrect class, expected \"background\", got \"$class\"." + return 1 + fi + done < <(loginctl --no-legend list-sessions | grep test) + + state=$(systemctl --property ActiveState --value show user@"$(id -u test)".service) + if [[ "$state" != "inactive" ]]; then + echo >&2 "User instance state is unexpected, expected \"inactive\", got \"$state\"" + return 1 + fi + + state=$(systemctl --property SubState --value show user@"$(id -u test)".service) + if [[ "$state" != "dead" ]]; then + echo >&2 "User instance state is unexpected, expected \"dead\", got \"$state\"" + return 1 + fi +} + : >/failed test_enable_debug @@ -368,6 +514,8 @@ test_suspend_on_lid test_shutdown test_session +test_lock_idle_action +test_no_user_instance_for_cron touch /testok rm /failed diff -Nru systemd-251.614.g132b63bd3131+22.10.20220706180724/TODO systemd-251.635.g1f7eed4c3504+22.10.20220707173420/TODO --- systemd-251.614.g132b63bd3131+22.10.20220706180724/TODO 2022-07-06 18:05:00.000000000 +0000 +++ systemd-251.635.g1f7eed4c3504+22.10.20220707173420/TODO 2022-07-07 17:32:56.000000000 +0000 @@ -83,7 +83,7 @@ chase_symlinks() instead * make persistent restarts easier by adding a new setting OpenPersistentFile= - or so, which allows openeing one or more files that is "persistent" across + or so, which allows opening one or more files that is "persistent" across service restarts, hot reboot, cold reboots (depending on configuration): the files are created empty on first invocation, and on subsequent invocations the files are reboot. The files would be backed by tmpfs, pmem or /var