diff options
Diffstat (limited to 'meta/recipes-core/systemd')
87 files changed, 3666 insertions, 3484 deletions
diff --git a/meta/recipes-core/systemd/systemd-boot_239.bb b/meta/recipes-core/systemd/systemd-boot_239.bb deleted file mode 100644 index 2450d52cb9..0000000000 --- a/meta/recipes-core/systemd/systemd-boot_239.bb +++ /dev/null @@ -1,70 +0,0 @@ -require systemd.inc -FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" - -DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" - -SRC_URI += "file://0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch \ - file://0006-remove-nobody-user-group-checking.patch \ - file://0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch \ - file://0001-meson-rename-Ddebug-to-Ddebug-extra.patch \ - " - -inherit meson pkgconfig gettext -inherit deploy - -EFI_CC ?= "${CC}" -EXTRA_OEMESON += "-Defi=true \ - -Dgnu-efi=true \ - -Defi-includedir=${STAGING_INCDIR}/efi \ - -Defi-ldsdir=${STAGING_LIBDIR} \ - -Defi-libdir=${STAGING_LIBDIR} \ - -Dman=false \ - -Defi-cc='${EFI_CC}' \ - -Defi-ld='${LD}' \ - " - -# install to the image as boot*.efi if its the EFI_PROVIDER, -# otherwise install as the full name. -# This allows multiple bootloaders to coexist in a single image. -python __anonymous () { - import re - target = d.getVar('TARGET_ARCH') - prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-" - if target == "x86_64": - systemdimage = prefix + "bootx64.efi" - else: - systemdimage = prefix + "bootia32.efi" - d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage) - prefix = "systemd-" if prefix == "" else "" - d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) -} - -FILES_${PN} = "/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE}" - -RDEPENDS_${PN} += "virtual/systemd-bootconf" - -# Imported from the old gummiboot recipe -TUNE_CCARGS_remove = "-mfpmath=sse" -COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux" -COMPATIBLE_HOST_x86-x32 = "null" - -do_compile() { - SYSTEMD_BOOT_EFI_ARCH="ia32" - if [ "${TARGET_ARCH}" = "x86_64" ]; then - SYSTEMD_BOOT_EFI_ARCH="x64" - fi - - ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} -} - -do_install() { - install -d ${D}/boot - install -d ${D}/boot/EFI - install -d ${D}/boot/EFI/BOOT - install ${B}/src/boot/efi/systemd-boot*.efi ${D}/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE} -} - -do_deploy () { - install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} -} -addtask deploy before do_build after do_compile diff --git a/meta/recipes-core/systemd/systemd-boot_250.4.bb b/meta/recipes-core/systemd/systemd-boot_250.4.bb new file mode 100644 index 0000000000..23a64bf30d --- /dev/null +++ b/meta/recipes-core/systemd/systemd-boot_250.4.bb @@ -0,0 +1,74 @@ +require systemd.inc +FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" + +require conf/image-uefi.conf + +DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native python3-jinja2-native" + +inherit meson pkgconfig gettext +inherit deploy + +LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " + +do_write_config[vardeps] += "CC OBJCOPY" +do_write_config:append() { + cat >${WORKDIR}/meson-${PN}.cross <<EOF +[binaries] +efi_cc = ${@meson_array('CC', d)} +objcopy = ${@meson_array('OBJCOPY', d)} +EOF +} + +# need to use ${HOST_PREFIX} here, otherwise ld.bfd could be used from HOSTTOOLS_NONFATAL +EFI_LD = "bfd" + +EXTRA_OEMESON += "-Defi=true \ + -Dgnu-efi=true \ + -Defi-includedir=${STAGING_INCDIR}/efi \ + -Defi-libdir=${STAGING_LIBDIR} \ + -Defi-ld=${EFI_LD} \ + -Dman=false \ + --cross-file ${WORKDIR}/meson-${PN}.cross \ + " + +# install to the image as boot*.efi if its the EFI_PROVIDER, +# otherwise install as the full name. +# This allows multiple bootloaders to coexist in a single image. +python __anonymous () { + import re + target = d.getVar('TARGET_ARCH') + prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-" + systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE") + d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage) + prefix = "systemd-" if prefix == "" else "" + d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) +} + +FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" + +RDEPENDS:${PN} += "virtual-systemd-bootconf" + +# Imported from the old gummiboot recipe +TUNE_CCARGS:remove = "-mfpmath=sse" + +COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux" +COMPATIBLE_HOST:x86-x32 = "null" + +do_compile() { + ninja \ + src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \ + src/boot/efi/linux${EFI_ARCH}.efi.stub +} + +do_install() { + install -d ${D}${EFI_FILES_PATH} + install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} +} + +do_deploy () { + install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} + install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR} +} + +addtask deploy before do_build after do_compile + diff --git a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb index e9c2466456..19637546a9 100644 --- a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb +++ b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb @@ -2,7 +2,8 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SUMMARY = "Basic systemd-boot configuration files" -RPROVIDES_${PN} += "virtual/systemd-bootconf" +RPROVIDES:${PN} += "virtual-systemd-bootconf" +PACKAGE_ARCH = "${MACHINE_ARCH}" inherit systemd-boot-cfg @@ -11,7 +12,7 @@ S = "${WORKDIR}" LABELS = "boot" ROOT ?= "root=/dev/sda2" -APPEND_append = " ${ROOT}" +APPEND:append = " ${ROOT}" python do_configure() { bb.build.exec_func('build_efi_cfg', d) @@ -28,4 +29,4 @@ do_install() { install *.conf ${D}/boot/loader/entries/ } -FILES_${PN} = "/boot/loader/* /boot/loader/entries/*" +FILES:${PN} = "/boot/loader/* /boot/loader/entries/*" diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb index d228a51c19..55ebf99117 100644 --- a/meta/recipes-core/systemd/systemd-compat-units.bb +++ b/meta/recipes-core/systemd/systemd-compat-units.bb @@ -8,9 +8,11 @@ PACKAGE_WRITE_DEPS += "systemd-systemctl-native" S = "${WORKDIR}" -inherit distro_features_check +inherit features_check -ALLOW_EMPTY_${PN} = "1" +INHIBIT_DEFAULT_DEPS = "1" + +ALLOW_EMPTY:${PN} = "1" REQUIRED_DISTRO_FEATURES = "systemd" @@ -23,7 +25,7 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \ syslog.busybox \ " -pkg_postinst_${PN} () { +pkg_postinst:${PN} () { cd $D${sysconfdir}/init.d || exit 0 @@ -36,7 +38,7 @@ pkg_postinst_${PN} () { fi for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do - if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service ] ; then + if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then echo -n "$i: " systemctl $OPTS mask $i.service fi @@ -44,4 +46,4 @@ pkg_postinst_${PN} () { echo } -RDEPENDS_${PN} = "systemd" +RDEPENDS:${PN} = "systemd" diff --git a/meta/recipes-core/systemd/systemd-conf.bb b/meta/recipes-core/systemd/systemd-conf.bb deleted file mode 100644 index 9bb27fd96d..0000000000 --- a/meta/recipes-core/systemd/systemd-conf.bb +++ /dev/null @@ -1,53 +0,0 @@ -require systemd.inc - -SUMMARY = "Systemd system configuration" -DESCRIPTION = "Systemd may require slightly different configuration for \ -different machines. For example, qemu machines require a longer \ -DefaultTimeoutStartSec setting." - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -CONFFILES_${PN} = "${sysconfdir}/machine-id \ -${sysconfdir}/systemd/coredump.conf \ -${sysconfdir}/systemd/journald.conf \ -${sysconfdir}/systemd/logind.conf \ -${sysconfdir}/systemd/system.conf \ -${sysconfdir}/systemd/user.conf" - -FILES_${PN} = "${sysconfdir}/machine-id ${sysconfdir}/systemd" - -do_configure[noexec] = '1' -do_compile[noexec] = '1' - -do_install() { - rm -rf ${D}/${sysconfdir}/systemd - install -d ${D}/${sysconfdir}/systemd - - # Create machine-id - # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable - touch ${D}${sysconfdir}/machine-id - - install -m 0644 ${S}/src/coredump/coredump.conf ${D}${sysconfdir}/systemd/coredump.conf - - install -m 0644 ${S}/src/journal/journald.conf ${D}${sysconfdir}/systemd/journald.conf - # Enable journal to forward message to syslog daemon - sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf - # Set the maximium size of runtime journal to 64M as default - sed -i -e 's/.*RuntimeMaxUse.*/RuntimeMaxUse=64M/' ${D}${sysconfdir}/systemd/journald.conf - - install -m 0644 ${S}/src/login/logind.conf.in ${D}${sysconfdir}/systemd/logind.conf - # Set KILL_USER_PROCESSES to yes - sed -i -e 's/@KILL_USER_PROCESSES@/yes/' ${D}${sysconfdir}/systemd/logind.conf - - install -m 0644 ${S}/src/core/system.conf.in ${D}${sysconfdir}/systemd/system.conf - # Set MEMORY_ACCOUNTING_DEFAULT to yes - sed -i -e 's/@MEMORY_ACCOUNTING_DEFAULT@/yes/' ${D}${sysconfdir}/systemd/system.conf - - install -m 0644 ${S}/src/core/user.conf ${D}${sysconfdir}/systemd/user.conf -} - -# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 -do_install_append_qemuall() { - # Change DefaultTimeoutStartSec from 90s to 240s - echo "DefaultTimeoutStartSec = 240s" >> ${D}${sysconfdir}/systemd/system.conf -} diff --git a/meta/recipes-core/systemd/systemd-conf/journald.conf b/meta/recipes-core/systemd/systemd-conf/journald.conf new file mode 100644 index 0000000000..fd4d969fa7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf/journald.conf @@ -0,0 +1,3 @@ +[Journal] +ForwardToSyslog=yes +RuntimeMaxUse=64M diff --git a/meta/recipes-core/systemd/systemd-conf/logind.conf b/meta/recipes-core/systemd/systemd-conf/logind.conf new file mode 100644 index 0000000000..bf7f6920fa --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf/logind.conf @@ -0,0 +1,2 @@ +[Login] +KillUserProcesses=yes diff --git a/meta/recipes-core/systemd/systemd-conf/system.conf b/meta/recipes-core/systemd/systemd-conf/system.conf new file mode 100644 index 0000000000..554cab26c2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf/system.conf @@ -0,0 +1,2 @@ +[Manager] +DefaultMemoryAccounting=yes diff --git a/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall b/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall new file mode 100644 index 0000000000..741be27cb4 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall @@ -0,0 +1,3 @@ +[Manager] +# Change DefaultTimeoutStartSec from 90s to 240s +DefaultTimeoutStartSec = 240s diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network new file mode 100644 index 0000000000..7406287248 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf/wired.network @@ -0,0 +1,13 @@ +[Match] +Type=ether +Name=!veth* +KernelCommandLine=!nfsroot +KernelCommandLine=!ip + +[Network] +DHCP=yes + +[DHCP] +UseMTU=yes +RouteMetric=10 +ClientIdentifier=mac diff --git a/meta/recipes-core/systemd/systemd-conf_1.0.bb b/meta/recipes-core/systemd/systemd-conf_1.0.bb new file mode 100644 index 0000000000..61ce7939d3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf_1.0.bb @@ -0,0 +1,43 @@ +SUMMARY = "Systemd system configuration" +DESCRIPTION = "Systemd may require slightly different configuration for \ +different machines. For example, qemu machines require a longer \ +DefaultTimeoutStartSec setting." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PE = "1" + +PACKAGECONFIG ??= "dhcp-ethernet" +PACKAGECONFIG[dhcp-ethernet] = "" + +SRC_URI = "\ + file://journald.conf \ + file://logind.conf \ + file://system.conf \ + file://system.conf-qemuall \ + file://wired.network \ +" + +do_install() { + install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf + install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf + install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf + + if ${@bb.utils.contains('PACKAGECONFIG', 'dhcp-ethernet', 'true', 'false', d)}; then + install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network + fi +} + +# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 +do_install:append:qemuall() { + install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +FILES:${PN} = "\ + ${systemd_unitdir}/journald.conf.d/ \ + ${systemd_unitdir}/logind.conf.d/ \ + ${systemd_unitdir}/system.conf.d/ \ + ${systemd_unitdir}/network/ \ +" diff --git a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb index 02756f43d7..12f27d6ae3 100644 --- a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb +++ b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb @@ -8,6 +8,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" PR = "r19" inherit systemd -SYSTEMD_SERVICE_${PN} = "" +SYSTEMD_SERVICE:${PN} = "" -ALLOW_EMPTY_${PN} = "1" +ALLOW_EMPTY:${PN} = "1" diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index 65a931f418..fd888bb834 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -1,27 +1,29 @@ SUMMARY = "Serial terminal support for systemd" HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/" -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" PR = "r5" SERIAL_CONSOLES ?= "115200;ttyS0" +SERIAL_TERM ?= "linux" SRC_URI = "file://serial-getty@.service" S = "${WORKDIR}" # As this package is tied to systemd, only build it when we're also building systemd. -inherit distro_features_check +inherit features_check REQUIRED_DISTRO_FEATURES = "systemd" do_install() { if [ ! -z "${SERIAL_CONSOLES}" ] ; then default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` - install -d ${D}${systemd_unitdir}/system/ + install -d ${D}${systemd_system_unitdir}/ install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ - install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/ - sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service + install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/ + sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service + sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service tmp="${SERIAL_CONSOLES}" for entry in $tmp ; do @@ -29,14 +31,14 @@ do_install() { ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` if [ "$baudrate" = "$default_baudrate" ] ; then # enable the service - ln -sf ${systemd_unitdir}/system/serial-getty@.service \ + ln -sf ${systemd_system_unitdir}/serial-getty@.service \ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service else # install custom service file for the non-default baudrate - install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service - sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service + install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service + sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service # enable the service - ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \ + ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service fi done @@ -44,7 +46,7 @@ do_install() { } # This is a machine specific file -FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" +FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}" PACKAGE_ARCH = "${MACHINE_ARCH}" -ALLOW_EMPTY_${PN} = "1" +ALLOW_EMPTY:${PN} = "1" diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service index e8b027e97d..b16fe1188e 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service +++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it @@ -9,8 +11,9 @@ Description=Serial Getty on %I Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=http://0pointer.de/blog/projects/serial-console.html -BindsTo=dev-%i.device -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service +PartOf=dev-%i.device +ConditionPathExists=/dev/%i +After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target After=rc-local.service # If additional gettys are spawned during boot then we should make @@ -19,12 +22,17 @@ After=rc-local.service Before=getty.target IgnoreOnIsolate=yes +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + [Service] -Environment="TERM=xterm" +Environment="TERM=@TERM@" ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM Type=idle Restart=always -RestartSec=0 UtmpIdentifier=%I TTYPath=/dev/%I TTYReset=yes diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 2bc6489617..6324319a45 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -1,196 +1,340 @@ -#!/bin/sh -echo "Started $0 $*" - -ROOT= - -# parse command line params -action= -while [ $# != 0 ]; do - opt="$1" - - case "$opt" in - enable) - shift - - action="$opt" - services="$1" - cmd_args="1" - shift - ;; - disable) - shift - - action="$opt" - services="$1" - cmd_args="1" - shift - ;; - mask) - shift - - action="$opt" - services="$1" - cmd_args="1" - shift - ;; - preset) - shift - - action="$opt" - services="$1" - cmd_args="1" - shift - ;; - --root=*) - ROOT=${opt##--root=} - cmd_args="0" - shift - ;; - *) - if [ "$cmd_args" = "1" ]; then - services="$services $opt" - shift - else - echo "'$opt' is an unkown option; exiting with error" - exit 1 - fi - ;; - esac -done -if [ "$action" = "preset" -a "$service_file" = "" ]; then - services=$(for f in `find $ROOT/etc/systemd/system $ROOT/lib/systemd/system $ROOT/usr/lib/systemd/system -type f 2>1`; do basename $f; done) - services="$services $opt" - presetall=1 -fi - -for service in $services; do - if [ "$presetall" = "1" ]; then - action="preset" - fi - if [ "$action" = "mask" ]; then - if [ ! -d $ROOT/etc/systemd/system/ ]; then - mkdir -p $ROOT/etc/systemd/system/ - fi - cmd="ln -s /dev/null $ROOT/etc/systemd/system/$service" - echo "$cmd" - $cmd - exit 0 - fi - - service_base_file=`echo $service | sed 's/\(@\).*\(\.[^.]\+\)/\1\2/'` - if [ -z `echo $service | sed '/@/p;d'` ]; then - echo "Try to find location of $service..." - service_template=false - else - echo "Try to find location of template $service_base_file of instance $service..." - service_template=true - instance_specified=`echo $service | sed 's/^.\+@\(.*\)\.[^.]\+/\1/'` - fi - - # find service file - for p in $ROOT/etc/systemd/system \ - $ROOT/lib/systemd/system \ - $ROOT/usr/lib/systemd/system; do - if [ -e $p/$service_base_file ]; then - service_file=$p/$service_base_file - service_file=${service_file##$ROOT} - fi - done - if [ -z "$service_file" ]; then - echo "'$service_base_file' couldn't be found; exiting with error" - exit 1 - fi - echo "Found $service in $service_file" - - # If any new unit types are added to systemd they should be added - # to this regular expression. - unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|target\.wants\|path\|timer\|snapshot\)\s*$' - if [ "$action" = "preset" ]; then - action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '` - if [ -z "$action" ]; then - globalpreset=`egrep -sh '\*' $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '` - if [ -n "$globalpreset" ]; then - action="$globalpreset" - else - action="enable" - fi - fi - fi - # create the required symbolic links - wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ - | tr ',' '\n' \ - | grep "$unit_types_re") - - required_by=$(sed '/^RequiredBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ - | tr ',' '\n' \ - | grep "$unit_types_re") - - for dependency in WantedBy RequiredBy; do - if [ "$dependency" = "WantedBy" ]; then - suffix="wants" - dependency_list="$wanted_by" - elif [ "$dependency" = "RequiredBy" ]; then - suffix="requires" - dependency_list="$required_by" - fi - for r in $dependency_list; do - echo "$dependency=$r found in $service" - if [ -n "$instance_specified" ]; then - # substitute wildcards in the dependency - r=`echo $r | sed "s/%i/$instance_specified/g"` - fi - - if [ "$action" = "enable" ]; then - enable_service=$service - if [ "$service_template" = true -a -z "$instance_specified" ]; then - default_instance=$(sed '/^DefaultInstance[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file") - if [ -z $default_instance ]; then - echo "Template unit without instance or DefaultInstance directive, nothing to enable" - continue - else - echo "Found DefaultInstance $default_instance, enabling it" - enable_service=$(echo $service | sed "s/@/@$(echo $default_instance | sed 's/\\/\\\\/g')/") - fi - fi - mkdir -p $ROOT/etc/systemd/system/$r.$suffix - ln -s $service_file $ROOT/etc/systemd/system/$r.$suffix/$enable_service - echo "Enabled $enable_service for $r." - else - if [ "$service_template" = true -a -z "$instance_specified" ]; then - disable_service="$ROOT/etc/systemd/system/$r.$suffix/`echo $service | sed 's/@/@*/'`" - else - disable_service="$ROOT/etc/systemd/system/$r.$suffix/$service" - fi - rm -f $disable_service - [ -d $ROOT/etc/systemd/system/$r.$suffix ] && rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.$suffix - echo "Disabled ${disable_service##$ROOT/etc/systemd/system/$r.$suffix/} for $r." - fi - done - done - - # create the required symbolic 'Alias' links - alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ - | tr ',' '\n' \ - | grep "$unit_types_re") - - for r in $alias; do - if [ "$action" = "enable" ]; then - mkdir -p $ROOT/etc/systemd/system - ln -s $service_file $ROOT/etc/systemd/system/$r - echo "Enabled $service for $alias." - else - rm -f $ROOT/etc/systemd/system/$r - echo "Disabled $service for $alias." - fi - done - - # call us for the other required scripts - also=$(sed '/^Also[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ - | tr ',' '\n') - for a in $also; do - echo "Also=$a found in $service" - if [ "$action" = "enable" ]; then - $0 --root=$ROOT enable $a - fi - done -done +#!/usr/bin/env python3 +"""systemctl: subset of systemctl used for image construction + +Mask/preset systemd units +""" + +import argparse +import fnmatch +import os +import re +import sys + +from collections import namedtuple +from pathlib import Path + +version = 1.0 + +ROOT = Path("/") +SYSCONFDIR = Path("etc") +BASE_LIBDIR = Path("lib") +LIBDIR = Path("usr", "lib") + +locations = list() + + +class SystemdFile(): + """Class representing a single systemd configuration file""" + def __init__(self, root, path): + self.sections = dict() + self._parse(root, path) + dirname = os.path.basename(path.name) + ".d" + for location in locations: + for path2 in sorted((root / location / "system" / dirname).glob("*.conf")): + self._parse(root, path2) + + def _parse(self, root, path): + """Parse a systemd syntax configuration file + + Args: + path: A pathlib.Path object pointing to the file + + """ + skip_re = re.compile(r"^\s*([#;]|$)") + section_re = re.compile(r"^\s*\[(?P<section>.*)\]") + kv_re = re.compile(r"^\s*(?P<key>[^\s]+)\s*=\s*(?P<value>.*)") + section = None + + if path.is_symlink(): + try: + path.resolve() + except FileNotFoundError: + # broken symlink, try relative to root + path = root / Path(os.readlink(str(path))).relative_to(ROOT) + + with path.open() as f: + for line in f: + if skip_re.match(line): + continue + + line = line.strip() + m = section_re.match(line) + if m: + if m.group('section') not in self.sections: + section = dict() + self.sections[m.group('section')] = section + else: + section = self.sections[m.group('section')] + continue + + while line.endswith("\\"): + line += f.readline().rstrip("\n") + + m = kv_re.match(line) + k = m.group('key') + v = m.group('value') + if k not in section: + section[k] = list() + section[k].extend(v.split()) + + def get(self, section, prop): + """Get a property from section + + Args: + section: Section to retrieve property from + prop: Property to retrieve + + Returns: + List representing all properties of type prop in section. + + Raises: + KeyError: if ``section`` or ``prop`` not found + """ + return self.sections[section][prop] + + +class Presets(): + """Class representing all systemd presets""" + def __init__(self, scope, root): + self.directives = list() + self._collect_presets(scope, root) + + def _parse_presets(self, presets): + """Parse presets out of a set of preset files""" + skip_re = re.compile(r"^\s*([#;]|$)") + directive_re = re.compile(r"^\s*(?P<action>enable|disable)\s+(?P<unit_name>(.+))") + + Directive = namedtuple("Directive", "action unit_name") + for preset in presets: + with preset.open() as f: + for line in f: + m = directive_re.match(line) + if m: + directive = Directive(action=m.group('action'), + unit_name=m.group('unit_name')) + self.directives.append(directive) + elif skip_re.match(line): + pass + else: + sys.exit("Unparsed preset line in {}".format(preset)) + + def _collect_presets(self, scope, root): + """Collect list of preset files""" + presets = dict() + for location in locations: + paths = (root / location / scope).glob("*.preset") + for path in paths: + # earlier names override later ones + if path.name not in presets: + presets[path.name] = path + + self._parse_presets([v for k, v in sorted(presets.items())]) + + def state(self, unit_name): + """Return state of preset for unit_name + + Args: + presets: set of presets + unit_name: name of the unit + + Returns: + None: no matching preset + `enable`: unit_name is enabled + `disable`: unit_name is disabled + """ + for directive in self.directives: + if fnmatch.fnmatch(unit_name, directive.unit_name): + return directive.action + + return None + + +def add_link(path, target): + try: + path.parent.mkdir(parents=True) + except FileExistsError: + pass + if not path.is_symlink(): + print("ln -s {} {}".format(target, path)) + path.symlink_to(target) + + +class SystemdUnitNotFoundError(Exception): + def __init__(self, path, unit): + self.path = path + self.unit = unit + + +class SystemdUnit(): + def __init__(self, root, unit): + self.root = root + self.unit = unit + self.config = None + + def _path_for_unit(self, unit): + for location in locations: + path = self.root / location / "system" / unit + if path.exists() or path.is_symlink(): + return path + + raise SystemdUnitNotFoundError(self.root, unit) + + def _process_deps(self, config, service, location, prop, dirstem): + systemdir = self.root / SYSCONFDIR / "systemd" / "system" + + target = ROOT / location.relative_to(self.root) + try: + for dependent in config.get('Install', prop): + wants = systemdir / "{}.{}".format(dependent, dirstem) / service + add_link(wants, target) + + except KeyError: + pass + + def enable(self, caller_unit=None): + # if we're enabling an instance, first extract the actual instance + # then figure out what the template unit is + template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit) + if template: + instance = template.group('instance') + unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1) + else: + instance = None + unit = self.unit + + path = self._path_for_unit(unit) + + if path.is_symlink(): + # ignore aliases + return + + config = SystemdFile(self.root, path) + if instance == "": + try: + default_instance = config.get('Install', 'DefaultInstance')[0] + except KeyError: + # no default instance, so nothing to enable + return + + service = self.unit.replace("@.", + "@{}.".format(default_instance)) + else: + service = self.unit + + self._process_deps(config, service, path, 'WantedBy', 'wants') + self._process_deps(config, service, path, 'RequiredBy', 'requires') + + try: + for also in config.get('Install', 'Also'): + try: + if caller_unit != also: + SystemdUnit(self.root, also).enable(unit) + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit)) + + except KeyError: + pass + + systemdir = self.root / SYSCONFDIR / "systemd" / "system" + target = ROOT / path.relative_to(self.root) + try: + for dest in config.get('Install', 'Alias'): + alias = systemdir / dest + add_link(alias, target) + + except KeyError: + pass + + def mask(self): + systemdir = self.root / SYSCONFDIR / "systemd" / "system" + add_link(systemdir / self.unit, "/dev/null") + + +def collect_services(root): + """Collect list of service files""" + services = set() + for location in locations: + paths = (root / location / "system").glob("*") + for path in paths: + if path.is_dir(): + continue + services.add(path.name) + + return services + + +def preset_all(root): + presets = Presets('system-preset', root) + services = collect_services(root) + + for service in services: + state = presets.state(service) + + if state == "enable" or state is None: + try: + SystemdUnit(root, service).enable() + except SystemdUnitNotFoundError: + sys.exit("Error: Systemctl preset_all issue in %s" % service) + + # If we populate the systemd links we also create /etc/machine-id, which + # allows systemd to boot with the filesystem read-only before generating + # a real value and then committing it back. + # + # For the stateless configuration, where /etc is generated at runtime + # (for example on a tmpfs), this script shouldn't run at all and we + # allow systemd to completely populate /etc. + (root / SYSCONFDIR / "machine-id").touch() + + +def main(): + if sys.version_info < (3, 4, 0): + sys.exit("Python 3.4 or greater is required") + + parser = argparse.ArgumentParser() + parser.add_argument('command', nargs='?', choices=['enable', 'mask', + 'preset-all']) + parser.add_argument('service', nargs=argparse.REMAINDER) + parser.add_argument('--root') + parser.add_argument('--preset-mode', + choices=['full', 'enable-only', 'disable-only'], + default='full') + + args = parser.parse_args() + + root = Path(args.root) if args.root else ROOT + + locations.append(SYSCONFDIR / "systemd") + # Handle the usrmerge case by ignoring /lib when it's a symlink + if not (root / BASE_LIBDIR).is_symlink(): + locations.append(BASE_LIBDIR / "systemd") + locations.append(LIBDIR / "systemd") + + command = args.command + if not command: + parser.print_help() + return 0 + + if command == "mask": + for service in args.service: + try: + SystemdUnit(root, service).mask() + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit)) + elif command == "enable": + for service in args.service: + try: + SystemdUnit(root, service).enable() + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit)) + elif command == "preset-all": + if len(args.service) != 0: + sys.exit("Too many arguments.") + if args.preset_mode != "enable-only": + sys.exit("Only enable-only is supported as preset-mode.") + preset_all(root) + else: + raise RuntimeError() + + +if __name__ == '__main__': + main() diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc index 736e0a0ea0..ac454b8afd 100644 --- a/meta/recipes-core/systemd/systemd.inc +++ b/meta/recipes-core/systemd/systemd.inc @@ -10,12 +10,12 @@ state, maintains mount and automount points and implements an \ elaborate transactional dependency-based service control logic. It can \ work as a drop-in replacement for sysvinit." -LICENSE = "GPLv2 & LGPLv2.1" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" -SRCREV = "de7436b02badc82200dc127ff190b8155769b8e7" - -SRC_URI = "git://github.com/systemd/systemd.git;protocol=git" +SRCREV = "c3aead556847dd2694d559620123b65ff16afe8c" +SRCBRANCH = "v250-stable" +SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}" S = "${WORKDIR}/git" diff --git a/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf new file mode 100644 index 0000000000..6b224ba9b9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf @@ -0,0 +1,6 @@ +[Service] +# By running with these options instead of root, networkd is allowed to request +# a hostname change via DBUS when policykit is not present +User=systemd-network +Group=systemd-hostname +AmbientCapabilities=CAP_SYS_ADMIN diff --git a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch new file mode 100644 index 0000000000..2363679c98 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch @@ -0,0 +1,453 @@ +From 4c2e932664ec67662f4a0306cca4a7cd82853bda Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 22:19:37 -0800 +Subject: [PATCH] Adjust for musl headers + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/libsystemd-network/sd-dhcp6-client.c | 2 +- + src/network/netdev/bareudp.c | 2 +- + src/network/netdev/batadv.c | 2 +- + src/network/netdev/bond.c | 2 +- + src/network/netdev/bridge.c | 2 +- + src/network/netdev/dummy.c | 2 +- + src/network/netdev/geneve.c | 2 +- + src/network/netdev/ifb.c | 2 +- + src/network/netdev/ipoib.c | 2 +- + src/network/netdev/ipvlan.c | 2 +- + src/network/netdev/macsec.c | 2 +- + src/network/netdev/macvlan.c | 2 +- + src/network/netdev/netdev.c | 2 +- + src/network/netdev/netdevsim.c | 2 +- + src/network/netdev/nlmon.c | 2 +- + src/network/netdev/tunnel.c | 2 +- + src/network/netdev/vcan.c | 2 +- + src/network/netdev/veth.c | 2 +- + src/network/netdev/vlan.c | 2 +- + src/network/netdev/vrf.c | 2 +- + src/network/netdev/vxcan.c | 2 +- + src/network/netdev/vxlan.c | 2 +- + src/network/netdev/xfrm.c | 2 +- + src/network/networkd-bridge-mdb.c | 4 ++-- + src/network/networkd-dhcp-common.c | 3 ++- + src/network/networkd-dhcp-prefix-delegation.c | 4 ++-- + src/network/networkd-dhcp-server.c | 2 +- + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-route.c | 8 ++++---- + src/network/networkd-setlink.c | 2 +- + src/shared/linux/ethtool.h | 3 ++- + src/shared/netif-util.c | 2 +- + src/udev/udev-builtin-net_id.c | 2 +- + 34 files changed, 41 insertions(+), 39 deletions(-) + +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -5,7 +5,7 @@ + + #include <errno.h> + #include <sys/ioctl.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_infiniband.h> + + #include "sd-dhcp6-client.h" +--- a/src/network/netdev/bareudp.c ++++ b/src/network/netdev/bareudp.c +@@ -2,7 +2,7 @@ + * Copyright © 2020 VMware, Inc. */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "bareudp.h" + #include "netlink-util.h" +--- a/src/network/netdev/batadv.c ++++ b/src/network/netdev/batadv.c +@@ -3,7 +3,7 @@ + #include <inttypes.h> + #include <netinet/in.h> + #include <linux/genetlink.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "batadv.h" + #include "fileio.h" +--- a/src/network/netdev/bond.c ++++ b/src/network/netdev/bond.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "bond.h" +--- a/src/network/netdev/bridge.c ++++ b/src/network/netdev/bridge.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "bridge.h" +--- a/src/network/netdev/dummy.c ++++ b/src/network/netdev/dummy.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "dummy.h" + +--- a/src/network/netdev/geneve.c ++++ b/src/network/netdev/geneve.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "conf-parser.h" +--- a/src/network/netdev/ifb.c ++++ b/src/network/netdev/ifb.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright © 2019 VMware, Inc. */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "ifb.h" + +--- a/src/network/netdev/ipoib.c ++++ b/src/network/netdev/ipoib.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + + #include "ipoib.h" +--- a/src/network/netdev/ipvlan.c ++++ b/src/network/netdev/ipvlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "ipvlan.h" +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_ether.h> + #include <linux/if_macsec.h> + #include <linux/genetlink.h> +--- a/src/network/netdev/macvlan.c ++++ b/src/network/netdev/macvlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "macvlan.h" +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <unistd.h> + + #include "alloc-util.h" +--- a/src/network/netdev/netdevsim.c ++++ b/src/network/netdev/netdevsim.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "netdevsim.h" + +--- a/src/network/netdev/nlmon.c ++++ b/src/network/netdev/nlmon.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "nlmon.h" + +--- a/src/network/netdev/tunnel.c ++++ b/src/network/netdev/tunnel.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/fou.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_tunnel.h> + #include <linux/ip.h> + #include <linux/ip6_tunnel.h> +--- a/src/network/netdev/vcan.c ++++ b/src/network/netdev/vcan.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vcan.h" + +--- a/src/network/netdev/veth.c ++++ b/src/network/netdev/veth.c +@@ -3,7 +3,7 @@ + #include <errno.h> + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/veth.h> + + #include "netlink-util.h" +--- a/src/network/netdev/vlan.c ++++ b/src/network/netdev/vlan.c +@@ -2,7 +2,7 @@ + + #include <errno.h> + #include <net/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_vlan.h> + + #include "parse-util.h" +--- a/src/network/netdev/vrf.c ++++ b/src/network/netdev/vrf.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vrf.h" + +--- a/src/network/netdev/vxcan.c ++++ b/src/network/netdev/vxcan.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/can/vxcan.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vxcan.h" + +--- a/src/network/netdev/vxlan.c ++++ b/src/network/netdev/vxlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "alloc-util.h" +--- a/src/network/netdev/xfrm.c ++++ b/src/network/netdev/xfrm.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "missing_network.h" + #include "xfrm.h" +--- a/src/network/networkd-bridge-mdb.c ++++ b/src/network/networkd-bridge-mdb.c +@@ -1,7 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <net/if.h> +-#include <linux/if_bridge.h> + + #include "netlink-util.h" + #include "networkd-bridge-mdb.h" +@@ -11,6 +9,8 @@ + #include "networkd-queue.h" + #include "string-util.h" + #include "vlan-util.h" ++#include <net/if.h> ++#include <linux/if_bridge.h> + + #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U + +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -1,7 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> ++#include <net/if.h> + + #include "bus-error.h" + #include "dhcp-identifier.h" +--- a/src/network/networkd-dhcp-prefix-delegation.c ++++ b/src/network/networkd-dhcp-prefix-delegation.c +@@ -1,7 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/ipv6_route.h> +- + #include "sd-dhcp6-client.h" + + #include "hashmap.h" +@@ -21,6 +19,8 @@ + #include "strv.h" + #include "tunnel.h" + ++#include <linux/ipv6_route.h> ++ + bool link_dhcp_pd_is_enabled(Link *link) { + assert(link); + +--- a/src/network/networkd-dhcp-server.c ++++ b/src/network/networkd-dhcp-server.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if.h> + + #include "sd-dhcp-server.h" +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -3,7 +3,7 @@ + #include <netinet/in.h> + #include <netinet/ip.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "dhcp-client-internal.h" +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -3,7 +3,7 @@ + #include <net/if.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + #include <linux/netdevice.h> + #include <sys/socket.h> +--- a/src/network/networkd-route.c ++++ b/src/network/networkd-route.c +@@ -1,9 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/icmpv6.h> +-#include <linux/ipv6_route.h> +-#include <linux/nexthop.h> +- + #include "alloc-util.h" + #include "event-util.h" + #include "netlink-util.h" +@@ -21,6 +17,10 @@ + #include "vrf.h" + #include "wireguard.h" + ++#include <linux/icmpv6.h> ++#include <linux/ipv6_route.h> ++#include <linux/nexthop.h> ++ + int route_new(Route **ret) { + _cleanup_(route_freep) Route *route = NULL; + +--- a/src/network/networkd-setlink.c ++++ b/src/network/networkd-setlink.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "missing_network.h" +--- a/src/shared/linux/ethtool.h ++++ b/src/shared/linux/ethtool.h +@@ -16,7 +16,8 @@ + + #include <linux/kernel.h> + #include <linux/types.h> +-#include <linux/if_ether.h> ++#include <netinet/if_ether.h> ++//#include <linux/if_ether.h> + + #ifndef __KERNEL__ + #include <limits.h> /* for INT_MAX */ +--- a/src/shared/netif-util.c ++++ b/src/shared/netif-util.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "arphrd-util.h" + #include "device-util.h" +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -18,7 +18,7 @@ + #include <stdarg.h> + #include <unistd.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/netdevice.h> + #include <linux/pci_regs.h> + +--- a/src/network/netdev/wireguard.c ++++ b/src/network/netdev/wireguard.c +@@ -6,7 +6,7 @@ + #include <sys/ioctl.h> + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/ipv6_route.h> + + #include "sd-resolve.h" diff --git a/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch b/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch deleted file mode 100644 index e2e19ba068..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 527413ec243564a89ffaad6368d446de44415970 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 27 Feb 2018 21:42:23 -0800 -Subject: [PATCH] Fix to run efi_cc and efi_ld correctly when cross-compiling - -When cross-compiling, efi_cc and efi_ld may take the form of -'xxx-gcc --sysroot=xxx', and this would cause run_command and -the alike fail. - -Fix to split them to make commands run correctly. - -Upstream-Status: Pending - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/boot/efi/meson.build | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build -index 992a3ba4c..9f9ec4911 100644 ---- a/src/boot/efi/meson.build -+++ b/src/boot/efi/meson.build -@@ -157,7 +157,7 @@ if have_gnu_efi - o_file = custom_target(file + '.o', - input : file, - output : file + '.o', -- command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@'] -+ command : efi_cc.split() + ['-c', '@INPUT@', '-o', '@OUTPUT@'] - + compile_args, - depend_files : efi_headers) - if (common_sources + systemd_boot_sources).contains(file) -@@ -168,7 +168,17 @@ if have_gnu_efi - endif - endforeach - -- libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip() -+ find_libgcc_cmd_all = efi_cc + ' -print-libgcc-file-name' -+ find_libgcc_cmd = find_libgcc_cmd_all.split()[0] -+ find_libgcc_args = [] -+ cmd_args_all = find_libgcc_cmd_all.split() -+ foreach arg : cmd_args_all -+ if arg != find_libgcc_cmd -+ find_libgcc_args += arg -+ endif -+ endforeach -+ -+ libgcc_file_name = run_command(find_libgcc_cmd, find_libgcc_args).stdout().strip() - systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME) - stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME) - no_undefined_symbols = find_program('no-undefined-symbols.sh') -@@ -179,7 +189,7 @@ if have_gnu_efi - tuple[0], - input : tuple[2], - output : tuple[0], -- command : [efi_ld, '-o', '@OUTPUT@'] + -+ command : efi_ld.split() + ['-o', '@OUTPUT@'] + - efi_ldflags + tuple[2] + - ['-lefi', '-lgnuefi', libgcc_file_name]) - --- -2.13.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch b/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch deleted file mode 100644 index d745800ced..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9e3816bcaa36e1a11647ca0cf4f8044449c77fe0 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 2 Jul 2018 15:28:22 +0800 -Subject: [PATCH] Remove fstack-protector flags to workaround musl build - -Remove fstack-protector and fstack-protector-strong flags to fix -the following build failure for qemux86 and qemuppc with musl. - - undefined reference to `__stack_chk_fail_local' - -Upstream-Status: Inappropriate [musl Specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/meson.build b/meson.build -index f432ea072..a734a295c 100644 ---- a/meson.build -+++ b/meson.build -@@ -333,8 +333,6 @@ possible_cc_flags = [ - '-fdiagnostics-show-option', - '-fno-strict-aliasing', - '-fvisibility=hidden', -- '-fstack-protector', -- '-fstack-protector-strong', - '--param=ssp-buffer-size=4', - ] - --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-sysctl.d-request-ECN-on-both-in-and-outgoing-.patch b/meta/recipes-core/systemd/systemd/0001-Revert-sysctl.d-request-ECN-on-both-in-and-outgoing-.patch deleted file mode 100644 index 7fd6d0188e..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Revert-sysctl.d-request-ECN-on-both-in-and-outgoing-.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1e190dfd5bb95036f937ef1dc46f43eb0a146612 Mon Sep 17 00:00:00 2001 -From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> -Date: Fri, 17 Aug 2018 21:31:05 +0200 -Subject: [PATCH] Revert "sysctl.d: request ECN on both in and outgoing - connections" - -Turning on ECN still causes slow or broken network on linux. Our tcp -is not yet ready for wide spread use of ECN. - -This reverts commit 919472741dba6ad0a3f6c2b76d390a02d0e2fdc3. - -https://github.com/systemd/systemd/issues/9748 - -Upstream-Status: Backport -Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> ---- - sysctl.d/50-default.conf | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/sysctl.d/50-default.conf b/sysctl.d/50-default.conf -index b67ae87ca6b7..e263cf06284a 100644 ---- a/sysctl.d/50-default.conf -+++ b/sysctl.d/50-default.conf -@@ -33,9 +33,6 @@ net.ipv4.conf.all.promote_secondaries = 1 - # Fair Queue CoDel packet scheduler to fight bufferbloat - net.core.default_qdisc = fq_codel - --# Request Explicit Congestion Notification (ECN) on both in and outgoing connections --net.ipv4.tcp_ecn = 1 -- - # Enable hard and soft link protection - fs.protected_hardlinks = 1 - fs.protected_symlinks = 1 --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0001-Use-getenv-when-secure-versions-are-not-available.patch b/meta/recipes-core/systemd/systemd/0001-Use-getenv-when-secure-versions-are-not-available.patch deleted file mode 100644 index 03f6ead131..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Use-getenv-when-secure-versions-are-not-available.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 6dd136512896979feb6883a16226d640a7e5ca74 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 23 Feb 2018 10:04:48 +0800 -Subject: [PATCH 01/19] Use getenv when secure versions are not available - -musl doesnt implement secure version, so we default -to it if configure does not detect a secure implementation - -Signed-off-by: Khem Raj <raj.khem@gmail.com> - -Upstream-Status: Denied - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/missing.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index 71a07d057..0e33abb9f 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -592,7 +592,7 @@ struct btrfs_ioctl_quota_ctl_args { - # if HAVE___SECURE_GETENV - # define secure_getenv __secure_getenv - # else --# error "neither secure_getenv nor __secure_getenv are available" -+# define secure_getenv getenv - # endif - #endif - --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch index e24e7f83fc..330ad492ba 100644 --- a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch +++ b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -1,8 +1,8 @@ -From 87dd61be2e28e78ce4f9f173794812e6c2d904d1 Mon Sep 17 00:00:00 2001 +From f9974d7dc289551bfbf823b716fd32b43c54e465 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 27 Jun 2018 16:01:22 +0800 -Subject: [PATCH 1/9] binfmt: Don't install dependency links at install time - for the binfmt services +Date: Thu, 21 Feb 2019 16:23:24 +0800 +Subject: [PATCH] binfmt: Don't install dependency links at install time for + the binfmt services use [Install] blocks so that they get created when the service is enabled like a traditional service. @@ -16,6 +16,9 @@ Upstream-Status: Denied Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + --- units/meson.build | 6 ++---- units/proc-sys-fs-binfmt_misc.automount | 3 +++ @@ -23,34 +26,34 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/units/meson.build b/units/meson.build -index e4ac6ced6..698734e44 100644 +index a9bf28f6d9..11d3644168 100644 --- a/units/meson.build +++ b/units/meson.build -@@ -46,8 +46,7 @@ units = [ +@@ -63,8 +63,7 @@ units = [ ['poweroff.target', '', - 'runlevel0.target'], + (with_runlevels ? 'runlevel0.target' : '')], ['printer.target', ''], - ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', - 'sysinit.target.wants/'], + ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], ['reboot.target', '', - 'runlevel6.target ctrl-alt-del.target'], -@@ -130,8 +129,7 @@ in_units = [ - ['systemd-ask-password-console.service', ''], - ['systemd-ask-password-wall.service', ''], + 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')], +@@ -184,8 +183,7 @@ in_units = [ + ['rescue.service', ''], + ['serial-getty@.service', ''], ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], - ['systemd-binfmt.service', 'ENABLE_BINFMT', - 'sysinit.target.wants/'], + ['systemd-binfmt.service', 'ENABLE_BINFMT'], + ['systemd-bless-boot.service', 'HAVE_GNU_EFI HAVE_BLKID'], + ['systemd-boot-check-no-failures.service', ''], ['systemd-coredump@.service', 'ENABLE_COREDUMP'], - ['systemd-exit.service', ''], - ['systemd-firstboot.service', 'ENABLE_FIRSTBOOT', diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount -index 30a6bc991..4231f3b70 100644 +index 172c8757ab..f65d8930c6 100644 --- a/units/proc-sys-fs-binfmt_misc.automount +++ b/units/proc-sys-fs-binfmt_misc.automount -@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ +@@ -19,3 +19,6 @@ ConditionPathIsReadWrite=/proc/sys/ [Automount] Where=/proc/sys/fs/binfmt_misc @@ -58,7 +61,7 @@ index 30a6bc991..4231f3b70 100644 +[Install] +WantedBy=sysinit.target diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in -index e940c7c9a..6be7f5cc9 100644 +index 96f595ad72..7c010bb224 100644 --- a/units/systemd-binfmt.service.in +++ b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm @@ -67,15 +70,12 @@ index e940c7c9a..6be7f5cc9 100644 Conflicts=shutdown.target +Wants=proc-sys-fs-binfmt_misc.automount After=proc-sys-fs-binfmt_misc.automount - Before=sysinit.target shutdown.target - ConditionPathIsReadWrite=/proc/sys/ -@@ -28,3 +29,6 @@ Type=oneshot - RemainAfterExit=yes - ExecStart=@rootlibexecdir@/systemd-binfmt + After=proc-sys-fs-binfmt_misc.mount + After=local-fs.target +@@ -31,3 +32,6 @@ RemainAfterExit=yes + ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt + ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister TimeoutSec=90s + +[Install] +WantedBy=sysinit.target --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-chown-recursive-let-s-rework-the-recursive-logic-to-.patch b/meta/recipes-core/systemd/systemd/0001-chown-recursive-let-s-rework-the-recursive-logic-to-.patch deleted file mode 100644 index 9d350ebade..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-chown-recursive-let-s-rework-the-recursive-logic-to-.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 2da8ba3f507345d0401ea9d7191fa16ffa560ebc Mon Sep 17 00:00:00 2001 -From: Lennart Poettering <lennart@poettering.net> -Date: Fri, 19 Oct 2018 11:26:59 +0200 -Subject: [PATCH] chown-recursive: let's rework the recursive logic to use - O_PATH - -That way we can pin a specific inode and analyze it and manipulate it -without it being swapped out beneath our hands. - -Fixes a vulnerability originally found by Jann Horn from Google. - -CVE-2018-15687 -LP: #1796692 -https://bugzilla.redhat.com/show_bug.cgi?id=1639076 - -(cherry picked from commit 5de6cce58b3e8b79239b6e83653459d91af6e57c) - -CVE: CVE-2018-15687 -Upstream-Status: Backport - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/core/chown-recursive.c | 146 ++++++++++++++++++++++----------------------- - 1 file changed, 70 insertions(+), 76 deletions(-) - -diff --git a/src/core/chown-recursive.c b/src/core/chown-recursive.c -index c479450..27c6448 100644 ---- a/src/core/chown-recursive.c -+++ b/src/core/chown-recursive.c -@@ -1,17 +1,19 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - --#include <sys/types.h> --#include <sys/stat.h> - #include <fcntl.h> -+#include <sys/stat.h> -+#include <sys/types.h> - --#include "user-util.h" --#include "macro.h" --#include "fd-util.h" --#include "dirent-util.h" - #include "chown-recursive.h" -+#include "dirent-util.h" -+#include "fd-util.h" -+#include "macro.h" -+#include "stdio-util.h" -+#include "strv.h" -+#include "user-util.h" - --static int chown_one(int fd, const char *name, const struct stat *st, uid_t uid, gid_t gid) { -- int r; -+static int chown_one(int fd, const struct stat *st, uid_t uid, gid_t gid) { -+ char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1]; - - assert(fd >= 0); - assert(st); -@@ -20,90 +22,82 @@ static int chown_one(int fd, const char *name, const struct stat *st, uid_t uid, - (!gid_is_valid(gid) || st->st_gid == gid)) - return 0; - -- if (name) -- r = fchownat(fd, name, uid, gid, AT_SYMLINK_NOFOLLOW); -- else -- r = fchown(fd, uid, gid); -- if (r < 0) -- return -errno; -+ /* We change ownership through the /proc/self/fd/%i path, so that we have a stable reference that works with -+ * O_PATH. (Note: fchown() and fchmod() do not work with O_PATH, the kernel refuses that. */ -+ xsprintf(procfs_path, "/proc/self/fd/%i", fd); - -- /* The linux kernel alters the mode in some cases of chown(). Let's undo this. */ -- if (name) { -- if (!S_ISLNK(st->st_mode)) -- r = fchmodat(fd, name, st->st_mode, 0); -- else /* There's currently no AT_SYMLINK_NOFOLLOW for fchmodat() */ -- r = 0; -- } else -- r = fchmod(fd, st->st_mode); -- if (r < 0) -+ if (chown(procfs_path, uid, gid) < 0) - return -errno; - -+ /* The linux kernel alters the mode in some cases of chown(). Let's undo this. We do this only for non-symlinks -+ * however. That's because for symlinks the access mode is ignored anyway and because on some kernels/file -+ * systems trying to change the access mode will succeed but has no effect while on others it actively -+ * fails. */ -+ if (!S_ISLNK(st->st_mode)) -+ if (chmod(procfs_path, st->st_mode & 07777) < 0) -+ return -errno; -+ - return 1; - } - - static int chown_recursive_internal(int fd, const struct stat *st, uid_t uid, gid_t gid) { -+ _cleanup_closedir_ DIR *d = NULL; - bool changed = false; -+ struct dirent *de; - int r; - - assert(fd >= 0); - assert(st); - -- if (S_ISDIR(st->st_mode)) { -- _cleanup_closedir_ DIR *d = NULL; -- struct dirent *de; -- -- d = fdopendir(fd); -- if (!d) { -- r = -errno; -- goto finish; -- } -- fd = -1; -- -- FOREACH_DIRENT_ALL(de, d, r = -errno; goto finish) { -- struct stat fst; -- -- if (dot_or_dot_dot(de->d_name)) -- continue; -- -- if (fstatat(dirfd(d), de->d_name, &fst, AT_SYMLINK_NOFOLLOW) < 0) { -- r = -errno; -- goto finish; -- } -- -- if (S_ISDIR(fst.st_mode)) { -- int subdir_fd; -- -- subdir_fd = openat(dirfd(d), de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME); -- if (subdir_fd < 0) { -- r = -errno; -- goto finish; -- } -- -- r = chown_recursive_internal(subdir_fd, &fst, uid, gid); -- if (r < 0) -- goto finish; -- if (r > 0) -- changed = true; -- } else { -- r = chown_one(dirfd(d), de->d_name, &fst, uid, gid); -- if (r < 0) -- goto finish; -- if (r > 0) -- changed = true; -- } -+ d = fdopendir(fd); -+ if (!d) { -+ safe_close(fd); -+ return -errno; -+ } -+ -+ FOREACH_DIRENT_ALL(de, d, return -errno) { -+ _cleanup_close_ int path_fd = -1; -+ struct stat fst; -+ -+ if (dot_or_dot_dot(de->d_name)) -+ continue; -+ -+ /* Let's pin the child inode we want to fix now with an O_PATH fd, so that it cannot be swapped out -+ * while we manipulate it. */ -+ path_fd = openat(dirfd(d), de->d_name, O_PATH|O_CLOEXEC|O_NOFOLLOW); -+ if (path_fd < 0) -+ return -errno; -+ -+ if (fstat(path_fd, &fst) < 0) -+ return -errno; -+ -+ if (S_ISDIR(fst.st_mode)) { -+ int subdir_fd; -+ -+ /* Convert it to a "real" (i.e. non-O_PATH) fd now */ -+ subdir_fd = fd_reopen(path_fd, O_RDONLY|O_CLOEXEC|O_NOATIME); -+ if (subdir_fd < 0) -+ return subdir_fd; -+ -+ r = chown_recursive_internal(subdir_fd, &fst, uid, gid); /* takes possession of subdir_fd even on failure */ -+ if (r < 0) -+ return r; -+ if (r > 0) -+ changed = true; -+ } else { -+ r = chown_one(path_fd, &fst, uid, gid); -+ if (r < 0) -+ return r; -+ if (r > 0) -+ changed = true; - } -+ } - -- r = chown_one(dirfd(d), NULL, st, uid, gid); -- } else -- r = chown_one(fd, NULL, st, uid, gid); -+ r = chown_one(dirfd(d), st, uid, gid); - if (r < 0) -- goto finish; -+ return r; - -- r = r > 0 || changed; -- --finish: -- safe_close(fd); -- return r; -+ return r > 0 || changed; - } - - int path_chown_recursive(const char *path, uid_t uid, gid_t gid) { -@@ -111,7 +105,7 @@ int path_chown_recursive(const char *path, uid_t uid, gid_t gid) { - struct stat st; - int r; - -- fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME); -+ fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME); - if (fd < 0) - return -errno; - --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0001-core-when-deserializing-state-always-use-read_line-L.patch b/meta/recipes-core/systemd/systemd/0001-core-when-deserializing-state-always-use-read_line-L.patch deleted file mode 100644 index 215d68076a..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-core-when-deserializing-state-always-use-read_line-L.patch +++ /dev/null @@ -1,250 +0,0 @@ -From 1a05ff4948d778280ec155a9abe69d3360bfddd9 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering <lennart@poettering.net> -Date: Wed, 17 Oct 2018 18:36:24 +0200 -Subject: [PATCH] =?UTF-8?q?core:=20when=20deserializing=20state=20always?= - =?UTF-8?q?=20use=20read=5Fline(=E2=80=A6,=20LONG=5FLINE=5FMAX,=20?= - =?UTF-8?q?=E2=80=A6)?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This should be much better than fgets(), as we can read substantially -longer lines and overly long lines result in proper errors. - -Fixes a vulnerability discovered by Jann Horn at Google. - -CVE-2018-15686 -LP: #1796402 -https://bugzilla.redhat.com/show_bug.cgi?id=1639071 - -(cherry picked from commit 8948b3415d762245ebf5e19d80b97d4d8cc208c1) - -CVE: CVE-2018-15686 -Upstream-Status: Backport - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/core/job.c | 19 +++++++++++-------- - src/core/manager.c | 44 ++++++++++++++++++++------------------------ - src/core/unit.c | 34 ++++++++++++++++++---------------- - src/core/unit.h | 2 +- - 4 files changed, 50 insertions(+), 49 deletions(-) - -diff --git a/src/core/job.c b/src/core/job.c -index 734756b..8552ffb 100644 ---- a/src/core/job.c -+++ b/src/core/job.c -@@ -10,6 +10,7 @@ - #include "dbus-job.h" - #include "dbus.h" - #include "escape.h" -+#include "fileio.h" - #include "job.h" - #include "log.h" - #include "macro.h" -@@ -1091,24 +1092,26 @@ int job_serialize(Job *j, FILE *f) { - } - - int job_deserialize(Job *j, FILE *f) { -+ int r; -+ - assert(j); - assert(f); - - for (;;) { -- char line[LINE_MAX], *l, *v; -+ _cleanup_free_ char *line = NULL; -+ char *l, *v; - size_t k; - -- if (!fgets(line, sizeof(line), f)) { -- if (feof(f)) -- return 0; -- return -errno; -- } -+ r = read_line(f, LONG_LINE_MAX, &line); -+ if (r < 0) -+ return log_error_errno(r, "Failed to read serialization line: %m"); -+ if (r == 0) -+ return 0; - -- char_array_0(line); - l = strstrip(line); - - /* End marker */ -- if (l[0] == 0) -+ if (isempty(l)) - return 0; - - k = strcspn(l, "="); -diff --git a/src/core/manager.c b/src/core/manager.c -index 3a7f0c4..a5780c9 100644 ---- a/src/core/manager.c -+++ b/src/core/manager.c -@@ -3171,22 +3171,19 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { - m->n_reloading++; - - for (;;) { -- char line[LINE_MAX]; -+ _cleanup_free_ char *line = NULL; - const char *val, *l; - -- if (!fgets(line, sizeof(line), f)) { -- if (feof(f)) -- r = 0; -- else -- r = -errno; -- -+ r = read_line(f, LONG_LINE_MAX, &line); -+ if (r < 0) { -+ log_error_errno(r, "Failed to read serialization line: %m"); - goto finish; - } -+ if (r == 0) -+ break; - -- char_array_0(line); - l = strstrip(line); -- -- if (l[0] == 0) -+ if (isempty(l)) /* end marker */ - break; - - if ((val = startswith(l, "current-job-id="))) { -@@ -3353,29 +3350,31 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { - } - - for (;;) { -- Unit *u; -- char name[UNIT_NAME_MAX+2]; -+ _cleanup_free_ char *line = NULL; - const char* unit_name; -+ Unit *u; - - /* Start marker */ -- if (!fgets(name, sizeof(name), f)) { -- if (feof(f)) -- r = 0; -- else -- r = -errno; -- -+ r = read_line(f, LONG_LINE_MAX, &line); -+ if (r < 0) { -+ log_error_errno(r, "Failed to read serialization line: %m"); - goto finish; - } -+ if (r == 0) -+ break; - -- char_array_0(name); -- unit_name = strstrip(name); -+ unit_name = strstrip(line); - - r = manager_load_unit(m, unit_name, NULL, NULL, &u); - if (r < 0) { - log_notice_errno(r, "Failed to load unit \"%s\", skipping deserialization: %m", unit_name); - if (r == -ENOMEM) - goto finish; -- unit_deserialize_skip(f); -+ -+ r = unit_deserialize_skip(f); -+ if (r < 0) -+ goto finish; -+ - continue; - } - -@@ -3388,9 +3387,6 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { - } - - finish: -- if (ferror(f)) -- r = -EIO; -- - assert(m->n_reloading > 0); - m->n_reloading--; - -diff --git a/src/core/unit.c b/src/core/unit.c -index 7da963a..e98c9c4 100644 ---- a/src/core/unit.c -+++ b/src/core/unit.c -@@ -3380,21 +3380,19 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { - assert(fds); - - for (;;) { -- char line[LINE_MAX], *l, *v; -+ _cleanup_free_ char *line = NULL; - CGroupIPAccountingMetric m; -+ char *l, *v; - size_t k; - -- if (!fgets(line, sizeof(line), f)) { -- if (feof(f)) -- return 0; -- return -errno; -- } -+ r = read_line(f, LONG_LINE_MAX, &line); -+ if (r < 0) -+ return log_error_errno(r, "Failed to read serialization line: %m"); -+ if (r == 0) /* eof */ -+ break; - -- char_array_0(line); - l = strstrip(line); -- -- /* End marker */ -- if (isempty(l)) -+ if (isempty(l)) /* End marker */ - break; - - k = strcspn(l, "="); -@@ -3671,23 +3669,27 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { - return 0; - } - --void unit_deserialize_skip(FILE *f) { -+int unit_deserialize_skip(FILE *f) { -+ int r; - assert(f); - - /* Skip serialized data for this unit. We don't know what it is. */ - - for (;;) { -- char line[LINE_MAX], *l; -+ _cleanup_free_ char *line = NULL; -+ char *l; - -- if (!fgets(line, sizeof line, f)) -- return; -+ r = read_line(f, LONG_LINE_MAX, &line); -+ if (r < 0) -+ return log_error_errno(r, "Failed to read serialization line: %m"); -+ if (r == 0) -+ return 0; - -- char_array_0(line); - l = strstrip(line); - - /* End marker */ - if (isempty(l)) -- return; -+ return 1; - } - } - -diff --git a/src/core/unit.h b/src/core/unit.h -index 06321bb..51c7aaa 100644 ---- a/src/core/unit.h -+++ b/src/core/unit.h -@@ -684,7 +684,7 @@ bool unit_can_serialize(Unit *u) _pure_; - - int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs); - int unit_deserialize(Unit *u, FILE *f, FDSet *fds); --void unit_deserialize_skip(FILE *f); -+int unit_deserialize_skip(FILE *f); - - int unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value); - int unit_serialize_item_escaped(Unit *u, FILE *f, const char *key, const char *value); --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0001-dhcp6-make-sure-we-have-enough-space-for-the-DHCP6-o.patch b/meta/recipes-core/systemd/systemd/0001-dhcp6-make-sure-we-have-enough-space-for-the-DHCP6-o.patch deleted file mode 100644 index 0c912f25df..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-dhcp6-make-sure-we-have-enough-space-for-the-DHCP6-o.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a2622b8398ba026faf481f5eddeb53231d9de4a7 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering <lennart@poettering.net> -Date: Fri, 19 Oct 2018 12:12:33 +0200 -Subject: [PATCH] dhcp6: make sure we have enough space for the DHCP6 option - header - -Fixes a vulnerability originally discovered by Felix Wilhelm from -Google. - -CVE-2018-15688 -LP: #1795921 -https://bugzilla.redhat.com/show_bug.cgi?id=1639067 - -(cherry picked from commit 4dac5eaba4e419b29c97da38a8b1f82336c2c892) - -CVE: CVE-2018-15688 -Upstream-Status: Backport - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/libsystemd-network/dhcp6-option.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c -index c4b402b..dcbaad0 100644 ---- a/src/libsystemd-network/dhcp6-option.c -+++ b/src/libsystemd-network/dhcp6-option.c -@@ -103,7 +103,7 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) { - return -EINVAL; - } - -- if (*buflen < len) -+ if (*buflen < offsetof(DHCP6Option, data) + len) - return -ENOBUFS; - - ia_hdr = *buf; --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch b/meta/recipes-core/systemd/systemd/0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch deleted file mode 100644 index ba08e34558..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 86d18f3b09ec984ef3732567af992adb2dc77a8a Mon Sep 17 00:00:00 2001 -From: Yu Watanabe <watanabe.yu+github@gmail.com> -Date: Mon, 9 Jul 2018 14:05:20 +0900 -Subject: [PATCH] login: use parse_uid() when unmounting user runtime directory - -When unmounting user runtime directory, only UID is necessary, -and the corresponding user may not exist anymore. -This makes first try to parse the input by parse_uid(), and only if it -fails, prase the input by get_user_creds(). - -Fixes #9541. - -Upstream-Status: Backport ---- - src/login/user-runtime-dir.c | 57 ++++++++++++++++++++++++++++---------------- - 1 file changed, 36 insertions(+), 21 deletions(-) - -diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c -index 1bb26c99e..de4061c75 100644 ---- a/src/login/user-runtime-dir.c -+++ b/src/login/user-runtime-dir.c -@@ -111,8 +111,22 @@ static int user_remove_runtime_path(const char *runtime_path) { - return r; - } - --static int do_mount(const char *runtime_path, uid_t uid, gid_t gid) { -+static int do_mount(const char *user) { -+ char runtime_path[sizeof("/run/user") + DECIMAL_STR_MAX(uid_t)]; - size_t runtime_dir_size; -+ uid_t uid; -+ gid_t gid; -+ int r; -+ -+ r = get_user_creds(&user, &uid, &gid, NULL, NULL); -+ if (r < 0) -+ return log_error_errno(r, -+ r == -ESRCH ? "No such user \"%s\"" : -+ r == -ENOMSG ? "UID \"%s\" is invalid or has an invalid main group" -+ : "Failed to look up user \"%s\": %m", -+ user); -+ -+ xsprintf(runtime_path, "/run/user/" UID_FMT, uid); - - assert_se(gather_configuration(&runtime_dir_size) == 0); - -@@ -120,16 +134,30 @@ static int do_mount(const char *runtime_path, uid_t uid, gid_t gid) { - return user_mkdir_runtime_path(runtime_path, uid, gid, runtime_dir_size); - } - --static int do_umount(const char *runtime_path) { -+static int do_umount(const char *user) { -+ char runtime_path[sizeof("/run/user") + DECIMAL_STR_MAX(uid_t)]; -+ uid_t uid; -+ int r; -+ -+ /* The user may be already removed. So, first try to parse the string by parse_uid(), -+ * and if it fails, fallback to get_user_creds().*/ -+ if (parse_uid(user, &uid) < 0) { -+ r = get_user_creds(&user, &uid, NULL, NULL, NULL); -+ if (r < 0) -+ return log_error_errno(r, -+ r == -ESRCH ? "No such user \"%s\"" : -+ r == -ENOMSG ? "UID \"%s\" is invalid or has an invalid main group" -+ : "Failed to look up user \"%s\": %m", -+ user); -+ } -+ -+ xsprintf(runtime_path, "/run/user/" UID_FMT, uid); -+ - log_debug("Will remove %s", runtime_path); - return user_remove_runtime_path(runtime_path); - } - - int main(int argc, char *argv[]) { -- const char *user; -- uid_t uid; -- gid_t gid; -- char runtime_path[sizeof("/run/user") + DECIMAL_STR_MAX(uid_t)]; - int r; - - log_parse_environment(); -@@ -146,23 +174,10 @@ int main(int argc, char *argv[]) { - - umask(0022); - -- user = argv[2]; -- r = get_user_creds(&user, &uid, &gid, NULL, NULL); -- if (r < 0) { -- log_error_errno(r, -- r == -ESRCH ? "No such user \"%s\"" : -- r == -ENOMSG ? "UID \"%s\" is invalid or has an invalid main group" -- : "Failed to look up user \"%s\": %m", -- user); -- return EXIT_FAILURE; -- } -- -- xsprintf(runtime_path, "/run/user/" UID_FMT, uid); -- - if (streq(argv[1], "start")) -- r = do_mount(runtime_path, uid, gid); -+ r = do_mount(argv[2]); - else if (streq(argv[1], "stop")) -- r = do_umount(runtime_path); -+ r = do_umount(argv[2]); - else - assert_not_reached("Unknown verb!"); - --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-meson-rename-Ddebug-to-Ddebug-extra.patch b/meta/recipes-core/systemd/systemd/0001-meson-rename-Ddebug-to-Ddebug-extra.patch deleted file mode 100644 index d6d305cb37..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-meson-rename-Ddebug-to-Ddebug-extra.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8f6b442a78d0b485f044742ad90b2e8271b4e68e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> -Date: Sun, 19 Aug 2018 19:11:30 +0200 -Subject: [PATCH] meson: rename -Ddebug to -Ddebug-extra - -Meson added -Doptimization and -Ddebug options, which obviously causes -a conflict with our -Ddebug options. Let's rename it. - -Fixes #9883. -Upstream-Status: Backport -Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> ---- - meson.build | 2 +- - meson_options.txt | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index f79ac4b12..2209c935a 100644 ---- a/meson.build -+++ b/meson.build -@@ -763,7 +763,7 @@ substs.set('DEBUGTTY', get_option('debug-tty')) - - enable_debug_hashmap = false - enable_debug_mmap_cache = false --foreach name : get_option('debug') -+foreach name : get_option('debug-extra') - if name == 'hashmap' - enable_debug_hashmap = true - elif name == 'mmap-cache' -diff --git a/meson_options.txt b/meson_options.txt -index e3140c8c1..7b1f61bf4 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -45,7 +45,7 @@ option('debug-shell', type : 'string', value : '/bin/sh', - description : 'path to debug shell binary') - option('debug-tty', type : 'string', value : '/dev/tty9', - description : 'specify the tty device for debug shell') --option('debug', type : 'array', choices : ['hashmap', 'mmap-cache'], value : [], -+option('debug-extra', type : 'array', choices : ['hashmap', 'mmap-cache'], value : [], - description : 'enable extra debugging') - option('memory-accounting-default', type : 'boolean', - description : 'enable MemoryAccounting= by default') --- -2.17.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-pass-correct-parameters-to-getdents64.patch b/meta/recipes-core/systemd/systemd/0001-pass-correct-parameters-to-getdents64.patch new file mode 100644 index 0000000000..03a29b5327 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-pass-correct-parameters-to-getdents64.patch @@ -0,0 +1,50 @@ +From fbc10748c7c59d82024a4d35146b8dfef8d52927 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 15:15:11 -0800 +Subject: [PATCH 1/2] pass correct parameters to getdents64 + +Fixes +../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(fd, &buffer, sizeof(buffer)); + ^~~~~~~ + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/recurse-dir.c | 2 +- + src/basic/stat-util.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c +index efa1797b7b..797285e3be 100644 +--- a/src/basic/recurse-dir.c ++++ b/src/basic/recurse-dir.c +@@ -54,7 +54,7 @@ int readdir_all(int dir_fd, + bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); + assert(bs > de->buffer_size); + +- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); ++ n = getdents64(dir_fd, de->buffer + de->buffer_size, bs - de->buffer_size); + if (n < 0) + return -errno; + if (n == 0) +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index efac7b002e..9e1fe7f5a0 100644 +--- a/src/basic/stat-util.c ++++ b/src/basic/stat-util.c +@@ -99,7 +99,7 @@ int dir_is_empty_at(int dir_fd, const char *path) { + return fd; + } + +- n = getdents64(fd, &buffer, sizeof(buffer)); ++ n = getdents64(fd, (struct dirent *)&buffer, sizeof(buffer)); + if (n < 0) + return -errno; + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch b/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch deleted file mode 100644 index 45c9b5b1e3..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch +++ /dev/null @@ -1,175 +0,0 @@ -From 5b75a72ee968c9666b5f2ea313720b6c383cb4c2 Mon Sep 17 00:00:00 2001 -From: Yu Watanabe <watanabe.yu+github@gmail.com> -Date: Fri, 13 Jul 2018 17:38:47 +0900 -Subject: [PATCH] sd-bus: make BUS_DEFAULT_TIMEOUT configurable - -This adds sd_bus_{get,set}_method_call_timeout(). -If the timeout is not set or set to 0, then the timeout value is -parsed from $SYSTEMD_BUS_TIMEOUT= environment variable. If the -environment variable is not set, then built-in timeout is used. ---- - doc/ENVIRONMENT.md | 5 +++++ - src/libsystemd/libsystemd.sym | 5 +++++ - src/libsystemd/sd-bus/bus-internal.h | 9 ++++---- - src/libsystemd/sd-bus/bus-message.c | 7 +++++-- - src/libsystemd/sd-bus/sd-bus.c | 40 ++++++++++++++++++++++++++++++++++-- - src/systemd/sd-bus.h | 3 +++ - 6 files changed, 61 insertions(+), 8 deletions(-) - -Upstream-Status: Backport - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - -diff --git a/doc/ENVIRONMENT.md b/doc/ENVIRONMENT.md -index 85d26fe28c..641a03d5d7 100644 ---- a/doc/ENVIRONMENT.md -+++ b/doc/ENVIRONMENT.md -@@ -37,6 +37,11 @@ All tools: - useful for debugging, in order to test generators and other code against - specific kernel command lines. - -+* `$SYSTEMD_BUS_TIMEOUT=SECS` — specifies the maximum time to wait for method call -+ completion. If no time unit is specified, assumes seconds. The usual other units -+ are understood, too (us, ms, s, min, h, d, w, month, y). If it is not set or set -+ to 0, then the built-in default is used. -+ - systemctl: - - * `$SYSTEMCTL_FORCE_BUS=1` — if set, do not connect to PID1's private D-Bus -diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym -index 1eec17db50..006dbc9c3f 100644 ---- a/src/libsystemd/libsystemd.sym -+++ b/src/libsystemd/libsystemd.sym -@@ -570,3 +570,8 @@ global: - sd_event_source_set_destroy_callback; - sd_event_source_get_destroy_callback; - } LIBSYSTEMD_238; -+ -+LIBSYSTEMD_240 { -+ sd_bus_set_method_call_timeout; -+ sd_bus_get_method_call_timeout; -+} LIBSYSTEMD_239; -diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h -index 2087ef8eeb..4864b1e911 100644 ---- a/src/libsystemd/sd-bus/bus-internal.h -+++ b/src/libsystemd/sd-bus/bus-internal.h -@@ -319,6 +319,9 @@ struct sd_bus { - - int *inotify_watches; - size_t n_inotify_watches; -+ -+ /* zero means use value specified by $SYSTEMD_BUS_TIMEOUT= environment variable or built-in default */ -+ usec_t method_call_timeout; - }; - - /* For method calls we time-out at 25s, like in the D-Bus reference implementation */ -@@ -336,8 +339,7 @@ struct sd_bus { - - #define BUS_CONTAINER_DEPTH 128 - --/* Defined by the specification as maximum size of an array in -- * bytes */ -+/* Defined by the specification as maximum size of an array in bytes */ - #define BUS_ARRAY_MAX_SIZE 67108864 - - #define BUS_FDS_MAX 1024 -@@ -388,8 +390,7 @@ void bus_close_io_fds(sd_bus *b); - _slash = streq((prefix), "/") ? NULL : strrchr((prefix), '/')) - - /* If we are invoking callbacks of a bus object, ensure unreffing the -- * bus from the callback doesn't destroy the object we are working -- * on */ -+ * bus from the callback doesn't destroy the object we are working on */ - #define BUS_DONT_DESTROY(bus) \ - _cleanup_(sd_bus_unrefp) _unused_ sd_bus *_dont_destroy_##bus = sd_bus_ref(bus) - -diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c -index 8d92bc2002..dffe70a665 100644 ---- a/src/libsystemd/sd-bus/bus-message.c -+++ b/src/libsystemd/sd-bus/bus-message.c -@@ -5809,8 +5809,11 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) { - return r; - - timeout = (*m)->timeout; -- if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)) -- timeout = BUS_DEFAULT_TIMEOUT; -+ if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)) { -+ r = sd_bus_get_method_call_timeout(bus, &timeout); -+ if (r < 0) -+ return r; -+ } - - r = sd_bus_message_seal(n, BUS_MESSAGE_COOKIE(*m), timeout); - if (r < 0) -diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c -index 089b51a6d9..945490ebf7 100644 ---- a/src/libsystemd/sd-bus/sd-bus.c -+++ b/src/libsystemd/sd-bus/sd-bus.c -@@ -1611,8 +1611,11 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) { - return 0; - } - -- if (timeout == 0) -- timeout = BUS_DEFAULT_TIMEOUT; -+ if (timeout == 0) { -+ r = sd_bus_get_method_call_timeout(b, &timeout); -+ if (r < 0) -+ return r; -+ } - - if (!m->sender && b->patch_sender) { - r = sd_bus_message_set_sender(m, b->patch_sender); -@@ -4075,3 +4078,36 @@ _public_ int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret) { - *ret = bus->wqueue_size; - return 0; - } -+ -+_public_ int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec) { -+ assert_return(bus, -EINVAL); -+ assert_return(bus = bus_resolve(bus), -ENOPKG); -+ -+ bus->method_call_timeout = usec; -+ return 0; -+} -+ -+_public_ int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret) { -+ const char *e; -+ usec_t usec; -+ -+ assert_return(bus, -EINVAL); -+ assert_return(bus = bus_resolve(bus), -ENOPKG); -+ assert_return(ret, -EINVAL); -+ -+ if (bus->method_call_timeout != 0) { -+ *ret = bus->method_call_timeout; -+ return 0; -+ } -+ -+ e = secure_getenv("SYSTEMD_BUS_TIMEOUT"); -+ if (e && parse_sec(e, &usec) >= 0 && usec != 0) { -+ /* Save the parsed value to avoid multiple parsing. To change the timeout value, -+ * use sd_bus_set_method_call_timeout() instead of setenv(). */ -+ *ret = bus->method_call_timeout = usec; -+ return 0; -+ } -+ -+ *ret = bus->method_call_timeout = BUS_DEFAULT_TIMEOUT; -+ return 0; -+} -diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h -index 54c4b1ca83..c9fd254834 100644 ---- a/src/systemd/sd-bus.h -+++ b/src/systemd/sd-bus.h -@@ -206,6 +206,9 @@ sd_event *sd_bus_get_event(sd_bus *bus); - int sd_bus_get_n_queued_read(sd_bus *bus, uint64_t *ret); - int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret); - -+int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec); -+int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret); -+ - int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata); - int sd_bus_add_match(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, void *userdata); - int sd_bus_add_match_async(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, sd_bus_message_handler_t install_callback, void *userdata); --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-sysctl-Don-t-pass-null-directive-argument-to-s.patch b/meta/recipes-core/systemd/systemd/0001-sysctl-Don-t-pass-null-directive-argument-to-s.patch deleted file mode 100644 index 0538c7bbc8..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-sysctl-Don-t-pass-null-directive-argument-to-s.patch +++ /dev/null @@ -1,31 +0,0 @@ -From bfc4183ea995f1c211385d066cdb1fe9ce89f621 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 16 Dec 2018 20:53:38 -0800 -Subject: [PATCH 1/2] sysctl: Don't pass null directive argument to '%s' - -value pointer here is always NULL but subsequent use of that pointer -with a %s format will always be NULL, printing p instead would be a -valid string - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/11179] - src/sysctl/sysctl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c -index 1cfe51018..c67d79032 100644 ---- a/src/sysctl/sysctl.c -+++ b/src/sysctl/sysctl.c -@@ -115,7 +115,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign - - value = strchr(p, '='); - if (!value) { -- log_error("Line is not an assignment at '%s:%u': %s", path, c, value); -+ log_error("Line is not an assignment at '%s:%u': %s", path, c, p); - - if (r == 0) - r = -EINVAL; --- -2.20.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch new file mode 100644 index 0000000000..752824688f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch @@ -0,0 +1,42 @@ +From 58860e0f248576a80ff2af256ba42713c186ae93 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 29 Sep 2020 18:01:41 -0700 +Subject: [PATCH] systemd.pc.in: use ROOTPREFIX without suffixed slash + +This complements the commit +https://github.com/poettering/systemd/commit/b612c26ceb9f56af0271fc9f07c1724d2d260a8a + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/core/systemd.pc.in | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in +index b5cc8f9..21dbf30 100644 +--- a/src/core/systemd.pc.in ++++ b/src/core/systemd.pc.in +@@ -65,16 +65,16 @@ systemdshutdowndir=${systemd_shutdown_dir} + tmpfiles_dir=${prefix}/lib/tmpfiles.d + tmpfilesdir=${tmpfiles_dir} + +-sysusers_dir=${rootprefix}/lib/sysusers.d ++sysusers_dir=${prefix}/lib/sysusers.d + sysusersdir=${sysusers_dir} + +-sysctl_dir=${rootprefix}/lib/sysctl.d ++sysctl_dir=${prefix}/lib/sysctl.d + sysctldir=${sysctl_dir} + +-binfmt_dir=${rootprefix}/lib/binfmt.d ++binfmt_dir=${prefix}/lib/binfmt.d + binfmtdir=${binfmt_dir} + +-modules_load_dir=${rootprefix}/lib/modules-load.d ++modules_load_dir=${prefix}/lib/modules-load.d + modulesloaddir=${modules_load_dir} + + catalog_dir=${prefix}/lib/systemd/catalog +-- +2.25.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch b/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch new file mode 100644 index 0000000000..898e8af904 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch @@ -0,0 +1,27 @@ +From 93c7e482d39cf7765974b3c729d29c1b120a60e3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 24 May 2021 18:26:27 -0700 +Subject: [PATCH] test-parse-argument: Include signal.h + +Fixes +src/test/test-parse-argument.c:49:29: error: use of undeclared identifier 'SIGABRT' + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/19718] +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + src/test/test-parse-argument.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c +index cf3d54288a..15104e5282 100644 +--- a/src/test/test-parse-argument.c ++++ b/src/test/test-parse-argument.c +@@ -5,6 +5,7 @@ + #include "parse-argument.h" + #include "stdio-util.h" + #include "tests.h" ++#include <signal.h> + + TEST(parse_json_argument) { + JsonFormatFlags flags = JSON_FORMAT_PRETTY; diff --git a/meta/recipes-core/systemd/systemd/0001-timesync-changes-type-of-drift_freq-to-int64_t.patch b/meta/recipes-core/systemd/systemd/0001-timesync-changes-type-of-drift_freq-to-int64_t.patch deleted file mode 100644 index 8d395c2fa3..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-timesync-changes-type-of-drift_freq-to-int64_t.patch +++ /dev/null @@ -1,49 +0,0 @@ -Backport patch to fix systemd build failure on x32. - -Upstream-Status: Backport [https://github.com/systemd/systemd/commit/75ca162] - -Signed-off-by: Kai Kang <kai.kang@windriver.com> - -From 75ca1621db4647a4d62d7873cd6715e28fe0f9fa Mon Sep 17 00:00:00 2001 -From: Yu Watanabe <watanabe.yu+github@gmail.com> -Date: Sat, 23 Jun 2018 09:41:55 +0900 -Subject: [PATCH] timesync: changes type of drift_freq to int64_t - -drift_freq is used for storing timex.freq, and is a 64bit integer. -To support x32 ABI, this changes the type of drift_freq to int64_t. - -Fixes #9387. ---- - src/timesync/timesyncd-manager.c | 2 +- - src/timesync/timesyncd-manager.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c -index 2b731af9e..404a2b189 100644 ---- a/src/timesync/timesyncd-manager.c -+++ b/src/timesync/timesyncd-manager.c -@@ -604,7 +604,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re - m->dest_time = *recv_time; - m->spike = spike; - -- log_debug("interval/delta/delay/jitter/drift " USEC_FMT "s/%+.3fs/%.3fs/%.3fs/%+"PRI_TIMEX"ppm%s", -+ log_debug("interval/delta/delay/jitter/drift " USEC_FMT "s/%+.3fs/%.3fs/%.3fs/%+"PRIi64"ppm%s", - m->poll_interval_usec / USEC_PER_SEC, offset, delay, m->samples_jitter, m->drift_freq / 65536, - spike ? " (ignored)" : ""); - -diff --git a/src/timesync/timesyncd-manager.h b/src/timesync/timesyncd-manager.h -index d8d97cc1e..18347416d 100644 ---- a/src/timesync/timesyncd-manager.h -+++ b/src/timesync/timesyncd-manager.h -@@ -79,7 +79,7 @@ struct Manager { - /* last change */ - bool jumped; - bool sync; -- long drift_freq; -+ int64_t drift_freq; - - /* watch for time changes */ - sd_event_source *event_clock_watch; --- -2.17.0 - diff --git a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch new file mode 100644 index 0000000000..7dfa1a0df2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch @@ -0,0 +1,29 @@ +From d16f7b37c917b91e951b9313e2c8264c72ed93e5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 15:17:37 -0800 +Subject: [PATCH 2/2] Add sys/stat.h for S_IFDIR + +../git/src/shared/mkdir-label.c:13:61: error: use of undeclared identifier 'S_IFDIR' + r = mac_selinux_create_file_prepare_at(dirfd, path, S_IFDIR); + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/shared/mkdir-label.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c +index d36a6466d7..63b764cd83 100644 +--- a/src/shared/mkdir-label.c ++++ b/src/shared/mkdir-label.c +@@ -4,6 +4,7 @@ + #include "selinux-util.h" + #include "smack-util.h" + #include "user-util.h" ++#include <sys/stat.h> + + int mkdirat_label(int dirfd, const char *path, mode_t mode) { + int r; +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0002-core-Fix-use-after-free-case-in-load_from_path.patch b/meta/recipes-core/systemd/systemd/0002-core-Fix-use-after-free-case-in-load_from_path.patch deleted file mode 100644 index 4da96e2920..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-core-Fix-use-after-free-case-in-load_from_path.patch +++ /dev/null @@ -1,43 +0,0 @@ -From cb67aebd63d9f0077cbf3e769f0b223c5bba20ac Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 16 Dec 2018 20:58:35 -0800 -Subject: [PATCH 2/2] core: Fix use after free case in load_from_path() - -ensure that mfree() on filename is called after the logging function -which uses the string pointed by filename - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/11179] - src/core/load-fragment.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c -index fc5644f48..da585786e 100644 ---- a/src/core/load-fragment.c -+++ b/src/core/load-fragment.c -@@ -4531,7 +4531,6 @@ static int load_from_path(Unit *u, const char *path) { - r = open_follow(&filename, &f, symlink_names, &id); - if (r >= 0) - break; -- filename = mfree(filename); - - /* ENOENT means that the file is missing or is a dangling symlink. - * ENOTDIR means that one of paths we expect to be is a directory -@@ -4540,9 +4539,12 @@ static int load_from_path(Unit *u, const char *path) { - */ - if (r == -EACCES) - log_debug_errno(r, "Cannot access \"%s\": %m", filename); -- else if (!IN_SET(r, -ENOENT, -ENOTDIR)) -+ else if (!IN_SET(r, -ENOENT, -ENOTDIR)) { -+ filename = mfree(filename); - return r; -+ } - -+ filename = mfree(filename); - /* Empty the symlink names for the next run */ - set_clear_free(symlink_names); - } --- -2.20.1 - diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch index 8e0d669e83..5027682df2 100644 --- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch +++ b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch @@ -1,32 +1,55 @@ -From d74a4de6daea5a511c2b5636bbb552c15b3a4ad9 Mon Sep 17 00:00:00 2001 -From: Emil Renner Berthing <systemd@esmil.dk> -Date: Thu, 18 Sep 2014 15:24:56 +0200 +From 5d730902f47498a2866b46875352f6810a01d67c Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 13:41:41 +0800 Subject: [PATCH] don't use glibc-specific qsort_r Upstream-Status: Inappropriate [musl specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> + --- - src/basic/format-table.c | 27 ++++++++++++++++----------- - src/basic/util.h | 7 ------- - src/hwdb/hwdb.c | 18 +++++++++++------- - src/udev/udevadm-hwdb.c | 16 ++++++++++------ - 4 files changed, 37 insertions(+), 31 deletions(-) + src/basic/sort-util.h | 14 -------------- + src/shared/format-table.c | 36 ++++++++++++++++++++++++------------ + src/shared/hwdb-util.c | 19 ++++++++++++++----- + 3 files changed, 38 insertions(+), 31 deletions(-) -diff --git a/src/basic/format-table.c b/src/basic/format-table.c -index 94e796d1ca..9b3f35c29a 100644 ---- a/src/basic/format-table.c -+++ b/src/basic/format-table.c -@@ -745,29 +745,29 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t - return 0; +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -61,18 +61,4 @@ static inline void _qsort_safe(void *bas + _qsort_safe((p), (n), sizeof((p)[0]), (comparison_fn_t) _func_); \ + }) + +-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, comparison_userdata_fn_t compar, void *userdata) { +- if (nmemb <= 1) +- return; +- +- assert(base); +- qsort_r(base, nmemb, size, compar, userdata); +-} +- +-#define typesafe_qsort_r(p, n, func, userdata) \ +- ({ \ +- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ +- qsort_r_safe((p), (n), sizeof((p)[0]), (comparison_userdata_fn_t) _func_, userdata); \ +- }) +- + int cmp_int(const int *a, const int *b); +--- a/src/shared/format-table.c ++++ b/src/shared/format-table.c +@@ -1324,30 +1324,32 @@ static int cell_data_compare(TableData * + return CMP(index_a, index_b); } --static int table_data_compare(const void *x, const void *y, void *userdata) { +-static int table_data_compare(const size_t *a, const size_t *b, Table *t) { +static Table *user_table; +static int table_data_compare(const void *x, const void *y) { - const size_t *a = x, *b = y; -- Table *t = userdata; - size_t i; ++ const size_t *a = x, *b=y; int r; - assert(t); @@ -46,8 +69,8 @@ index 94e796d1ca..9b3f35c29a 100644 return 1; /* Order other lines by the sorting map */ -- for (i = 0; i < t->n_sort_map; i++) { -+ for (i = 0; i < user_table->n_sort_map; i++) { +- for (size_t i = 0; i < t->n_sort_map; i++) { ++ for (size_t i = 0; i < user_table->n_sort_map; i++) { TableData *d, *dd; - d = t->data[*a + t->sort_map[i]]; @@ -57,11 +80,16 @@ index 94e796d1ca..9b3f35c29a 100644 r = cell_data_compare(d, *a, dd, *b); if (r != 0) -@@ -960,7 +960,12 @@ int table_print(Table *t, FILE *f) { - for (i = 0; i < n_rows; i++) +- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r; ++ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r; + } + + /* Order identical lines by the order there were originally added in */ +@@ -2009,7 +2011,12 @@ int table_print(Table *t, FILE *f) { + for (size_t i = 0; i < n_rows; i++) sorted[i] = i * t->n_columns; -- qsort_r_safe(sorted, n_rows, sizeof(size_t), table_data_compare, t); +- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); + if (n_rows <= 1) + return 0; + assert(sorted); @@ -71,113 +99,59 @@ index 94e796d1ca..9b3f35c29a 100644 } if (t->display_map) -diff --git a/src/basic/util.h b/src/basic/util.h -index 9699d228f9..40eaf518cb 100644 ---- a/src/basic/util.h -+++ b/src/basic/util.h -@@ -105,13 +105,6 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_ - qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ - }) +@@ -2647,7 +2654,12 @@ int table_to_json(Table *t, JsonVariant + for (size_t i = 0; i < n_rows; i++) + sorted[i] = i * t->n_columns; --static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void *userdata) { -- if (nmemb <= 1) -- return; -- -- assert(base); -- qsort_r(base, nmemb, size, compar, userdata); --} +- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); ++ if (n_rows <= 1) ++ return 0; ++ assert(sorted); ++ user_table = t; ++ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); ++ user_table = NULL; + } - /** - * Normal memcpy requires src to be nonnull. We do nothing if n is 0. -diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c -index 317cad8a67..701d59a1eb 100644 ---- a/src/hwdb/hwdb.c -+++ b/src/hwdb/hwdb.c -@@ -135,13 +135,12 @@ static void trie_free(struct trie *trie) { + if (t->display_map) +--- a/src/shared/hwdb-util.c ++++ b/src/shared/hwdb-util.c +@@ -127,9 +127,13 @@ static struct trie* trie_free(struct tri DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); --static int trie_values_cmp(const void *v1, const void *v2, void *arg) { +-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) { +- return strcmp(trie->strings->buf + a->key_off, +- trie->strings->buf + b->key_off); +static struct trie *trie_node_add_value_trie; +static int trie_values_cmp(const void *v1, const void *v2) { - const struct trie_value_entry *val1 = v1; - const struct trie_value_entry *val2 = v2; -- struct trie *trie = arg; -- -- return strcmp(trie->strings->buf + val1->key_off, -- trie->strings->buf + val2->key_off); -+ return strcmp(trie_node_add_value_trie->strings->buf + val1->key_off, -+ trie_node_add_value_trie->strings->buf + val2->key_off); ++ const struct trie_value_entry *a = v1; ++ const struct trie_value_entry *b = v2; ++ ++ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off, ++ trie_node_add_value_trie->strings->buf + b->key_off); } static int trie_node_add_value(struct trie *trie, struct trie_node *node, -@@ -166,7 +165,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, +@@ -157,7 +161,10 @@ static int trie_node_add_value(struct tr .value_off = v, }; -- val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); +- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie); + trie_node_add_value_trie = trie; + val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); + trie_node_add_value_trie = NULL; + if (val) { /* At this point we have 2 identical properties on the same match-string. - * Since we process files in order, we just replace the previous value. -@@ -191,7 +193,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, - node->values[node->values_count].file_priority = file_priority; - node->values[node->values_count].line_number = line_number; + * Since we process files in order, we just replace the previous value. */ +@@ -183,7 +190,9 @@ static int trie_node_add_value(struct tr + .line_number = line_number, + }; node->values_count++; -- qsort_r(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); +- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie); + trie_node_add_value_trie = trie; + qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); + trie_node_add_value_trie = NULL; return 0; } -diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c -index 02408a4285..491d367d12 100644 ---- a/src/udev/udevadm-hwdb.c -+++ b/src/udev/udevadm-hwdb.c -@@ -114,13 +114,13 @@ static void trie_node_cleanup(struct trie_node *node) { - free(node); - } - --static int trie_values_cmp(const void *v1, const void *v2, void *arg) { -+static struct trie *trie_node_add_value_trie; -+static int trie_values_cmp(const void *v1, const void *v2) { - const struct trie_value_entry *val1 = v1; - const struct trie_value_entry *val2 = v2; -- struct trie *trie = arg; - -- return strcmp(trie->strings->buf + val1->key_off, -- trie->strings->buf + val2->key_off); -+ return strcmp(trie_node_add_value_trie->strings->buf + val1->key_off, -+ trie_node_add_value_trie->strings->buf + val2->key_off); - } - - static int trie_node_add_value(struct trie *trie, struct trie_node *node, -@@ -141,7 +141,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, - .value_off = v, - }; - -- val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); -+ trie_node_add_value_trie = trie; -+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); -+ trie_node_add_value_trie = NULL; - if (val) { - /* replace existing earlier key with new value */ - val->value_off = v; -@@ -158,7 +160,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, - node->values[node->values_count].key_off = k; - node->values[node->values_count].value_off = v; - node->values_count++; -- qsort_r(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); -+ trie_node_add_value_trie = trie; -+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); -+ trie_node_add_value_trie = NULL; - return 0; - } - --- -2.18.0 - diff --git a/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch deleted file mode 100644 index 1d7f5230a9..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 6e62be87a2722fbe531310a1b052c1301bdf06fb Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 27 Jun 2018 16:09:24 +0800 -Subject: [PATCH 2/9] use lnr wrapper instead of looking for --relative option - for ln - -Remove file manually to avoid the 'File Exists' error when creating -symlink. This is because the original 'ln' command uses '-f' option. - -Upstream-Status: Inappropriate [OE-Specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 4 ---- - tools/meson-make-symlink.sh | 3 ++- - units/meson-add-wants.sh | 7 ++++++- - 3 files changed, 8 insertions(+), 6 deletions(-) - -diff --git a/meson.build b/meson.build -index 04331dd41..6d5edcb4e 100644 ---- a/meson.build -+++ b/meson.build -@@ -558,10 +558,6 @@ endforeach - - conf.set_quoted('TELINIT', get_option('telinit-path')) - --if run_command('ln', '--relative', '--help').returncode() != 0 -- error('ln does not support --relative (added in coreutils 8.16)') --endif -- - ############################################################ - - gperf = find_program('gperf') -diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh -index 501cd43d4..f4e4ac9ac 100755 ---- a/tools/meson-make-symlink.sh -+++ b/tools/meson-make-symlink.sh -@@ -8,5 +8,6 @@ mkdir -vp "$(dirname "${DESTDIR:-}$2")" - if [ "$(dirname $1)" = . ]; then - ln -vfs -T "$1" "${DESTDIR:-}$2" - else -- ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" -+ rm -f "${DESTDIR:-}$2" -+ lnr "${DESTDIR:-}$1" "${DESTDIR:-}$2" - fi -diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh -index 70f7172ae..a42666aac 100755 ---- a/units/meson-add-wants.sh -+++ b/units/meson-add-wants.sh -@@ -25,4 +25,9 @@ case "$target" in - ;; - esac - --ln -vfs --relative "$unitpath" "$dir" -+if [ -d "$dir" ]; then -+ rm -f "$dir/$unit" -+ lnr "$unitpath" "$dir/$unit" -+else -+ lnr "$unitpath" "$dir" -+fi --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch b/meta/recipes-core/systemd/systemd/0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch deleted file mode 100644 index 115fb33c30..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e965e748c7030df0709e63128db2f023540a06ba Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sat, 12 Sep 2015 18:53:31 +0000 -Subject: [PATCH 03/19] comparison_fn_t is glibc specific, use raw signature in - function pointer - -make it work with musl where comparison_fn_t is not provided - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/basic/util.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/basic/util.h b/src/basic/util.h -index 40eaf518c..c58392397 100644 ---- a/src/basic/util.h -+++ b/src/basic/util.h -@@ -77,7 +77,7 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, - * that only if nmemb > 0. - */ - static inline void* bsearch_safe(const void *key, const void *base, -- size_t nmemb, size_t size, comparison_fn_t compar) { -+ size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - if (nmemb <= 0) - return NULL; - -@@ -89,7 +89,7 @@ static inline void* bsearch_safe(const void *key, const void *base, - * Normal qsort requires base to be nonnull. Here were require - * that only if nmemb > 0. - */ --static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) { -+static inline void qsort_safe(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - if (nmemb <= 1) - return; - --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch index 6c595ae733..c6204786b3 100644 --- a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch +++ b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch @@ -1,7 +1,7 @@ -From 0fcb6e646401205e17cc6c129441a49023c62cef Mon Sep 17 00:00:00 2001 +From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sat, 5 Sep 2015 06:31:47 +0000 -Subject: [PATCH 3/9] implment systemd-sysv-install for OE +Subject: [PATCH] implment systemd-sysv-install for OE Use update-rc.d for enabling/disabling and status command to check the status of the sysv service @@ -9,12 +9,13 @@ to check the status of the sysv service Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index 8c16cf999..9f078a121 100755 +index 8c16cf99913f..9f078a121469 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON @@ -32,17 +32,17 @@ case "$1" in @@ -38,6 +39,3 @@ index 8c16cf999..9f078a121 100755 ;; *) usage ;; --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch new file mode 100644 index 0000000000..f3edc7d82b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch @@ -0,0 +1,68 @@ +From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 13:55:12 +0800 +Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t + +Make it work with musl where comparison_fn_t and __compare_fn_t +is not provided. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v244] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> + +--- + src/basic/missing_type.h | 9 +++++++++ + src/basic/sort-util.h | 1 + + src/core/kmod-setup.c | 1 + + src/libsystemd/sd-journal/catalog.c | 1 + + 4 files changed, 12 insertions(+) + +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -10,3 +10,12 @@ + #if !HAVE_CHAR16_T + #define char16_t uint16_t + #endif ++ ++#ifndef __GLIBC__ ++typedef int (*comparison_fn_t)(const void *, const void *); ++#endif ++ ++#ifndef __COMPAR_FN_T ++#define __COMPAR_FN_T ++typedef int (*__compar_fn_t)(const void *, const void *); ++#endif +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -4,6 +4,7 @@ + #include <stdlib.h> + + #include "macro.h" ++#include "missing_type.h" + + /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the + * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that +--- a/src/core/kmod-setup.c ++++ b/src/core/kmod-setup.c +@@ -10,6 +10,7 @@ + #include "macro.h" + #include "recurse-dir.h" + #include "string-util.h" ++#include "missing_type.h" + + #if HAVE_KMOD + #include "module-util.h" +--- a/src/libsystemd/sd-journal/catalog.c ++++ b/src/libsystemd/sd-journal/catalog.c +@@ -28,6 +28,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing_type.h" + + const char * const catalog_file_dirs[] = { + "/usr/local/lib/systemd/catalog/", diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch index 7652a2d8cc..d93f630752 100644 --- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch +++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch @@ -1,55 +1,51 @@ -From 582af7ec13131dfcc620ed81de7b211914c4cb03 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 29 Jun 2018 13:43:49 +0800 -Subject: [PATCH 04/19] add fallback parse_printf_format implementation +From 3e0df2c22bfd37bc62bf09a01ec498e40d3599de Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Sat, 22 May 2021 20:26:24 +0200 +Subject: [PATCH] add fallback parse_printf_format implementation Upstream-Status: Inappropriate [musl specific] Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + --- - meson.build | 1 + - src/basic/meson.build | 5 + - src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++++++++++ - src/basic/parse-printf-format.h | 57 +++++++++ - src/basic/stdio-util.h | 2 +- - src/journal/journal-send.c | 2 +- + meson.build | 1 + + src/basic/meson.build | 5 + + src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++ + src/basic/parse-printf-format.h | 57 +++++ + src/basic/stdio-util.h | 2 +- + src/libsystemd/sd-journal/journal-send.c | 2 +- 6 files changed, 338 insertions(+), 2 deletions(-) create mode 100644 src/basic/parse-printf-format.c create mode 100644 src/basic/parse-printf-format.h -diff --git a/meson.build b/meson.build -index e045b9224..8c16bc979 100644 --- a/meson.build +++ b/meson.build -@@ -598,6 +598,7 @@ foreach header : ['crypt.h', - 'linux/btrfs.h', +@@ -686,6 +686,7 @@ endif + foreach header : ['crypt.h', 'linux/memfd.h', 'linux/vm_sockets.h', + 'printf.h', 'sys/auxv.h', 'valgrind/memcheck.h', 'valgrind/valgrind.h', -diff --git a/src/basic/meson.build b/src/basic/meson.build -index 31625b178..0c27528e7 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build -@@ -302,6 +302,11 @@ foreach item : [['af', af_list_txt, 'af', ''], - endforeach +@@ -335,6 +335,11 @@ endforeach + + basic_sources += generated_gperf_headers - basic_sources += [missing_h] + generated_gperf_headers -+ +if conf.get('HAVE_PRINTF_H') != 1 + basic_sources += [files('parse-printf-format.c')] +endif + - basic_gcrypt_sources = files( - 'gcrypt-util.c', - 'gcrypt-util.h') -diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c -new file mode 100644 -index 000000000..49437e544 ++ + ############################################################ + + arch_list = [ --- /dev/null +++ b/src/basic/parse-printf-format.c @@ -0,0 +1,273 @@ @@ -326,9 +322,6 @@ index 000000000..49437e544 + + return last; +} -diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h -new file mode 100644 -index 000000000..47be7522d --- /dev/null +++ b/src/basic/parse-printf-format.h @@ -0,0 +1,57 @@ @@ -389,12 +382,10 @@ index 000000000..47be7522d +size_t parse_printf_format(const char *fmt, size_t n, int *types); + +#endif /* HAVE_PRINTF_H */ -diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h -index 73c03274c..30192cd71 100644 --- a/src/basic/stdio-util.h +++ b/src/basic/stdio-util.h -@@ -1,12 +1,12 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ +@@ -1,13 +1,13 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include <printf.h> @@ -403,30 +394,26 @@ index 73c03274c..30192cd71 100644 #include <sys/types.h> #include "macro.h" + #include "memory-util.h" +#include "parse-printf-format.h" - #define snprintf_ok(buf, len, fmt, ...) \ - ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) -diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c -index a0621524a..65bcbcd2e 100644 ---- a/src/journal/journal-send.c -+++ b/src/journal/journal-send.c + #define snprintf_ok(buf, len, fmt, ...) \ + ({ \ +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c @@ -2,7 +2,6 @@ #include <errno.h> #include <fcntl.h> -#include <printf.h> #include <stddef.h> - #include <sys/socket.h> #include <sys/un.h> + #include <unistd.h> @@ -21,6 +20,7 @@ #include "stdio-util.h" #include "string-util.h" - #include "util.h" + #include "tmpfile-util.h" +#include "parse-printf-format.h" #define SNDBUF_SIZE (8*1024*1024) --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch b/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch deleted file mode 100644 index 7e37cbc2c1..0000000000 --- a/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 5d8128f3832fd11fd046d1d1ad86c4ee7bc1dff0 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 9 Nov 2016 19:41:13 -0800 -Subject: [PATCH 4/9] rules: whitelist hd* devices - -qemu by default emulates IDE and the linux-yocto kernel(s) use -CONFIG_IDE instead of the more modern libsata, so disks appear as -/dev/hd*. Patch rejected upstream because CONFIG_IDE is deprecated. - -Upstream-Status: Denied [https://github.com/systemd/systemd/pull/1276] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - rules/60-persistent-storage.rules | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules -index 8ddb7577c..811e948ad 100644 ---- a/rules/60-persistent-storage.rules -+++ b/rules/60-persistent-storage.rules -@@ -7,7 +7,7 @@ ACTION=="remove", GOTO="persistent_storage_end" - ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_end" - - SUBSYSTEM!="block", GOTO="persistent_storage_end" --KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|scm*|pmem*|nbd*", GOTO="persistent_storage_end" -+KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|scm*|pmem*|nbd*|hd*", GOTO="persistent_storage_end" - - # ignore partitions that span the entire disk - TEST=="whole_disk", GOTO="persistent_storage_end" --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0005-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0005-Make-root-s-home-directory-configurable.patch deleted file mode 100644 index c13708728e..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-Make-root-s-home-directory-configurable.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 8b82663aeeedf9ca58e3b97116b4c4da5229e0f5 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 27 Jun 2018 16:46:45 +0800 -Subject: [PATCH 5/9] Make root's home directory configurable - -OpenEmbedded has a configurable home directory for root. Allow -systemd to be built using its idea of what root's home directory -should be. - -Upstream-Status: Denied -Upstream wants to have a unified hierarchy where everyone is -using the same root folder. -https://github.com/systemd/systemd/issues/541 - -Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 7 +++++++ - meson_options.txt | 2 ++ - 2 files changed, 9 insertions(+) - -diff --git a/meson.build b/meson.build -index 6d5edcb4e..323146fe1 100644 ---- a/meson.build -+++ b/meson.build -@@ -89,6 +89,11 @@ if rootlibdir == '' - rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1]) - endif - -+roothomedir = get_option('roothomedir') -+if roothomedir == '' -+ roothomedir = '/root' -+endif -+ - # Dirs of external packages - pkgconfigdatadir = join_paths(datadir, 'pkgconfig') - pkgconfiglibdir = join_paths(libdir, 'pkgconfig') -@@ -210,6 +215,7 @@ conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) - conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) - conf.set_quoted('LIBDIR', libdir) - conf.set_quoted('ROOTLIBDIR', rootlibdir) -+conf.set_quoted('ROOTHOMEDIR', roothomedir) - conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir) - conf.set_quoted('BOOTLIBDIR', bootlibdir) - conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull')) -@@ -228,6 +234,7 @@ substs.set('prefix', prefixdir) - substs.set('exec_prefix', prefixdir) - substs.set('libdir', libdir) - substs.set('rootlibdir', rootlibdir) -+substs.set('roothomedir', roothomedir) - substs.set('includedir', includedir) - substs.set('pkgsysconfdir', pkgsysconfdir) - substs.set('bindir', bindir) -diff --git a/meson_options.txt b/meson_options.txt -index 16c1f2b2f..aa9a33368 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -9,6 +9,8 @@ option('rootlibdir', type : 'string', - description : '''[/usr]/lib/x86_64-linux-gnu or such''') - option('rootprefix', type : 'string', - description : '''override the root prefix''') -+option('roothomedir', type : 'string', -+ description : '''override the root home directory''') - option('link-udev-shared', type : 'boolean', - description : 'link systemd-udev and its helpers to libsystemd-shared.so') - option('link-systemctl-shared', type: 'boolean', --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch b/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch deleted file mode 100644 index 6d5faf5fed..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a2c4d46944892174930135672508389a04e191f0 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 29 Jun 2018 13:53:29 +0800 -Subject: [PATCH 05/19] include gshadow only if ENABLE_GSHADOW is 1 - -Upstream-Status: Inappropriate [musl] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/user-util.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/basic/user-util.h b/src/basic/user-util.h -index b74f16885..f9c1e29c4 100644 ---- a/src/basic/user-util.h -+++ b/src/basic/user-util.h -@@ -2,7 +2,9 @@ - #pragma once - - #include <grp.h> -+#if ENABLE_GSHADOW - #include <gshadow.h> -+#endif - #include <pwd.h> - #include <shadow.h> - #include <stdbool.h> --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..36545c2f60 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch @@ -0,0 +1,602 @@ +From cef23a651ea200e30e1e6ed2a2564505e3a42d46 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 14:18:21 +0800 +Subject: [PATCH] src/basic/missing.h: check for missing strndupa + +include missing.h for definition of strndupa + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[rebased for systemd 244] +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> + +--- + meson.build | 1 + + src/backlight/backlight.c | 1 + + src/basic/cgroup-util.c | 1 + + src/basic/env-util.c | 1 + + src/basic/log.c | 1 + + src/basic/missing_stdlib.h | 12 ++++++++++++ + src/basic/mkdir.c | 1 + + src/basic/mountpoint-util.c | 1 + + src/basic/parse-util.c | 1 + + src/basic/path-lookup.c | 1 + + src/basic/percent-util.c | 1 + + src/basic/proc-cmdline.c | 1 + + src/basic/procfs-util.c | 1 + + src/basic/time-util.c | 1 + + src/boot/bless-boot.c | 1 + + src/core/dbus-cgroup.c | 1 + + src/core/dbus-execute.c | 1 + + src/core/dbus-util.c | 1 + + src/core/execute.c | 1 + + src/core/kmod-setup.c | 1 + + src/core/service.c | 1 + + src/coredump/coredump-vacuum.c | 1 + + src/journal-remote/journal-remote-main.c | 1 + + src/journal/journalctl.c | 1 + + src/libsystemd/sd-bus/bus-message.c | 1 + + src/libsystemd/sd-bus/bus-objects.c | 1 + + src/libsystemd/sd-bus/bus-socket.c | 1 + + src/libsystemd/sd-bus/sd-bus.c | 1 + + src/libsystemd/sd-bus/test-bus-benchmark.c | 1 + + src/libsystemd/sd-journal/sd-journal.c | 1 + + src/locale/keymap-util.c | 1 + + src/login/pam_systemd.c | 1 + + src/network/generator/network-generator.c | 1 + + src/nspawn/nspawn-settings.c | 1 + + src/nss-mymachines/nss-mymachines.c | 1 + + src/portable/portable.c | 1 + + src/resolve/resolvectl.c | 1 + + src/shared/bus-get-properties.c | 1 + + src/shared/bus-unit-procs.c | 1 + + src/shared/bus-unit-util.c | 1 + + src/shared/bus-util.c | 1 + + src/shared/dns-domain.c | 1 + + src/shared/journal-importer.c | 1 + + src/shared/logs-show.c | 1 + + src/shared/pager.c | 1 + + src/shared/uid-range.c | 1 + + src/socket-proxy/socket-proxyd.c | 1 + + src/test/test-hexdecoct.c | 1 + + src/udev/udev-builtin-path_id.c | 1 + + src/udev/udev-event.c | 1 + + src/udev/udev-rules.c | 1 + + 51 files changed, 62 insertions(+) + +--- a/meson.build ++++ b/meson.build +@@ -507,6 +507,7 @@ foreach ident : ['secure_getenv', '__sec + endforeach + + foreach ident : [ ++ ['strndupa' , '''#include <string.h>'''], + ['memfd_create', '''#include <sys/mman.h>'''], + ['gettid', '''#include <sys/types.h> + #include <unistd.h>'''], +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -19,6 +19,7 @@ + #include "string-util.h" + #include "strv.h" + #include "util.h" ++#include "missing_stdlib.h" + + static int help(void) { + _cleanup_free_ char *link = NULL; +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -37,6 +37,7 @@ + #include "unit-name.h" + #include "user-util.h" + #include "xattr-util.h" ++#include "missing_stdlib.h" + + static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) { + _cleanup_free_ char *fs = NULL; +--- a/src/basic/env-util.c ++++ b/src/basic/env-util.c +@@ -19,6 +19,7 @@ + #include "string-util.h" + #include "strv.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + /* We follow bash for the character set. Different shells have different rules. */ + #define VALID_BASH_ENV_NAME_CHARS \ +--- a/src/basic/log.c ++++ b/src/basic/log.c +@@ -36,6 +36,7 @@ + #include "terminal-util.h" + #include "time-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + #define SNDBUF_SIZE (8*1024*1024) + +--- a/src/basic/missing_stdlib.h ++++ b/src/basic/missing_stdlib.h +@@ -11,3 +11,15 @@ + # error "neither secure_getenv nor __secure_getenv are available" + # endif + #endif ++ ++/* string.h */ ++#if ! HAVE_STRNDUPA ++#define strndupa(s, n) \ ++ ({ \ ++ const char *__old = (s); \ ++ size_t __len = strnlen(__old, (n)); \ ++ char *__new = (char *)alloca(__len + 1); \ ++ __new[__len] = '\0'; \ ++ (char *)memcpy(__new, __old, __len); \ ++ }) ++#endif +--- a/src/basic/mkdir.c ++++ b/src/basic/mkdir.c +@@ -15,6 +15,7 @@ + #include "stat-util.h" + #include "stdio-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + int mkdir_safe_internal( + const char *path, +--- a/src/basic/mountpoint-util.c ++++ b/src/basic/mountpoint-util.c +@@ -13,6 +13,7 @@ + #include "missing_stat.h" + #include "missing_syscall.h" + #include "mkdir.h" ++#include "missing_stdlib.h" + #include "mountpoint-util.h" + #include "nulstr-util.h" + #include "parse-util.h" +--- a/src/basic/parse-util.c ++++ b/src/basic/parse-util.c +@@ -18,6 +18,7 @@ + #include "stat-util.h" + #include "string-util.h" + #include "strv.h" ++#include "missing_stdlib.h" + + int parse_boolean(const char *v) { + if (!v) +--- a/src/basic/path-lookup.c ++++ b/src/basic/path-lookup.c +@@ -16,6 +16,7 @@ + #include "strv.h" + #include "tmpfile-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + int xdg_user_runtime_dir(char **ret, const char *suffix) { + const char *e; +--- a/src/basic/percent-util.c ++++ b/src/basic/percent-util.c +@@ -3,6 +3,7 @@ + #include "percent-util.h" + #include "string-util.h" + #include "parse-util.h" ++#include "missing_stdlib.h" + + static int parse_parts_value_whole(const char *p, const char *symbol) { + const char *pc, *n; +--- a/src/basic/proc-cmdline.c ++++ b/src/basic/proc-cmdline.c +@@ -15,6 +15,7 @@ + #include "string-util.h" + #include "util.h" + #include "virt.h" ++#include "missing_stdlib.h" + + int proc_cmdline(char **ret) { + const char *e; +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -12,6 +12,7 @@ + #include "procfs-util.h" + #include "stdio-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + + int procfs_get_pid_max(uint64_t *ret) { + _cleanup_free_ char *value = NULL; +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -26,6 +26,7 @@ + #include "string-util.h" + #include "strv.h" + #include "time-util.h" ++#include "missing_stdlib.h" + + static clockid_t map_clock_id(clockid_t c) { + +--- a/src/boot/bless-boot.c ++++ b/src/boot/bless-boot.c +@@ -19,6 +19,7 @@ + #include "util.h" + #include "verbs.h" + #include "virt.h" ++#include "missing_stdlib.h" + + static char **arg_path = NULL; + +--- a/src/core/dbus-execute.c ++++ b/src/core/dbus-execute.c +@@ -44,6 +44,7 @@ + #include "unit-printf.h" + #include "user-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput); + static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput); +--- a/src/core/dbus-util.c ++++ b/src/core/dbus-util.c +@@ -9,6 +9,7 @@ + #include "unit-printf.h" + #include "user-util.h" + #include "unit.h" ++#include "missing_stdlib.h" + + int bus_property_get_triggered_unit( + sd_bus *bus, +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -102,6 +102,7 @@ + #include "unit-serialize.h" + #include "user-util.h" + #include "utmp-wtmp.h" ++#include "missing_stdlib.h" + + #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC) + #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC) +--- a/src/core/kmod-setup.c ++++ b/src/core/kmod-setup.c +@@ -11,6 +11,7 @@ + #include "recurse-dir.h" + #include "string-util.h" + #include "missing_type.h" ++#include "missing_stdlib.h" + + #if HAVE_KMOD + #include "module-util.h" +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -42,6 +42,7 @@ + #include "unit.h" + #include "utf8.h" + #include "util.h" ++#include "missing_stdlib.h" + + static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { + [SERVICE_DEAD] = UNIT_INACTIVE, +--- a/src/coredump/coredump-vacuum.c ++++ b/src/coredump/coredump-vacuum.c +@@ -16,6 +16,7 @@ + #include "string-util.h" + #include "time-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */ + #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */ +--- a/src/journal-remote/journal-remote-main.c ++++ b/src/journal-remote/journal-remote-main.c +@@ -24,6 +24,7 @@ + #include "stat-util.h" + #include "string-table.h" + #include "strv.h" ++#include "missing_stdlib.h" + + #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem" + #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem" +--- a/src/journal/journalctl.c ++++ b/src/journal/journalctl.c +@@ -73,6 +73,7 @@ + #include "unit-name.h" + #include "user-util.h" + #include "varlink.h" ++#include "missing_stdlib.h" + + #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) + #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */ +--- a/src/libsystemd/sd-bus/bus-message.c ++++ b/src/libsystemd/sd-bus/bus-message.c +@@ -20,6 +20,7 @@ + #include "strv.h" + #include "time-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); + +--- a/src/libsystemd/sd-bus/bus-objects.c ++++ b/src/libsystemd/sd-bus/bus-objects.c +@@ -12,6 +12,7 @@ + #include "set.h" + #include "string-util.h" + #include "strv.h" ++#include "missing_stdlib.h" + + static int node_vtable_get_userdata( + sd_bus *bus, +--- a/src/libsystemd/sd-bus/bus-socket.c ++++ b/src/libsystemd/sd-bus/bus-socket.c +@@ -28,6 +28,7 @@ + #include "string-util.h" + #include "user-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + #define SNDBUF_SIZE (8*1024*1024) + +--- a/src/libsystemd/sd-bus/sd-bus.c ++++ b/src/libsystemd/sd-bus/sd-bus.c +@@ -43,6 +43,7 @@ + #include "string-util.h" + #include "strv.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + #define log_debug_bus_message(m) \ + do { \ +--- a/src/libsystemd/sd-bus/test-bus-benchmark.c ++++ b/src/libsystemd/sd-bus/test-bus-benchmark.c +@@ -14,6 +14,7 @@ + #include "string-util.h" + #include "time-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + #define MAX_SIZE (2*1024*1024) + +--- a/src/libsystemd/sd-journal/sd-journal.c ++++ b/src/libsystemd/sd-journal/sd-journal.c +@@ -41,6 +41,7 @@ + #include "string-util.h" + #include "strv.h" + #include "syslog-util.h" ++#include "missing_stdlib.h" + + #define JOURNAL_FILES_MAX 7168 + +--- a/src/locale/keymap-util.c ++++ b/src/locale/keymap-util.c +@@ -24,6 +24,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing_stdlib.h" + + static bool startswith_comma(const char *s, const char *prefix) { + s = startswith(s, prefix); +--- a/src/login/pam_systemd.c ++++ b/src/login/pam_systemd.c +@@ -31,6 +31,7 @@ + #include "locale-util.h" + #include "login-util.h" + #include "macro.h" ++#include "missing_stdlib.h" + #include "pam-util.h" + #include "parse-util.h" + #include "path-util.h" +--- a/src/network/generator/network-generator.c ++++ b/src/network/generator/network-generator.c +@@ -13,6 +13,7 @@ + #include "string-table.h" + #include "string-util.h" + #include "strv.h" ++#include "missing_stdlib.h" + + /* + # .network +--- a/src/nspawn/nspawn-settings.c ++++ b/src/nspawn/nspawn-settings.c +@@ -17,6 +17,7 @@ + #include "strv.h" + #include "user-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + Settings *settings_new(void) { + Settings *s; +--- a/src/nss-mymachines/nss-mymachines.c ++++ b/src/nss-mymachines/nss-mymachines.c +@@ -21,6 +21,7 @@ + #include "nss-util.h" + #include "signal-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + + static void setup_logging_once(void) { + static pthread_once_t once = PTHREAD_ONCE_INIT; +--- a/src/portable/portable.c ++++ b/src/portable/portable.c +@@ -39,6 +39,7 @@ + #include "strv.h" + #include "tmpfile-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was + * dropped there by the portable service logic and b) for which image it was dropped there. */ +--- a/src/resolve/resolvectl.c ++++ b/src/resolve/resolvectl.c +@@ -43,6 +43,7 @@ + #include "utf8.h" + #include "verb-log-control.h" + #include "verbs.h" ++#include "missing_stdlib.h" + + static int arg_family = AF_UNSPEC; + static int arg_ifindex = 0; +--- a/src/shared/bus-get-properties.c ++++ b/src/shared/bus-get-properties.c +@@ -4,6 +4,7 @@ + #include "rlimit-util.h" + #include "stdio-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + + int bus_property_get_bool( + sd_bus *bus, +--- a/src/shared/bus-unit-procs.c ++++ b/src/shared/bus-unit-procs.c +@@ -10,6 +10,7 @@ + #include "sort-util.h" + #include "string-util.h" + #include "terminal-util.h" ++#include "missing_stdlib.h" + + struct CGroupInfo { + char *cgroup_path; +--- a/src/shared/bus-unit-util.c ++++ b/src/shared/bus-unit-util.c +@@ -49,6 +49,7 @@ + #include "unit-def.h" + #include "user-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { + assert(message); +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -21,6 +21,7 @@ + #include "path-util.h" + #include "socket-util.h" + #include "stdio-util.h" ++#include "missing_stdlib.h" + + static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { + sd_event *e = userdata; +--- a/src/shared/dns-domain.c ++++ b/src/shared/dns-domain.c +@@ -17,6 +17,7 @@ + #include "string-util.h" + #include "strv.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { + const char *n; +--- a/src/shared/journal-importer.c ++++ b/src/shared/journal-importer.c +@@ -15,6 +15,7 @@ + #include "parse-util.h" + #include "string-util.h" + #include "unaligned.h" ++#include "missing_stdlib.h" + + enum { + IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ +--- a/src/shared/logs-show.c ++++ b/src/shared/logs-show.c +@@ -42,6 +42,7 @@ + #include "utf8.h" + #include "util.h" + #include "web-util.h" ++#include "missing_stdlib.h" + + /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ + #define PRINT_LINE_THRESHOLD 3 +--- a/src/shared/pager.c ++++ b/src/shared/pager.c +@@ -26,6 +26,7 @@ + #include "strv.h" + #include "terminal-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + static pid_t pager_pid = 0; + +--- a/src/shared/uid-range.c ++++ b/src/shared/uid-range.c +@@ -9,6 +9,7 @@ + #include "sort-util.h" + #include "uid-range.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { + assert(range); +--- a/src/socket-proxy/socket-proxyd.c ++++ b/src/socket-proxy/socket-proxyd.c +@@ -26,6 +26,7 @@ + #include "socket-util.h" + #include "string-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + #define BUFFER_SIZE (256 * 1024) + +--- a/src/test/test-hexdecoct.c ++++ b/src/test/test-hexdecoct.c +@@ -7,6 +7,7 @@ + #include "macro.h" + #include "random-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + #include "tests.h" + + TEST(hexchar) { +--- a/src/udev/udev-builtin-path_id.c ++++ b/src/udev/udev-builtin-path_id.c +@@ -22,6 +22,7 @@ + #include "sysexits.h" + #include "udev-builtin.h" + #include "udev-util.h" ++#include "missing_stdlib.h" + + _printf_(2,3) + static void path_prepend(char **path, const char *fmt, ...) { +--- a/src/udev/udev-event.c ++++ b/src/udev/udev-event.c +@@ -35,6 +35,7 @@ + #include "udev-util.h" + #include "udev-watch.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + typedef struct Spawn { + sd_device *device; +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -34,6 +34,7 @@ + #include "udev-util.h" + #include "user-util.h" + #include "virt.h" ++#include "missing_stdlib.h" + + #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") + +--- a/src/core/dbus-cgroup.c ++++ b/src/core/dbus-cgroup.c +@@ -21,6 +21,7 @@ + #include "parse-util.h" + #include "path-util.h" + #include "percent-util.h" ++#include "missing_stdlib.h" + #include "socket-util.h" + + BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -29,6 +29,7 @@ + #include "util.h" + #include "virt.h" + #include "volatile-util.h" ++#include "missing_stdlib.h" + + typedef enum MountPointFlags { + MOUNT_NOAUTO = 1 << 0, diff --git a/meta/recipes-core/systemd/systemd/0006-remove-nobody-user-group-checking.patch b/meta/recipes-core/systemd/systemd/0006-remove-nobody-user-group-checking.patch deleted file mode 100644 index eb6eb8bfeb..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-remove-nobody-user-group-checking.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 5199ae5dec9b8a9c9e20477d5090f1732735fbe2 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Thu, 28 Jun 2018 09:38:12 +0800 -Subject: [PATCH 6/9] remove nobody user/group checking - -Upstream-Status: Inappropriate [OE Specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 37 ------------------------------------- - 1 file changed, 37 deletions(-) - -diff --git a/meson.build b/meson.build -index 323146fe1..3bb087fef 100644 ---- a/meson.build -+++ b/meson.build -@@ -681,43 +681,6 @@ substs.set('containeruidbasemax', container_uid_base_max) - nobody_user = get_option('nobody-user') - nobody_group = get_option('nobody-group') - --getent_result = run_command('getent', 'passwd', '65534') --if getent_result.returncode() == 0 -- name = getent_result.stdout().split(':')[0] -- if name != nobody_user -- warning('\n' + -- 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) + -- 'Your build will result in an user table setup that is incompatible with the local system.') -- endif --endif --id_result = run_command('id', '-u', nobody_user) --if id_result.returncode() == 0 -- id = id_result.stdout().to_int() -- if id != 65534 -- warning('\n' + -- 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) + -- 'Your build will result in an user table setup that is incompatible with the local system.') -- endif --endif -- --getent_result = run_command('getent', 'group', '65534') --if getent_result.returncode() == 0 -- name = getent_result.stdout().split(':')[0] -- if name != nobody_group -- warning('\n' + -- 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) + -- 'Your build will result in an group table setup that is incompatible with the local system.') -- endif --endif --id_result = run_command('id', '-g', nobody_group) --if id_result.returncode() == 0 -- id = id_result.stdout().to_int() -- if id != 65534 -- warning('\n' + -- 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) + -- 'Your build will result in an group table setup that is incompatible with the local system.') -- endif --endif - if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup') - warning('\n' + - 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) + --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0006-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0006-src-basic-missing.h-check-for-missing-strndupa.patch deleted file mode 100644 index 107a794398..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-src-basic-missing.h-check-for-missing-strndupa.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 03fd19fc87573276e0d359260c8fe591f5f0216a Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 29 Jun 2018 16:34:50 +0800 -Subject: [PATCH 06/19] src/basic/missing.h: check for missing strndupa - -include missing.h for definition of strndupa - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 1 + - src/basic/missing.h | 11 +++++++++++ - src/basic/mkdir.c | 1 + - src/basic/pager.c | 1 + - src/basic/parse-util.c | 1 + - src/basic/procfs-util.c | 1 + - src/shared/uid-range.c | 1 + - 7 files changed, 17 insertions(+) - -diff --git a/meson.build b/meson.build -index 8c16bc979..a734a295c 100644 ---- a/meson.build -+++ b/meson.build -@@ -503,6 +503,7 @@ foreach ident : [ - #include <unistd.h>'''], - ['explicit_bzero' , '''#include <string.h>'''], - ['reallocarray', '''#include <malloc.h>'''], -+ ['strndupa' , '''#include <string.h>'''], - ] - - have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') -diff --git a/src/basic/missing.h b/src/basic/missing.h -index 0e33abb9f..02397f1b6 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -1184,6 +1184,17 @@ struct input_mask { - typedef int32_t key_serial_t; - #endif - -+#if ! HAVE_STRNDUPA -+#define strndupa(s, n) \ -+ ({ \ -+ const char *__old = (s); \ -+ size_t __len = strnlen(__old, (n)); \ -+ char *__new = (char *)alloca(__len + 1); \ -+ __new[__len] = '\0'; \ -+ (char *)memcpy(__new, __old, __len); \ -+ }) -+#endif -+ - #ifndef KEYCTL_JOIN_SESSION_KEYRING - #define KEYCTL_JOIN_SESSION_KEYRING 1 - #endif -diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c -index 6ab1b4422..77c3e0863 100644 ---- a/src/basic/mkdir.c -+++ b/src/basic/mkdir.c -@@ -13,6 +13,7 @@ - #include "stat-util.h" - #include "stdio-util.h" - #include "user-util.h" -+#include "missing.h" - - int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdir_func_t _mkdir) { - struct stat st; -diff --git a/src/basic/pager.c b/src/basic/pager.c -index f24126111..8223bff02 100644 ---- a/src/basic/pager.c -+++ b/src/basic/pager.c -@@ -21,6 +21,7 @@ - #include "string-util.h" - #include "strv.h" - #include "terminal-util.h" -+#include "missing.h" - - static pid_t pager_pid = 0; - -diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c -index 6becf8587..52576f536 100644 ---- a/src/basic/parse-util.c -+++ b/src/basic/parse-util.c -@@ -17,6 +17,7 @@ - #include "parse-util.h" - #include "process-util.h" - #include "string-util.h" -+#include "missing.h" - - int parse_boolean(const char *v) { - assert(v); -diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index a159e344b..ebc427d6b 100644 ---- a/src/basic/procfs-util.c -+++ b/src/basic/procfs-util.c -@@ -11,6 +11,7 @@ - #include "procfs-util.h" - #include "stdio-util.h" - #include "string-util.h" -+#include "missing.h" - - int procfs_tasks_get_limit(uint64_t *ret) { - _cleanup_free_ char *value = NULL; -diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c -index 434ce6ff4..37093ab7b 100644 ---- a/src/shared/uid-range.c -+++ b/src/shared/uid-range.c -@@ -8,6 +8,7 @@ - #include "macro.h" - #include "uid-range.h" - #include "user-util.h" -+#include "missing.h" - - static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { - assert(range); --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0007-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0007-Include-netinet-if_ether.h.patch deleted file mode 100644 index 2df8cf95fd..0000000000 --- a/meta/recipes-core/systemd/systemd/0007-Include-netinet-if_ether.h.patch +++ /dev/null @@ -1,96 +0,0 @@ -From aab90d0dfa934d33879eaec1a878e93b201d33f1 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 29 Jun 2018 16:44:43 +0800 -Subject: [PATCH 07/19] Include netinet/if_ether.h - -Fixes -/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' - struct ethhdr { - ^~~~~~ - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/libsystemd/sd-netlink/netlink-types.c | 1 + - src/network/netdev/tuntap.c | 1 + - src/network/networkd-brvlan.c | 1 + - src/udev/net/ethtool-util.c | 1 + - src/udev/net/ethtool-util.h | 1 + - src/udev/udev-builtin-net_setup_link.c | 1 + - 6 files changed, 6 insertions(+) - -diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c -index c93fe9cb4..2013d06e1 100644 ---- a/src/libsystemd/sd-netlink/netlink-types.c -+++ b/src/libsystemd/sd-netlink/netlink-types.c -@@ -3,6 +3,7 @@ - #include <netinet/in.h> - #include <stdint.h> - #include <sys/socket.h> -+#include <netinet/if_ether.h> - #include <linux/netlink.h> - #include <linux/rtnetlink.h> - #include <linux/genetlink.h> -diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c -index 21fb7ab06..0afe5170c 100644 ---- a/src/network/netdev/tuntap.c -+++ b/src/network/netdev/tuntap.c -@@ -2,6 +2,7 @@ - - #include <errno.h> - #include <fcntl.h> -+#include <netinet/if_ether.h> - #include <linux/if_tun.h> - #include <net/if.h> - #include <netinet/if_ether.h> -diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c -index 8e8a618e2..52d523a67 100644 ---- a/src/network/networkd-brvlan.c -+++ b/src/network/networkd-brvlan.c -@@ -4,6 +4,7 @@ - ***/ - - #include <netinet/in.h> -+#include <netinet/if_ether.h> - #include <linux/if_bridge.h> - #include <stdbool.h> - -diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c -index 4bb4216ac..5f7383483 100644 ---- a/src/udev/net/ethtool-util.c -+++ b/src/udev/net/ethtool-util.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <sys/ioctl.h> - #include <linux/ethtool.h> -diff --git a/src/udev/net/ethtool-util.h b/src/udev/net/ethtool-util.h -index 064bf4d2b..ee0d4fb2a 100644 ---- a/src/udev/net/ethtool-util.h -+++ b/src/udev/net/ethtool-util.h -@@ -3,6 +3,7 @@ - - - #include <macro.h> -+#include <netinet/if_ether.h> - #include <linux/ethtool.h> - - #include "missing.h" -diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c -index 8bed6399a..a3a96959b 100644 ---- a/src/udev/udev-builtin-net_setup_link.c -+++ b/src/udev/udev-builtin-net_setup_link.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include "alloc-util.h" - #include "link-config.h" - #include "log.h" --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch index bee5fb6511..846c01bd4f 100644 --- a/meta/recipes-core/systemd/systemd/0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch +++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -1,8 +1,7 @@ -From 848e711d719a6d987bc7d14183e1c7b1f1c91c56 Mon Sep 17 00:00:00 2001 +From fb068403b25002156435350165ea418a6338a313 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 29 Jun 2018 17:10:29 +0800 -Subject: [PATCH 08/19] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not - defined +Date: Mon, 25 Feb 2019 14:56:21 +0800 +Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined If the standard library doesn't provide brace expansion users just won't get it. @@ -15,29 +14,31 @@ Upstream-Status: Inappropriate [musl specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + --- - src/basic/glob-util.c | 13 +++++++++++-- - src/test/test-glob-util.c | 15 +++++++++++++++ + src/basic/glob-util.c | 12 ++++++++++++ + src/test/test-glob-util.c | 16 ++++++++++++++++ src/tmpfiles/tmpfiles.c | 10 ++++++++++ - 3 files changed, 36 insertions(+), 2 deletions(-) + 3 files changed, 38 insertions(+) -diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c -index 9fac676f2..8adb9559e 100644 --- a/src/basic/glob-util.c +++ b/src/basic/glob-util.c -@@ -10,6 +10,11 @@ - #include "macro.h" +@@ -12,6 +12,12 @@ #include "path-util.h" #include "strv.h" + +/* Don't fail if the standard library + * doesn't provide brace expansion */ +#ifndef GLOB_BRACE +#define GLOB_BRACE 0 +#endif - ++ static void closedir_wrapper(void* v) { (void) closedir(v); -@@ -18,6 +23,7 @@ static void closedir_wrapper(void* v) { + } +@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) { int safe_glob(const char *path, int flags, glob_t *pglob) { int k; @@ -45,39 +46,37 @@ index 9fac676f2..8adb9559e 100644 /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ assert(!(flags & GLOB_ALTDIRFUNC)); -@@ -31,10 +37,13 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { +@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag pglob->gl_lstat = lstat; if (!pglob->gl_stat) pglob->gl_stat = stat; -- +#endif + errno = 0; +#ifdef GLOB_ALTDIRFUNC k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob); -- +#else + k = glob(path, flags, NULL, pglob); +#endif if (k == GLOB_NOMATCH) return -ENOENT; if (k == GLOB_NOSPACE) -diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c -index d78d6223c..f5943b26d 100644 --- a/src/test/test-glob-util.c +++ b/src/test/test-glob-util.c -@@ -12,6 +12,11 @@ - #include "glob-util.h" - #include "macro.h" - #include "rm-rf.h" +@@ -13,6 +13,12 @@ + #include "tests.h" + #include "tmpfile-util.h" + +/* Don't fail if the standard library + * doesn't provide brace expansion */ +#ifndef GLOB_BRACE +#define GLOB_BRACE 0 +#endif - - static void test_glob_exists(void) { ++ + TEST(glob_exists) { char name[] = "/tmp/test-glob_exists.XXXXXX"; -@@ -40,11 +45,13 @@ static void test_glob_no_dot(void) { + int fd = -1; +@@ -40,11 +46,13 @@ TEST(glob_no_dot) { const char *fn; _cleanup_globfree_ glob_t g = { @@ -91,7 +90,7 @@ index d78d6223c..f5943b26d 100644 }; int r; -@@ -52,11 +59,19 @@ static void test_glob_no_dot(void) { +@@ -52,11 +60,19 @@ TEST(glob_no_dot) { assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -111,13 +110,11 @@ index d78d6223c..f5943b26d 100644 assert_se(r == GLOB_NOMATCH); (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); -diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c -index 927de35f3..5f0283da5 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c -@@ -60,6 +60,12 @@ +@@ -67,6 +67,12 @@ + #include "umask-util.h" #include "user-util.h" - #include "util.h" +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -128,7 +125,7 @@ index 927de35f3..5f0283da5 100644 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates * them in the file system. This is intended to be used to create * properly owned directories beneath /tmp, /var/tmp, /run, which are -@@ -1345,7 +1351,9 @@ finish: +@@ -1961,7 +1967,9 @@ finish: static int glob_item(Item *i, action_t action) { _cleanup_globfree_ glob_t g = { @@ -138,7 +135,7 @@ index 927de35f3..5f0283da5 100644 }; int r = 0, k; char **fn; -@@ -1365,7 +1373,9 @@ static int glob_item(Item *i, action_t action) { +@@ -1981,7 +1989,9 @@ static int glob_item(Item *i, action_t a static int glob_item_recursively(Item *i, fdaction_t action) { _cleanup_globfree_ glob_t g = { @@ -148,6 +145,3 @@ index 927de35f3..5f0283da5 100644 }; int r = 0, k; char **fn; --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0007-rules-watch-metadata-changes-in-ide-devices.patch b/meta/recipes-core/systemd/systemd/0007-rules-watch-metadata-changes-in-ide-devices.patch deleted file mode 100644 index a5f65e66bd..0000000000 --- a/meta/recipes-core/systemd/systemd/0007-rules-watch-metadata-changes-in-ide-devices.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 9302b72e5e69512aaa7106197b00c55baeb35b3c Mon Sep 17 00:00:00 2001 -From: Hongxu Jia <hongxu.jia@windriver.com> -Date: Fri, 17 Nov 2017 09:46:00 +0800 -Subject: [PATCH 7/9] rules: watch metadata changes in ide devices - -Formatting IDE storage does not trigger "change" uevents. As a result -clients using udev API don't get any updates afterwards and get outdated -information about the device. -... -root@qemux86-64:~# mkfs.ext4 -F /dev/hda1 -Creating filesystem with 262144 4k blocks and 65536 inodes -Filesystem UUID: 98791eb2-2bf3-47ad-b4d8-4cf7e914eee2 - -root@qemux86-64:~# ls /dev/disk/by-uuid/98791eb2-2bf3-47ad-b4d8-4cf7e914eee2 -ls: cannot access '/dev/disk/by-uuid/98791eb2-2bf3-47ad-b4d8-4cf7e914eee2': No such file or directory -... -Include hd* in a match for watch option assignment. - -Upstream-Status: Denied - -qemu by default emulates IDE and the linux-yocto kernel(s) use -CONFIG_IDE instead of the more modern libsata, so disks appear as -/dev/hd*. A similar patch rejected by upstream because CONFIG_IDE -is deprecated. - -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> ---- - rules/60-block.rules | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/rules/60-block.rules b/rules/60-block.rules -index 343fc06f8..b5237dac4 100644 ---- a/rules/60-block.rules -+++ b/rules/60-block.rules -@@ -8,4 +8,4 @@ ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_ - ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" - - # watch metadata changes, caused by tools closing the device node which was opened for writing --ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*|nvme*|sd*|vd*|xvd*|pmem*|mmcblk*", OPTIONS+="watch" -+ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*|nvme*|sd*|vd*|xvd*|pmem*|mmcblk*|hd*", OPTIONS+="watch" --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch b/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch deleted file mode 100644 index abecdc764b..0000000000 --- a/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b6ba596fd1313a162cdc2eb88161dcf24d19ede7 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Thu, 28 Jun 2018 10:10:02 +0800 -Subject: [PATCH 8/9] Do not enable nss tests if nss-systemd is not enabled - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/test/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/test/meson.build b/src/test/meson.build -index 7da7e3a22..7b7c257ff 100644 ---- a/src/test/meson.build -+++ b/src/test/meson.build -@@ -645,7 +645,7 @@ tests += [ - [['src/test/test-nss.c'], - [], - [libdl], -- '', 'manual'], -+ 'ENABLE_NSS_SYSTEMD', 'manual'], - - [['src/test/test-umount.c', - 'src/core/mount-setup.c', --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch new file mode 100644 index 0000000000..57e18a5808 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch @@ -0,0 +1,64 @@ +From 7ca9887f84adba065dc2e59b3de55ace2fc72ec0 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:00:06 +0800 +Subject: [PATCH] add missing FTW_ macros for musl + +This is to avoid build failures like below for musl. + + locale-util.c:296:24: error: 'FTW_STOP' undeclared + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + +--- + src/basic/missing_type.h | 20 ++++++++++++++++++++ + src/shared/mount-setup.c | 1 + + 2 files changed, 21 insertions(+) + +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const voi + #define __COMPAR_FN_T + typedef int (*__compar_fn_t)(const void *, const void *); + #endif ++ ++#ifndef FTW_ACTIONRETVAL ++#define FTW_ACTIONRETVAL 16 ++#endif ++ ++#ifndef FTW_CONTINUE ++#define FTW_CONTINUE 0 ++#endif ++ ++#ifndef FTW_STOP ++#define FTW_STOP 1 ++#endif ++ ++#ifndef FTW_SKIP_SUBTREE ++#define FTW_SKIP_SUBTREE 2 ++#endif ++ ++#ifndef FTW_SKIP_SIBLINGS ++#define FTW_SKIP_SIBLINGS 3 ++#endif +--- a/src/shared/mount-setup.c ++++ b/src/shared/mount-setup.c +@@ -32,6 +32,7 @@ + #include "strv.h" + #include "user-util.h" + #include "virt.h" ++#include "missing_type.h" + + typedef enum MountMode { + MNT_NONE = 0, +--- a/src/test/test-recurse-dir.c ++++ b/src/test/test-recurse-dir.c +@@ -6,6 +6,7 @@ + #include "recurse-dir.h" + #include "strv.h" + #include "tests.h" ++#include "missing_type.h" + + static char **list_nftw = NULL; + diff --git a/meta/recipes-core/systemd/systemd/0009-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0009-add-missing-FTW_-macros-for-musl.patch deleted file mode 100644 index 95287cce10..0000000000 --- a/meta/recipes-core/systemd/systemd/0009-add-missing-FTW_-macros-for-musl.patch +++ /dev/null @@ -1,50 +0,0 @@ -From acc2c08082795802011e3c5f8626d63210021489 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 28 Feb 2018 21:36:32 -0800 -Subject: [PATCH 09/19] add missing FTW_ macros for musl - -This is to avoid build failures like below for musl. - - locale-util.c:296:24: error: 'FTW_STOP' undeclared - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/missing.h | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index 02397f1b6..6dc750eba 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -189,6 +189,26 @@ struct sockaddr_vm { - #define BTRFS_QGROUP_LEVEL_SHIFT 48 - #endif - -+#ifndef FTW_ACTIONRETVAL -+#define FTW_ACTIONRETVAL 16 -+#endif -+ -+#ifndef FTW_CONTINUE -+#define FTW_CONTINUE 0 -+#endif -+ -+#ifndef FTW_STOP -+#define FTW_STOP 1 -+#endif -+ -+#ifndef FTW_SKIP_SUBTREE -+#define FTW_SKIP_SUBTREE 2 -+#endif -+ -+#ifndef FTW_SKIP_SIBLINGS -+#define FTW_SKIP_SIBLINGS 3 -+#endif -+ - #if ! HAVE_LINUX_BTRFS_H - #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \ - struct btrfs_ioctl_qgroup_assign_args) --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch index d41bc4a0da..0fc320420e 100644 --- a/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch +++ b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch @@ -1,20 +1,21 @@ -From 1fadf805cb391e3bcbd9a0286a9e4b7adb9e7427 Mon Sep 17 00:00:00 2001 +From c7453b716ae308b89cf4b2b231a36ddd38a49752 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 2 Jul 2018 13:34:09 +0800 -Subject: [PATCH 12/19] fix missing of __register_atfork for non-glibc builds +Date: Mon, 25 Feb 2019 15:03:47 +0800 +Subject: [PATCH] fix missing of __register_atfork for non-glibc builds Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + --- src/basic/process-util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/basic/process-util.c b/src/basic/process-util.c -index 0a4f917cb..3543bc045 100644 +index 461bbfe9a5..2d06f9f60a 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -22,6 +22,9 @@ +@@ -18,6 +18,9 @@ #if HAVE_VALGRIND_VALGRIND_H #include <valgrind/valgrind.h> #endif @@ -24,7 +25,7 @@ index 0a4f917cb..3543bc045 100644 #include "alloc-util.h" #include "architecture.h" -@@ -1150,11 +1153,15 @@ void reset_cached_pid(void) { +@@ -1202,11 +1205,15 @@ void reset_cached_pid(void) { cached_pid = CACHED_PID_UNSET; } @@ -32,14 +33,11 @@ index 0a4f917cb..3543bc045 100644 /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against * libpthread, as it is part of glibc anyway. */ - extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle); - extern void* __dso_handle __attribute__ ((__weak__)); + extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle); + extern void* __dso_handle _weak_; +#else +#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child) +#endif pid_t getpid_cached(void) { static bool installed = false; --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch b/meta/recipes-core/systemd/systemd/0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch deleted file mode 100644 index a635fa91d8..0000000000 --- a/meta/recipes-core/systemd/systemd/0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f9625b5f3fd5dac3f3591dbeeb24dc9d6fda790d Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 27 Feb 2018 12:56:21 +0800 -Subject: [PATCH 9/9] nss-mymachines: Build conditionally when - ENABLE_MYHOSTNAME is set - -Fixes build failures when building with --disable-myhostname - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/meson.build b/meson.build -index 3bb087fef..73bd70b0b 100644 ---- a/meson.build -+++ b/meson.build -@@ -1371,12 +1371,15 @@ test_dlopen = executable( - link_with : [libbasic], - dependencies : [libdl]) - --foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'], -- ['systemd', 'ENABLE_NSS_SYSTEMD'], -- ['mymachines', 'ENABLE_MACHINED'], -- ['resolve', 'ENABLE_RESOLVE']] -+foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME', ''], -+ ['systemd', 'ENABLE_NSS_SYSTEMD', ''], -+ ['mymachines', 'ENABLE_MACHINED', 'ENABLE_MYHOSTNAME'], -+ ['resolve', 'ENABLE_RESOLVE', '']] - - condition = tuple[1] == '' or conf.get(tuple[1]) == 1 -+ if tuple[2] != '' and condition -+ condition = conf.get(tuple[2]) == 1 -+ endif - if condition - module = tuple[0] - --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch new file mode 100644 index 0000000000..029f413aa8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch @@ -0,0 +1,98 @@ +From 856010e268a6aca8e5f02502457afe289bd877f1 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:12:41 +0800 +Subject: [PATCH] Use uintmax_t for handling rlim_t + +PRIu{32,64} is not right format to represent rlim_t type +therefore use %ju and typecast the rlim_t variables to +uintmax_t. + +Fixes portablility errors like + +execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] +| fprintf(f, "%s%s: " RLIM_FMT "\n", +| ^~~~~~~~ +| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); +| ~~~~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + +--- + src/basic/format-util.h | 8 +------- + src/basic/rlimit-util.c | 12 ++++++------ + src/core/execute.c | 4 ++-- + 3 files changed, 9 insertions(+), 15 deletions(-) + +--- a/src/basic/format-util.h ++++ b/src/basic/format-util.h +@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32 + # error Unknown timex member size + #endif + +-#if SIZEOF_RLIM_T == 8 +-# define RLIM_FMT "%" PRIu64 +-#elif SIZEOF_RLIM_T == 4 +-# define RLIM_FMT "%" PRIu32 +-#else +-# error Unknown rlim_t size +-#endif ++#define RLIM_FMT "%ju" + + #if SIZEOF_DEV_T == 8 + # define DEV_FMT "%" PRIu64 +--- a/src/basic/rlimit-util.c ++++ b/src/basic/rlimit-util.c +@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons + fixed.rlim_max == highest.rlim_max) + return 0; + +- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max); ++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max); + + return RET_NERRNO(setrlimit(resource, &fixed)); + } +@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r + if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) + r = free_and_strdup(&s, "infinity"); + else if (rl->rlim_cur >= RLIM_INFINITY) +- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); + else if (rl->rlim_max >= RLIM_INFINITY) +- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); + else if (rl->rlim_cur == rl->rlim_max) +- r = asprintf(&s, RLIM_FMT, rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); + else +- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + if (r < 0) + return -ENOMEM; + +@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) { + + rl.rlim_cur = FD_SETSIZE; + if (setrlimit(RLIMIT_NOFILE, &rl) < 0) +- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); ++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); + + return 1; + } +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -5639,9 +5639,9 @@ void exec_context_dump(const ExecContext + for (unsigned i = 0; i < RLIM_NLIMITS; i++) + if (c->rlimit[i]) { + fprintf(f, "%sLimit%s: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); + fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); + } + + if (c->ioprio_set) { diff --git a/meta/recipes-core/systemd/systemd/0010-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch b/meta/recipes-core/systemd/systemd/0010-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch deleted file mode 100644 index 16547981d2..0000000000 --- a/meta/recipes-core/systemd/systemd/0010-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a0bd587300744dbb8e9cfbb043233670ce781c98 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 2 Jul 2018 13:22:41 +0800 -Subject: [PATCH 10/19] socket-util: don't fail if libc doesn't support IDN - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/socket-util.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c -index a913102e1..0d0154805 100644 ---- a/src/basic/socket-util.c -+++ b/src/basic/socket-util.c -@@ -32,6 +32,16 @@ - #include "utf8.h" - #include "util.h" - -+/* Don't fail if the standard library -+ * doesn't support IDN */ -+#ifndef NI_IDN -+#define NI_IDN 0 -+#endif -+ -+#ifndef NI_IDN_USE_STD3_ASCII_RULES -+#define NI_IDN_USE_STD3_ASCII_RULES 0 -+#endif -+ - #if ENABLE_IDN - # define IDN_FLAGS NI_IDN - #else --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch b/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch deleted file mode 100644 index 1a22ffd9e9..0000000000 --- a/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 045f205fd21e5e380edf813de04fcfbf5a487219 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 2 Jul 2018 13:28:25 +0800 -Subject: [PATCH 11/19] src/basic/missing.h: check for missing __compar_fn_t - typedef - -include missing.h for missing __compar_fn_t - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/missing.h | 5 +++++ - src/basic/strbuf.c | 1 + - 2 files changed, 6 insertions(+) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index 6dc750eba..cd1cc109f 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -1179,6 +1179,11 @@ struct input_mask { - #define RENAME_NOREPLACE (1 << 0) - #endif - -+#ifndef __COMPAR_FN_T -+#define __COMPAR_FN_T -+typedef int (*__compar_fn_t)(const void *, const void *); -+#endif -+ - #ifndef KCMP_FILE - #define KCMP_FILE 0 - #endif -diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c -index e2ed776a0..4d3ebec4c 100644 ---- a/src/basic/strbuf.c -+++ b/src/basic/strbuf.c -@@ -7,6 +7,7 @@ - #include "alloc-util.h" - #include "strbuf.h" - #include "util.h" -+#include "missing.h" - - /* - * Strbuf stores given strings in a single continuous allocated memory --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0016-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch index c06a3706e9..327084bae9 100644 --- a/meta/recipes-core/systemd/systemd/0016-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch +++ b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch @@ -1,22 +1,20 @@ -From c4bbf3efefffe0a4efadbf4e3f0adb54d76fe0e7 Mon Sep 17 00:00:00 2001 +From ad395dda5db9b1ae156be121cfc8a38960de6c55 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Wed, 28 Feb 2018 21:25:22 -0800 -Subject: [PATCH 16/19] test-sizeof.c: Disable tests for missing typedefs in - musl +Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl Upstream-Status: Inappropriate [musl specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + --- src/test/test-sizeof.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c -index 7a1e496ed..386b314d5 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c -@@ -40,8 +40,10 @@ int main(void) { +@@ -55,8 +55,10 @@ int main(void) { info(unsigned); info(long unsigned); info(long long unsigned); @@ -24,10 +22,10 @@ index 7a1e496ed..386b314d5 100644 info(__syscall_ulong_t); info(__syscall_slong_t); +#endif + info(intmax_t); + info(uintmax_t); - info(float); - info(double); -@@ -59,7 +61,9 @@ int main(void) { +@@ -76,7 +78,9 @@ int main(void) { info(ssize_t); info(time_t); info(usec_t); @@ -37,6 +35,3 @@ index 7a1e496ed..386b314d5 100644 info(pid_t); info(uid_t); info(gid_t); --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0017-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch index 8e47c6f50a..0026a7b72a 100644 --- a/meta/recipes-core/systemd/systemd/0017-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -1,7 +1,7 @@ -From 91bb4f5c9c11464468e8d3fa4746d98d59997264 Mon Sep 17 00:00:00 2001 +From 5d4c6b2f4b88b69b31f967371d2a6136c65dc3fd Mon Sep 17 00:00:00 2001 From: Andre McCurdy <armccurdy@gmail.com> Date: Tue, 10 Oct 2017 14:33:30 -0700 -Subject: [PATCH 17/19] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() +Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to do and it's not portable (not supported by musl). See: @@ -25,20 +25,18 @@ just historical and not actually necessary or desired behaviour? Upstream-Status: Inappropriate [musl specific] Signed-off-by: Andre McCurdy <armccurdy@gmail.com> + --- - src/basic/fs-util.h | 22 +++++++++++++++++++++- + src/basic/fs-util.h | 23 +++++++++++++++++++++-- src/shared/base-filesystem.c | 6 +++--- - 2 files changed, 24 insertions(+), 4 deletions(-) + 2 files changed, 24 insertions(+), 5 deletions(-) -diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h -index 28566773c..14b864cc5 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h -@@ -32,7 +32,27 @@ int fchmod_opath(int fd, mode_t m); - +@@ -46,8 +46,27 @@ int futimens_opath(int fd, const struct int fd_warn_permissions(const char *path, int fd); + int stat_warn_permissions(const char *path, const struct stat *st); --#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) +/* + Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to + do and it's not portable (not supported by musl). See: @@ -58,25 +56,24 @@ index 28566773c..14b864cc5 100644 + or why it needs to return success for broken symlinks. Maybe just historical + and not actually necessary or desired behaviour? +*/ -+ -+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) + #define laccess(path, mode) \ +- RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)) ++ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0)) int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); int touch(const char *path); -diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c -index 89d7a7d59..34b4ad53a 100644 --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c -@@ -53,7 +53,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -117,7 +117,7 @@ int base_filesystem_create(const char *r return log_error_errno(errno, "Failed to open root file system: %m"); - for (i = 0; i < ELEMENTSOF(table); i ++) { + for (size_t i = 0; i < ELEMENTSOF(table); i++) { - if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) + if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) continue; if (table[i].target) { -@@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -125,7 +125,7 @@ int base_filesystem_create(const char *r /* check if one of the targets exists */ NULSTR_FOREACH(s, table[i].target) { @@ -85,7 +82,7 @@ index 89d7a7d59..34b4ad53a 100644 continue; /* check if a specific file exists at the target path */ -@@ -72,7 +72,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -136,7 +136,7 @@ int base_filesystem_create(const char *r if (!p) return log_oom(); @@ -94,6 +91,3 @@ index 89d7a7d59..34b4ad53a 100644 continue; } --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0018-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch index 1bd0d602a5..612a535d3c 100644 --- a/meta/recipes-core/systemd/systemd/0018-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -1,8 +1,7 @@ -From 97fed07132533a1b2bce9c60e305a5d09aee2e9b Mon Sep 17 00:00:00 2001 +From 1803ea271b93370fdcf7ec497277344f1e775429 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sun, 27 May 2018 08:36:44 -0700 -Subject: [PATCH 18/19] Define glibc compatible basename() for non-glibc - systems +Subject: [PATCH] Define glibc compatible basename() for non-glibc systems Fixes builds with musl, even though systemd is adamant about using non-posix basename implementation, we have a way out @@ -10,25 +9,22 @@ using non-posix basename implementation, we have a way out Upstream-Status: Inappropriate [musl specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- - src/machine/machine-dbus.c | 4 ++++ - 1 file changed, 4 insertions(+) + src/machine/machine-dbus.c | 5 +++++ + 1 file changed, 5 insertions(+) -diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c -index 7f41465cc..cee8a5d43 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c -@@ -11,6 +11,10 @@ +@@ -10,6 +10,11 @@ #include <libgen.h> #undef basename +#if !defined(__GLIBC__) ++#include <string.h> +#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) +#endif + #include "alloc-util.h" #include "bus-common-errors.h" - #include "bus-internal.h" --- -2.11.0 - + #include "bus-get-properties.h" diff --git a/meta/recipes-core/systemd/systemd/0013-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0013-Use-uintmax_t-for-handling-rlim_t.patch deleted file mode 100644 index 69b3c15121..0000000000 --- a/meta/recipes-core/systemd/systemd/0013-Use-uintmax_t-for-handling-rlim_t.patch +++ /dev/null @@ -1,90 +0,0 @@ -From a0ac0cfd90af6431c64d1b276f422a2092d569b3 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 2 Jul 2018 13:44:21 +0800 -Subject: [PATCH 13/19] Use uintmax_t for handling rlim_t - -PRIu{32,64} is not right format to represent rlim_t type -therefore use %ju and typecast the rlim_t variables to -uintmax_t. - -Fixes portablility errors like - -execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] -| fprintf(f, "%s%s: " RLIM_FMT "\n", -| ^~~~~~~~ -| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); -| ~~~~~~~~~~~~~~~~~~~~~~ - -Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/format-util.h | 8 -------- - src/basic/rlimit-util.c | 8 ++++---- - src/core/execute.c | 8 ++++---- - 3 files changed, 8 insertions(+), 16 deletions(-) - -diff --git a/src/basic/format-util.h b/src/basic/format-util.h -index 160550cd6..61245d1e3 100644 ---- a/src/basic/format-util.h -+++ b/src/basic/format-util.h -@@ -43,14 +43,6 @@ - # define PRI_TIMEX "li" - #endif - --#if SIZEOF_RLIM_T == 8 --# define RLIM_FMT "%" PRIu64 --#elif SIZEOF_RLIM_T == 4 --# define RLIM_FMT "%" PRIu32 --#else --# error Unknown rlim_t size --#endif -- - #if SIZEOF_DEV_T == 8 - # define DEV_FMT "%" PRIu64 - #elif SIZEOF_DEV_T == 4 -diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c -index be1ba615e..e328ce499 100644 ---- a/src/basic/rlimit-util.c -+++ b/src/basic/rlimit-util.c -@@ -299,13 +299,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { - if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) - s = strdup("infinity"); - else if (rl->rlim_cur >= RLIM_INFINITY) -- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); -+ (void) asprintf(&s, "infinity:%ju", (uintmax_t)rl->rlim_max); - else if (rl->rlim_max >= RLIM_INFINITY) -- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); -+ (void) asprintf(&s, "%ju:infinity", (uintmax_t)rl->rlim_cur); - else if (rl->rlim_cur == rl->rlim_max) -- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); -+ (void) asprintf(&s, "%ju", (uintmax_t)rl->rlim_cur); - else -- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); -+ (void) asprintf(&s, "%ju:%ju", (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); - - if (!s) - return -ENOMEM; -diff --git a/src/core/execute.c b/src/core/execute.c -index 8ac69d1a0..efedf3842 100644 ---- a/src/core/execute.c -+++ b/src/core/execute.c -@@ -3976,10 +3976,10 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { - - for (i = 0; i < RLIM_NLIMITS; i++) - if (c->rlimit[i]) { -- fprintf(f, "Limit%s%s: " RLIM_FMT "\n", -- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); -- fprintf(f, "Limit%s%sSoft: " RLIM_FMT "\n", -- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); -+ fprintf(f, "Limit%s%s: %ju\n", -+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); -+ fprintf(f, "Limit%s%sSoft: %ju\n", -+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); - } - - if (c->ioprio_set) { --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index 942f4c0918..baf4903803 100644 --- a/meta/recipes-core/systemd/systemd/0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -1,7 +1,7 @@ -From 8440348bcac34249cdf6ac2dcae9ac66d3c727db Mon Sep 17 00:00:00 2001 +From 30b08f76ea7f5c324afedf97f0867b76dac9f128 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Wed, 4 Jul 2018 15:00:44 +0800 -Subject: [PATCH 19/19] Do not disable buffering when writing to oom_score_adj +Subject: [PATCH] Do not disable buffering when writing to oom_score_adj On musl, disabling buffering when writing to oom_score_adj will cause the following error. @@ -17,23 +17,21 @@ This is libc implementation specific, as glibc does not have this issue. Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + --- src/basic/process-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/basic/process-util.c b/src/basic/process-util.c -index 3543bc045..d0572e034 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -1473,7 +1473,7 @@ int set_oom_score_adjust(int value) { - sprintf(t, "%i", value); +@@ -1489,7 +1489,7 @@ int set_oom_score_adjust(int value) { + xsprintf(t, "%i", value); return write_string_file("/proc/self/oom_score_adj", t, - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); + WRITE_STRING_FILE_VERIFY_ON_FAILURE); } - static const char *const ioprio_class_table[] = { --- -2.11.0 - + int get_oom_score_adjust(int *ret) { diff --git a/meta/recipes-core/systemd/systemd/0014-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch b/meta/recipes-core/systemd/systemd/0014-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch deleted file mode 100644 index 258a631cad..0000000000 --- a/meta/recipes-core/systemd/systemd/0014-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch +++ /dev/null @@ -1,30 +0,0 @@ -From cb59b3af54fb3bbd4d8264fef919810af8d08d16 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 27 Feb 2018 14:01:30 +0800 -Subject: [PATCH 14/19] fix missing ULONG_LONG_MAX definition in case of musl - -Upstream-Status: Inappropriate [musl] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/missing.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index cd1cc109f..144058a1a 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -54,6 +54,10 @@ struct sockaddr_vm { - }; - #endif /* !HAVE_LINUX_VM_SOCKETS_H */ - -+#ifndef ULONG_LONG_MAX -+#define ULONG_LONG_MAX ULLONG_MAX -+#endif -+ - #ifndef RLIMIT_RTTIME - #define RLIMIT_RTTIME 15 - #endif --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index 5c78cabbaf..878914b307 100644 --- a/meta/recipes-core/systemd/systemd/0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -1,7 +1,7 @@ -From dd53dc9b9542cbd2c39a39096941dfed70d06506 Mon Sep 17 00:00:00 2001 +From 873202f63f9f117c6e5a98e444cc709057042979 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Tue, 10 Jul 2018 15:40:17 +0800 -Subject: [PATCH 20/20] distinguish XSI-compliant strerror_r from GNU-specifi +Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi strerror_r XSI-compliant strerror_r and GNU-specifi strerror_r are different. @@ -18,33 +18,15 @@ assigned to (char *) variable, resulting in segment fault. Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + --- - src/journal/journal-send.c | 5 +++++ - src/libsystemd/sd-bus/bus-error.c | 5 +++++ + src/libsystemd/sd-bus/bus-error.c | 5 +++++ + src/libsystemd/sd-journal/journal-send.c | 5 +++++ 2 files changed, 10 insertions(+) -diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c -index 65bcbcd2e..aef80dd8f 100644 ---- a/src/journal/journal-send.c -+++ b/src/journal/journal-send.c -@@ -337,7 +337,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove - char* j; - - errno = 0; -+#ifndef __GLIBC__ -+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); -+ j = buffer + 8 + k; -+#else - j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); -+#endif - if (errno == 0) { - char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; - -diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c -index ec359ac13..d2aa86cea 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c -@@ -362,7 +362,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { +@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er return; errno = 0; @@ -57,6 +39,18 @@ index ec359ac13..d2aa86cea 100644 if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; --- -2.11.0 - +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c +@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(co + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + diff --git a/meta/recipes-core/systemd/systemd/0015-test-hexdecoct.c-Include-missing.h-for-strndupa.patch b/meta/recipes-core/systemd/systemd/0015-test-hexdecoct.c-Include-missing.h-for-strndupa.patch deleted file mode 100644 index c7ca9cd4bd..0000000000 --- a/meta/recipes-core/systemd/systemd/0015-test-hexdecoct.c-Include-missing.h-for-strndupa.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b11109ecc41110c518a98b6ac39611ff86477021 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 23 Oct 2017 12:33:22 -0700 -Subject: [PATCH 15/19] test-hexdecoct.c: Include missing.h for strndupa - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/test/test-hexdecoct.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c -index da9f3008b..7ff2dfe0c 100644 ---- a/src/test/test-hexdecoct.c -+++ b/src/test/test-hexdecoct.c -@@ -6,6 +6,7 @@ - #include "hexdecoct.h" - #include "macro.h" - #include "string-util.h" -+#include "missing.h" - - static void test_hexchar(void) { - assert_se(hexchar(0xa) == 'a'); --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch index 668f273208..e6507c5f89 100644 --- a/meta/recipes-core/systemd/systemd/0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch +++ b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch @@ -1,34 +1,33 @@ -From 687a5af8dc5d38f918a6ce08fed5297234bf8346 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 2 Mar 2018 18:00:17 -0800 +From e7441559266074e7a33e3c11ff5cdaf5ba9c0e24 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:18:00 +0800 Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP for currently unknown reasons they get exported to the shared libries even without being listed in the sym file -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- +Upstream-Status: Pending -Upstream-Status: Pending [ Conditional on master needing this, 239 does need it ] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- src/libsystemd/sd-bus/bus-error.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c -index 378f7a377..49d797abd 100644 +index c49be29e46..90731bd7e7 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c -@@ -71,8 +71,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { +@@ -55,8 +55,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { }; /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */ --extern const sd_bus_error_map __start_BUS_ERROR_MAP[]; --extern const sd_bus_error_map __stop_BUS_ERROR_MAP[]; -+extern const sd_bus_error_map __start_BUS_ERROR_MAP[] _hidden_; -+extern const sd_bus_error_map __stop_BUS_ERROR_MAP[] _hidden_; +-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[]; +-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[]; ++extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_; ++extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_; /* Additional maps registered with sd_bus_error_add_map() are in this * NULL terminated array */ --- -2.16.2 - diff --git a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch new file mode 100644 index 0000000000..eeff693bc4 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch @@ -0,0 +1,28 @@ +From 64f4d2eb976b9f23ce85b3655a876f7299eafd58 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:27:54 +0800 +Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition + +Fix the following compile failure: +src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'? + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + +--- + src/basic/missing_type.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index 3df1084ef2..697aa7f58a 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -13,6 +13,7 @@ + + #ifndef __GLIBC__ + typedef int (*comparison_fn_t)(const void *, const void *); ++typedef int (*__compar_d_fn_t) (const void *, const void *, void *); + #endif + + #ifndef __COMPAR_FN_T diff --git a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch new file mode 100644 index 0000000000..5ca5386289 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -0,0 +1,30 @@ +From d95330f328c23c1cd6c51aeca43f081746cf2899 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:44:54 +0800 +Subject: [PATCH] avoid redefinition of prctl_mm_map structure + +Fix the following compile failure: +error: redefinition of 'struct prctl_mm_map' + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + +--- + src/basic/missing_prctl.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h +index ab851306ba..5547cad875 100644 +--- a/src/basic/missing_prctl.h ++++ b/src/basic/missing_prctl.h +@@ -1,7 +1,9 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + #pragma once + ++#ifdef __GLIBC__ + #include <linux/prctl.h> ++#endif + + /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ + #ifndef PR_CAP_AMBIENT diff --git a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch new file mode 100644 index 0000000000..d51ac4265a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch @@ -0,0 +1,24 @@ +From 2284f2f44b1b30f10b9196e0f5c6d0a2e0c1871f Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Fri, 7 Aug 2020 15:19:27 +0000 +Subject: [PATCH] Handle missing LOCK_EX + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> + +--- + src/partition/makefs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/partition/makefs.c b/src/partition/makefs.c +index 7c94fbfedb..42f966722d 100644 +--- a/src/partition/makefs.c ++++ b/src/partition/makefs.c +@@ -6,6 +6,7 @@ + #include <sys/stat.h> + #include <sys/types.h> + #include <unistd.h> ++#include <sys/file.h> + + #include "alloc-util.h" + #include "blockdev-util.h" diff --git a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch new file mode 100644 index 0000000000..1ba5c1292b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch @@ -0,0 +1,36 @@ +From a6a25e1ecae91f48a4f87bf0cc17eaaf0a919ffe Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Fri, 7 Aug 2020 15:20:17 +0000 +Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un * + +| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns': +| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types] +| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { +| | ^~~~~~ +| | | +| | struct sockaddr_un * +| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22, +| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21: +| /home/ubuntu/poky/build/tmp/work/core2-64-poky-linux-musl/systemd/1_246-r0/recipe-sysroot/usr/include/sys/socket.h:384:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *' +| 384 | int connect (int, const struct sockaddr *, socklen_t); +| | ^~~~~~~~~~~~~~~~~~~~~~~ +| cc1: some warnings being treated as errors + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> + +--- + src/nspawn/nspawn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -5389,7 +5389,7 @@ static int cant_be_in_netns(void) { + if (fd < 0) + return log_error_errno(errno, "Failed to allocate udev control socket: %m"); + +- if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) { ++ if (connect(fd, (struct sockaddr *)&sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) { + + if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno)) + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), diff --git a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch new file mode 100644 index 0000000000..dfab8fbbdf --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch @@ -0,0 +1,29 @@ +From 47472da6e8900773c26da8fd26699367447d97a6 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 16:53:06 +0800 +Subject: [PATCH] test-json.c: define M_PIl + +Fix the following compile failure: +src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'? + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + +--- + src/test/test-json.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/src/test/test-json.c ++++ b/src/test/test-json.c +@@ -14,6 +14,10 @@ + #include "tests.h" + #include "util.h" + ++#ifndef M_PIl ++#define M_PIl 3.141592653589793238462643383279502884L ++#endif ++ + static void test_tokenizer_one(const char *data, ...) { + unsigned line = 0, column = 0; + void *state = NULL; diff --git a/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch b/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch deleted file mode 100644 index 962463f0b8..0000000000 --- a/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001 -From: Filipe Brandenburger <filbranden@google.com> -Date: Sun, 15 Jul 2018 22:43:35 -0700 -Subject: [PATCH] build-sys: Detect whether struct statx is defined in - sys/stat.h -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a -definition for struct statx, in which case include file linux/stat.h should be -avoided, in order to prevent a duplicate definition. - - In file included from ../src/basic/missing.h:18, - from ../src/basic/util.h:28, - from ../src/basic/hashmap.h:10, - from ../src/shared/bus-util.h:12, - from ../src/libsystemd/sd-bus/bus-creds.c:11: - /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’ - struct statx { - ^~~~~ - In file included from /usr/include/sys/stat.h:446, - from ../src/basic/util.h:19, - from ../src/basic/hashmap.h:10, - from ../src/shared/bus-util.h:12, - from ../src/libsystemd/sd-bus/bus-creds.c:11: - /usr/include/bits/statx.h:36:8: note: originally defined here - struct statx - ^~~~~ - -Extend our meson.build to look for struct statx when only sys/stat.h is -included and, in that case, do not include linux/stat.h anymore. - -Tested that systemd builds correctly when using a glibc version that includes a -definition for struct statx. - -glibc Fedora RPM update: -https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae - -glibc upstream commit: -https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd ---- - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> - - meson.build | 5 +++++ - src/basic/missing.h | 5 ++++- - src/basic/xattr-util.c | 1 - - 3 files changed, 9 insertions(+), 2 deletions(-) - -Index: git/meson.build -=================================================================== ---- git.orig/meson.build -+++ git/meson.build -@@ -432,6 +432,7 @@ decl_headers = ''' - #include <sys/stat.h> - ''' - # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail -+# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time - - foreach decl : ['char16_t', - 'char32_t', -@@ -446,6 +447,10 @@ foreach decl : ['char16_t', - conf.set10('HAVE_' + decl.underscorify().to_upper(), have) - endforeach - -+conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : ''' -+#include <sys/stat.h> -+''', args : '-D_GNU_SOURCE') > 0) -+ - foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], - ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], - ['IFLA_VRF_TABLE', 'linux/if_link.h'], -Index: git/src/basic/missing.h -=================================================================== ---- git.orig/src/basic/missing.h -+++ git/src/basic/missing.h -@@ -15,7 +15,6 @@ - #include <linux/neighbour.h> - #include <linux/oom.h> - #include <linux/rtnetlink.h> --#include <linux/stat.h> - #include <net/ethernet.h> - #include <stdlib.h> - #include <sys/resource.h> -@@ -25,6 +24,10 @@ - #include <uchar.h> - #include <unistd.h> - -+#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H -+#include <linux/stat.h> -+#endif -+ - #if HAVE_AUDIT - #include <libaudit.h> - #endif -Index: git/src/basic/xattr-util.c -=================================================================== ---- git.orig/src/basic/xattr-util.c -+++ git/src/basic/xattr-util.c -@@ -2,7 +2,6 @@ - - #include <errno.h> - #include <fcntl.h> --#include <linux/stat.h> - #include <stdint.h> - #include <stdlib.h> - #include <string.h> diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 0000000000..d389e1d9f9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch @@ -0,0 +1,420 @@ +From 0f9422780a569c79a4b28e44c79c70b4a354bd92 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Fri, 1 Mar 2019 15:22:15 +0800 +Subject: [PATCH] do not disable buffer in writing files + +Do not disable buffer in writing files, otherwise we get +failure at boot for musl like below. + + [!!!!!!] Failed to allocate manager object. + +And there will be other failures, critical or not critical. +This is specific to musl. + +Upstream-Status: Inappropriate [musl] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- + src/basic/cgroup-util.c | 10 +++++----- + src/basic/procfs-util.c | 4 ++-- + src/basic/sysctl-util.c | 2 +- + src/basic/util.c | 2 +- + src/binfmt/binfmt.c | 6 +++--- + src/core/main.c | 4 ++-- + src/core/smack-setup.c | 8 ++++---- + src/hibernate-resume/hibernate-resume.c | 2 +- + src/libsystemd/sd-device/sd-device.c | 2 +- + src/nspawn/nspawn-cgroup.c | 2 +- + src/nspawn/nspawn.c | 6 +++--- + src/shared/cgroup-setup.c | 4 ++-- + src/shared/mount-util.c | 4 ++-- + src/shared/smack-util.c | 2 +- + src/sleep/sleep.c | 8 ++++---- + src/vconsole/vconsole-setup.c | 2 +- + 16 files changed, 34 insertions(+), 34 deletions(-) + +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -390,7 +390,7 @@ int cg_kill_kernel_sigkill(const char *c + if (r < 0) + return r; + +- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(killfile, "1", 0); + if (r < 0) + return r; + +@@ -803,7 +803,7 @@ int cg_install_release_agent(const char + + sc = strstrip(contents); + if (isempty(sc)) { +- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, agent, 0); + if (r < 0) + return r; + } else if (!path_equal(sc, agent)) +@@ -821,7 +821,7 @@ int cg_install_release_agent(const char + + sc = strstrip(contents); + if (streq(sc, "0")) { +- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "1", 0); + if (r < 0) + return r; + +@@ -848,7 +848,7 @@ int cg_uninstall_release_agent(const cha + if (r < 0) + return r; + +- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "0", 0); + if (r < 0) + return r; + +@@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const cha + if (r < 0) + return r; + +- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "", 0); + if (r < 0) + return r; + +@@ -1704,7 +1704,7 @@ int cg_set_attribute(const char *control + if (r < 0) + return r; + +- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(p, value, 0); + } + + int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi + * decrease it, as threads-max is the much more relevant sysctl. */ + if (limit > pid_max-1) { + sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ +- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); + if (r < 0) + return r; + } + + sprintf(buffer, "%" PRIu64, limit); +- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); + if (r < 0) { + uint64_t threads_max; + +--- a/src/basic/sysctl-util.c ++++ b/src/basic/sysctl-util.c +@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c + + log_debug("Setting '%s' to '%s'", p, value); + +- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); + } + + int sysctl_writef(const char *property, const char *format, ...) { +--- a/src/basic/util.c ++++ b/src/basic/util.c +@@ -168,7 +168,7 @@ void disable_coredumps(void) { + if (detect_container() > 0) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); + if (r < 0) + log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); + } +--- a/src/binfmt/binfmt.c ++++ b/src/binfmt/binfmt.c +@@ -29,7 +29,7 @@ static bool arg_unregister = false; + + static int delete_rule(const char *rulename) { + const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); +- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(fn, "-1", 0); + } + + static int apply_rule(const char *filename, unsigned line, const char *rule) { +@@ -59,7 +59,7 @@ static int apply_rule(const char *filena + if (r >= 0) + log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); + if (r < 0) + return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", + filename, line, rulename); +@@ -226,7 +226,7 @@ static int run(int argc, char *argv[]) { + } + + /* Flush out all rules */ +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); + else +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1466,7 +1466,7 @@ static int bump_unix_max_dgram_qlen(void + if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) + return 0; + +- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, ++ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, + "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); + if (r < 0) + return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, +@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool + if (getpid_cached() != 1) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); + if (r < 0) + log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", + arg_early_core_pattern); +--- a/src/core/smack-setup.c ++++ b/src/core/smack-setup.c +@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) + } + + #if HAVE_SMACK_RUN_LABEL +- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); +- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); + r = write_string_file("/sys/fs/smackfs/netlabel", +- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); +- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); + #endif +--- a/src/hibernate-resume/hibernate-resume.c ++++ b/src/hibernate-resume/hibernate-resume.c +@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + +- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", major_minor, 0); + if (r < 0) { + log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); + return EXIT_FAILURE; +--- a/src/libsystemd/sd-device/sd-device.c ++++ b/src/libsystemd/sd-device/sd-device.c +@@ -2108,7 +2108,7 @@ _public_ int sd_device_set_sysattr_value + if (!value) + return -ENOMEM; + +- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); ++ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); + if (r < 0) { + /* On failure, clear cache entry, as we do not know how it fails. */ + device_remove_cached_sysattr_value(device, sysattr); +--- a/src/nspawn/nspawn-cgroup.c ++++ b/src/nspawn/nspawn-cgroup.c +@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified + fn = strjoina(tree, cgroup, "/cgroup.procs"); + + sprintf(pid_string, PID_FMT, pid); +- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); ++ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); + if (r < 0) { + log_error_errno(r, "Failed to move process: %m"); + goto finish; +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -2757,7 +2757,7 @@ static int reset_audit_loginuid(void) { + if (streq(p, "4294967295")) + return 0; + +- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/loginuid", "4294967295", 0); + if (r < 0) { + log_error_errno(r, + "Failed to reset audit login UID. This probably means that your kernel is too\n" +@@ -4163,7 +4163,7 @@ static int setup_uid_map( + return log_oom(); + + xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + +@@ -4173,7 +4173,7 @@ static int setup_uid_map( + return log_oom(); + + xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +--- a/src/shared/cgroup-setup.c ++++ b/src/shared/cgroup-setup.c +@@ -345,7 +345,7 @@ int cg_attach(const char *controller, co + + xsprintf(c, PID_FMT "\n", pid); + +- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, c, 0); + if (r < 0) + return r; + +@@ -877,7 +877,7 @@ int cg_enable_everywhere( + return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); + } + +- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_stream(f, s, 0); + if (r < 0) { + log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", + FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); +--- a/src/shared/smack-util.c ++++ b/src/shared/smack-util.c +@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const + return 0; + + p = procfs_file_alloca(pid, "attr/current"); +- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(p, label, 0); + if (r < 0) + return r; + +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -46,7 +46,7 @@ static int write_hibernate_location_info + assert(hibernate_location->swap); + + xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); +- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", resume_str, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", + hibernate_location->swap->device, resume_str); +@@ -73,7 +73,7 @@ static int write_hibernate_location_info + } + + xsprintf(offset_str, "%" PRIu64, hibernate_location->offset); +- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume_offset", offset_str, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m", + hibernate_location->swap->device, offset_str); +@@ -90,7 +90,7 @@ static int write_mode(char **modes) { + STRV_FOREACH(mode, modes) { + int k; + +- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); ++ k = write_string_file("/sys/power/disk", *mode, 0); + if (k >= 0) + return 0; + +@@ -112,7 +112,7 @@ static int write_state(FILE **f, char ** + STRV_FOREACH(state, states) { + int k; + +- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); ++ k = write_string_stream(*f, *state, 0); + if (k >= 0) + return 0; + log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); +--- a/src/vconsole/vconsole-setup.c ++++ b/src/vconsole/vconsole-setup.c +@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na + static int toggle_utf8_sysfs(bool utf8) { + int r; + +- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); + if (r < 0) + return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); + +--- a/src/basic/namespace-util.c ++++ b/src/basic/namespace-util.c +@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, + freeze(); + + xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, uid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + + xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, gid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -4140,7 +4140,7 @@ int unit_cgroup_freezer_action(Unit *u, + else + u->freezer_state = FREEZER_THAWING; + +- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0); + if (r < 0) + return r; + +--- a/src/home/homework.c ++++ b/src/home/homework.c +@@ -284,7 +284,7 @@ static void drop_caches_now(void) { + * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not + * more. */ + +- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0); + if (r < 0) + log_warning_errno(r, "Failed to drop caches, ignoring: %m"); + else +--- a/src/shared/binfmt-util.c ++++ b/src/shared/binfmt-util.c +@@ -26,7 +26,7 @@ int disable_binfmt(void) { + if (r < 0) + return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m"); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); + +--- a/src/shared/coredump-util.c ++++ b/src/shared/coredump-util.c +@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) + sprintf(t, "0x%"PRIx64, value); + + return write_string_file("/proc/self/coredump_filter", t, +- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); ++ WRITE_STRING_FILE_VERIFY_ON_FAILURE); + } +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -2181,7 +2181,6 @@ static int udev_rule_apply_token_to_even + log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value); + r = write_string_file(buf, value, + WRITE_STRING_FILE_VERIFY_ON_FAILURE | +- WRITE_STRING_FILE_DISABLE_BUFFER | + WRITE_STRING_FILE_AVOID_NEWLINE | + WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) diff --git a/meta/recipes-core/systemd/systemd/0023-resolvconf-fixes-for-the-compatibility-interface.patch b/meta/recipes-core/systemd/systemd/0023-resolvconf-fixes-for-the-compatibility-interface.patch deleted file mode 100644 index 2f3e776aa0..0000000000 --- a/meta/recipes-core/systemd/systemd/0023-resolvconf-fixes-for-the-compatibility-interface.patch +++ /dev/null @@ -1,58 +0,0 @@ -systemd-239: fixes for the compatibility interface - -[No upstream tracking] -- https://github.com/systemd/systemd/issues/9423 - -resolvconf-compat: use compat_main() when called as `resolvconf`, -since the interface is closer to that of `systemd-resolve`. - -Use a heap allocated string to set arg_ifname, since a stack allocated -one would be lost after the function returns. (This last one broke the -case where an interface name was suffixed with a dot, such as in -`resolvconf -a tap0.dhcp`.) - -Tested: - $ build/resolvconf -a nonexistent.abc </etc/resolv.conf - Unknown interface 'nonexistent': No such device - -Upstream-Status: Backport [https://github.com/systemd/systemd/commit/5a01b3f35d7b6182c78b6973db8d99bdabd4f9c3] -bug: 9423 -Signed-off-by: Simon Ausserlechner <simon.ausserlechner@siemens.com> - -diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c -index d7e68003e..072345894 100644 ---- a/src/resolve/resolvconf-compat.c -+++ b/src/resolve/resolvconf-compat.c -@@ -53,6 +53,8 @@ static int parse_nameserver(const char *string) { - - if (strv_push(&arg_set_dns, word) < 0) - return log_oom(); -+ -+ word = NULL; - } - - return 0; -@@ -202,7 +204,7 @@ int resolvconf_parse_argv(int argc, char *argv[]) { - - dot = strchr(argv[optind], '.'); - if (dot) { -- iface = strndupa(argv[optind], dot - argv[optind]); -+ iface = strndup(argv[optind], dot - argv[optind]); - log_debug("Ignoring protocol specifier '%s'.", dot + 1); - } else - iface = argv[optind]; -diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c -index e96c13fea..e9e395e3e 100644 ---- a/src/resolve/resolvectl.c -+++ b/src/resolve/resolvectl.c -@@ -3092,7 +3092,7 @@ int main(int argc, char **argv) { - goto finish; - } - -- if (streq(program_invocation_short_name, "systemd-resolve")) -+ if (STR_IN_SET(program_invocation_short_name, "systemd-resolve", "resolvconf")) - r = compat_main(argc, argv, bus); - else - r = native_main(argc, argv, bus); --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0024-journald-do-not-store-the-iovec-entry-for-process-co.patch b/meta/recipes-core/systemd/systemd/0024-journald-do-not-store-the-iovec-entry-for-process-co.patch deleted file mode 100644 index c2f78be39e..0000000000 --- a/meta/recipes-core/systemd/systemd/0024-journald-do-not-store-the-iovec-entry-for-process-co.patch +++ /dev/null @@ -1,208 +0,0 @@ -From 9cb07e7d82c7c4f28bbaa1478e1387e8ea3d03dd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> -Date: Wed, 5 Dec 2018 18:38:39 +0100 -Subject: [PATCH] journald: do not store the iovec entry for process - commandline on stack - -This fixes a crash where we would read the commandline, whose length is under -control of the sending program, and then crash when trying to create a stack -allocation for it. - -CVE-2018-16864 -https://bugzilla.redhat.com/show_bug.cgi?id=1653855 - -The message actually doesn't get written to disk, because -journal_file_append_entry() returns -E2BIG. - -Patch backported from systemd master at -084eeb865ca63887098e0945fb4e93c852b91b0f. - -CVE: CVE-2018-16864 -Upstream-Status: Backport -Signed-off-by: Marcus Cooper <marcusc@axis.com> ---- - src/basic/io-util.c | 10 ++++++++++ - src/basic/io-util.h | 2 ++ - src/coredump/coredump.c | 31 +++++++++++-------------------- - src/journal/journald-server.c | 25 +++++++++++++++---------- - 4 files changed, 38 insertions(+), 30 deletions(-) - -diff --git a/src/basic/io-util.c b/src/basic/io-util.c -index 1f64cc933b..575398fbe6 100644 ---- a/src/basic/io-util.c -+++ b/src/basic/io-util.c -@@ -8,6 +8,7 @@ - #include <unistd.h> - - #include "io-util.h" -+#include "string-util.h" - #include "time-util.h" - - int flush_fd(int fd) { -@@ -252,3 +253,12 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length) { - - return q - (const uint8_t*) p; - } -+ -+char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value) { -+ char *x; -+ -+ x = strappend(field, value); -+ if (x) -+ iovec[(*n_iovec)++] = IOVEC_MAKE_STRING(x); -+ return x; -+} -diff --git a/src/basic/io-util.h b/src/basic/io-util.h -index ed189b5820..792a64ad5e 100644 ---- a/src/basic/io-util.h -+++ b/src/basic/io-util.h -@@ -71,3 +71,5 @@ static inline bool FILE_SIZE_VALID_OR_INFINITY(uint64_t l) { - #define IOVEC_MAKE(base, len) (struct iovec) IOVEC_INIT(base, len) - #define IOVEC_INIT_STRING(string) IOVEC_INIT((char*) string, strlen(string)) - #define IOVEC_MAKE_STRING(string) (struct iovec) IOVEC_INIT_STRING(string) -+ -+char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value); -diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c -index 20a1cbdd45..18e4f61d72 100644 ---- a/src/coredump/coredump.c -+++ b/src/coredump/coredump.c -@@ -1053,19 +1053,10 @@ static int send_iovec(const struct iovec iovec[], size_t n_iovec, int input_fd) - return 0; - } - --static char* set_iovec_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value) { -- char *x; -- -- x = strappend(field, value); -- if (x) -- iovec[(*n_iovec)++] = IOVEC_MAKE_STRING(x); -- return x; --} -- - static char* set_iovec_field_free(struct iovec *iovec, size_t *n_iovec, const char *field, char *value) { - char *x; - -- x = set_iovec_field(iovec, n_iovec, field, value); -+ x = set_iovec_string_field(iovec, n_iovec, field, value); - free(value); - return x; - } -@@ -1115,36 +1106,36 @@ static int gather_pid_metadata( - disable_coredumps(); - } - -- set_iovec_field(iovec, n_iovec, "COREDUMP_UNIT=", context[CONTEXT_UNIT]); -+ set_iovec_string_field(iovec, n_iovec, "COREDUMP_UNIT=", context[CONTEXT_UNIT]); - } - - if (cg_pid_get_user_unit(pid, &t) >= 0) - set_iovec_field_free(iovec, n_iovec, "COREDUMP_USER_UNIT=", t); - - /* The next few are mandatory */ -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_PID=", context[CONTEXT_PID])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_PID=", context[CONTEXT_PID])) - return log_oom(); - -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_UID=", context[CONTEXT_UID])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_UID=", context[CONTEXT_UID])) - return log_oom(); - -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_GID=", context[CONTEXT_GID])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_GID=", context[CONTEXT_GID])) - return log_oom(); - -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_SIGNAL=", context[CONTEXT_SIGNAL])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_SIGNAL=", context[CONTEXT_SIGNAL])) - return log_oom(); - -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_RLIMIT=", context[CONTEXT_RLIMIT])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_RLIMIT=", context[CONTEXT_RLIMIT])) - return log_oom(); - -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_HOSTNAME=", context[CONTEXT_HOSTNAME])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_HOSTNAME=", context[CONTEXT_HOSTNAME])) - return log_oom(); - -- if (!set_iovec_field(iovec, n_iovec, "COREDUMP_COMM=", context[CONTEXT_COMM])) -+ if (!set_iovec_string_field(iovec, n_iovec, "COREDUMP_COMM=", context[CONTEXT_COMM])) - return log_oom(); - - if (context[CONTEXT_EXE] && -- !set_iovec_field(iovec, n_iovec, "COREDUMP_EXE=", context[CONTEXT_EXE])) -+ !set_iovec_string_field(iovec, n_iovec, "COREDUMP_EXE=", context[CONTEXT_EXE])) - return log_oom(); - - if (sd_pid_get_session(pid, &t) >= 0) -@@ -1212,7 +1203,7 @@ static int gather_pid_metadata( - iovec[(*n_iovec)++] = IOVEC_MAKE_STRING(t); - - if (safe_atoi(context[CONTEXT_SIGNAL], &signo) >= 0 && SIGNAL_VALID(signo)) -- set_iovec_field(iovec, n_iovec, "COREDUMP_SIGNAL_NAME=SIG", signal_to_string(signo)); -+ set_iovec_string_field(iovec, n_iovec, "COREDUMP_SIGNAL_NAME=SIG", signal_to_string(signo)); - - return 0; /* we successfully acquired all metadata */ - } -diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c -index 4f1550ec5b..31be085c6b 100644 ---- a/src/journal/journald-server.c -+++ b/src/journal/journald-server.c -@@ -753,6 +753,7 @@ static void dispatch_message_real( - pid_t object_pid) { - - char source_time[sizeof("_SOURCE_REALTIME_TIMESTAMP=") + DECIMAL_STR_MAX(usec_t)]; -+ _cleanup_free_ char *cmdline1 = NULL, *cmdline2 = NULL; - uid_t journal_uid; - ClientContext *o; - -@@ -769,20 +770,23 @@ static void dispatch_message_real( - IOVEC_ADD_NUMERIC_FIELD(iovec, n, c->uid, uid_t, uid_is_valid, UID_FMT, "_UID"); - IOVEC_ADD_NUMERIC_FIELD(iovec, n, c->gid, gid_t, gid_is_valid, GID_FMT, "_GID"); - -- IOVEC_ADD_STRING_FIELD(iovec, n, c->comm, "_COMM"); -- IOVEC_ADD_STRING_FIELD(iovec, n, c->exe, "_EXE"); -- IOVEC_ADD_STRING_FIELD(iovec, n, c->cmdline, "_CMDLINE"); -- IOVEC_ADD_STRING_FIELD(iovec, n, c->capeff, "_CAP_EFFECTIVE"); -+ IOVEC_ADD_STRING_FIELD(iovec, n, c->comm, "_COMM"); /* At most TASK_COMM_LENGTH (16 bytes) */ -+ IOVEC_ADD_STRING_FIELD(iovec, n, c->exe, "_EXE"); /* A path, so at most PATH_MAX (4096 bytes) */ - -- IOVEC_ADD_SIZED_FIELD(iovec, n, c->label, c->label_size, "_SELINUX_CONTEXT"); -+ if (c->cmdline) -+ /* At most _SC_ARG_MAX (2MB usually), which is too much to put on stack. -+ * Let's use a heap allocation for this one. */ -+ cmdline1 = set_iovec_string_field(iovec, &n, "_CMDLINE=", c->cmdline); - -+ IOVEC_ADD_STRING_FIELD(iovec, n, c->capeff, "_CAP_EFFECTIVE"); /* Read from /proc/.../status */ -+ IOVEC_ADD_SIZED_FIELD(iovec, n, c->label, c->label_size, "_SELINUX_CONTEXT"); - IOVEC_ADD_NUMERIC_FIELD(iovec, n, c->auditid, uint32_t, audit_session_is_valid, "%" PRIu32, "_AUDIT_SESSION"); - IOVEC_ADD_NUMERIC_FIELD(iovec, n, c->loginuid, uid_t, uid_is_valid, UID_FMT, "_AUDIT_LOGINUID"); - -- IOVEC_ADD_STRING_FIELD(iovec, n, c->cgroup, "_SYSTEMD_CGROUP"); -+ IOVEC_ADD_STRING_FIELD(iovec, n, c->cgroup, "_SYSTEMD_CGROUP"); /* A path */ - IOVEC_ADD_STRING_FIELD(iovec, n, c->session, "_SYSTEMD_SESSION"); - IOVEC_ADD_NUMERIC_FIELD(iovec, n, c->owner_uid, uid_t, uid_is_valid, UID_FMT, "_SYSTEMD_OWNER_UID"); -- IOVEC_ADD_STRING_FIELD(iovec, n, c->unit, "_SYSTEMD_UNIT"); -+ IOVEC_ADD_STRING_FIELD(iovec, n, c->unit, "_SYSTEMD_UNIT"); /* Unit names are bounded by UNIT_NAME_MAX */ - IOVEC_ADD_STRING_FIELD(iovec, n, c->user_unit, "_SYSTEMD_USER_UNIT"); - IOVEC_ADD_STRING_FIELD(iovec, n, c->slice, "_SYSTEMD_SLICE"); - IOVEC_ADD_STRING_FIELD(iovec, n, c->user_slice, "_SYSTEMD_USER_SLICE"); -@@ -803,13 +807,14 @@ static void dispatch_message_real( - IOVEC_ADD_NUMERIC_FIELD(iovec, n, o->uid, uid_t, uid_is_valid, UID_FMT, "OBJECT_UID"); - IOVEC_ADD_NUMERIC_FIELD(iovec, n, o->gid, gid_t, gid_is_valid, GID_FMT, "OBJECT_GID"); - -+ /* See above for size limits, only ->cmdline may be large, so use a heap allocation for it. */ - IOVEC_ADD_STRING_FIELD(iovec, n, o->comm, "OBJECT_COMM"); - IOVEC_ADD_STRING_FIELD(iovec, n, o->exe, "OBJECT_EXE"); -- IOVEC_ADD_STRING_FIELD(iovec, n, o->cmdline, "OBJECT_CMDLINE"); -- IOVEC_ADD_STRING_FIELD(iovec, n, o->capeff, "OBJECT_CAP_EFFECTIVE"); -+ if (o->cmdline) -+ cmdline2 = set_iovec_string_field(iovec, &n, "OBJECT_CMDLINE=", o->cmdline); - -+ IOVEC_ADD_STRING_FIELD(iovec, n, o->capeff, "OBJECT_CAP_EFFECTIVE"); - IOVEC_ADD_SIZED_FIELD(iovec, n, o->label, o->label_size, "OBJECT_SELINUX_CONTEXT"); -- - IOVEC_ADD_NUMERIC_FIELD(iovec, n, o->auditid, uint32_t, audit_session_is_valid, "%" PRIu32, "OBJECT_AUDIT_SESSION"); - IOVEC_ADD_NUMERIC_FIELD(iovec, n, o->loginuid, uid_t, uid_is_valid, UID_FMT, "OBJECT_AUDIT_LOGINUID"); - --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch new file mode 100644 index 0000000000..e001ed59e8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch @@ -0,0 +1,58 @@ +From e4f9ef547fa342102db15188544daa18e71e9c66 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Fri, 13 Sep 2019 19:26:27 -0400 +Subject: [PATCH] Handle __cpu_mask usage + +Fixes errors: + +src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function) +src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function) + +__cpu_mask is an internal type of glibc's cpu_set implementation, not +part of the POSIX definition, which is problematic when building with +musl, which does not define a matching type. From inspection of musl's +sched.h, however, it is clear that the corresponding type would be +unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So, +add a typedef to cpu-set-util.h defining __cpu_mask appropriately. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- + src/shared/cpu-set-util.h | 2 ++ + src/test/test-sizeof.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h +index 3c63a58826..4c2d4347fc 100644 +--- a/src/shared/cpu-set-util.h ++++ b/src/shared/cpu-set-util.h +@@ -6,6 +6,8 @@ + #include "macro.h" + #include "missing_syscall.h" + ++typedef unsigned long __cpu_mask; ++ + /* This wraps the libc interface with a variable to keep the allocated size. */ + typedef struct CPUSet { + cpu_set_t *set; +diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c +index 4403c0aa52..e7e4ae112d 100644 +--- a/src/test/test-sizeof.c ++++ b/src/test/test-sizeof.c +@@ -1,6 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <sched.h> + #include <stdio.h> + #include <string.h> + #include <sys/types.h> +@@ -10,6 +9,7 @@ + #include <float.h> + + #include "time-util.h" ++#include "cpu-set-util.h" + + /* Print information about various types. Useful when diagnosing + * gcc diagnostics on an unfamiliar architecture. */ diff --git a/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields.patch b/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields.patch deleted file mode 100644 index ae9ef5de56..0000000000 --- a/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 7cad044b72406cbadf048da432c29afea74c3c10 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> -Date: Wed, 5 Dec 2018 22:45:02 +0100 -Subject: [PATCH] journald: set a limit on the number of fields - -The fix for CVE-2018-16865 is plucked from two commits that have -been pushed to systemd master. - -journald: set a limit on the number of fields (1k) - -We allocate a iovec entry for each field, so with many short entries, -our memory usage and processing time can be large, even with a relatively -small message size. Let's refuse overly long entries. - -CVE-2018-16865 -https://bugzilla.redhat.com/show_bug.cgi?id=1653861 - -What from I can see, the problem is not from an alloca, despite what the CVE -description says, but from the attack multiplication that comes from creating -many very small iovecs: (void* + size_t) for each three bytes of input message. - -Patch backported from systemd master at -052c57f132f04a3cf4148f87561618da1a6908b4. - -journal-remote: set a limit on the number of fields in a message - -Existing use of E2BIG is replaced with ENOBUFS (entry too long), and E2BIG is -reused for the new error condition (too many fields). - -This matches the change done for systemd-journald, hence forming the second -part of the fix for CVE-2018-16865 -(https://bugzilla.redhat.com/show_bug.cgi?id=1653861). - -Patch backported from systemd master at -ef4d6abe7c7fab6cbff975b32e76b09feee56074. -with the changes applied by 7fdb237f5473cb8fc2129e57e8a0039526dcb4fd -removed. - -CVE: CVE-2018-16865 -Upstream-Status: Backport -Signed-off-by: Marcus Cooper <marcusc@axis.com> ---- - src/basic/journal-importer.c | 5 ++++- - src/basic/journal-importer.h | 3 +++ - src/journal-remote/journal-remote-main.c | 7 ++++++- - src/journal-remote/journal-remote.c | 5 ++++- - src/journal/journald-native.c | 5 +++++ - 5 files changed, 22 insertions(+), 3 deletions(-) - -diff --git a/src/basic/journal-importer.c b/src/basic/journal-importer.c -index ca203bbbfc..3ac55a66d9 100644 ---- a/src/basic/journal-importer.c -+++ b/src/basic/journal-importer.c -@@ -23,6 +23,9 @@ enum { - }; - - static int iovw_put(struct iovec_wrapper *iovw, void* data, size_t len) { -+ if (iovw->count >= ENTRY_FIELD_COUNT_MAX) -+ return -E2BIG; -+ - if (!GREEDY_REALLOC(iovw->iovec, iovw->size_bytes, iovw->count + 1)) - return log_oom(); - -@@ -98,7 +101,7 @@ static int get_line(JournalImporter *imp, char **line, size_t *size) { - imp->scanned = imp->filled; - if (imp->scanned >= DATA_SIZE_MAX) { - log_error("Entry is bigger than %u bytes.", DATA_SIZE_MAX); -- return -E2BIG; -+ return -ENOBUFS; - } - - if (imp->passive_fd) -diff --git a/src/basic/journal-importer.h b/src/basic/journal-importer.h -index f49ce734a1..c4ae45d32d 100644 ---- a/src/basic/journal-importer.h -+++ b/src/basic/journal-importer.h -@@ -16,6 +16,9 @@ - #define DATA_SIZE_MAX (1024*1024*768u) - #define LINE_CHUNK 8*1024u - -+/* The maximum number of fields in an entry */ -+#define ENTRY_FIELD_COUNT_MAX 1024 -+ - struct iovec_wrapper { - struct iovec *iovec; - size_t size_bytes; -diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c -index 8fda9d1499..3a01fef646 100644 ---- a/src/journal-remote/journal-remote-main.c -+++ b/src/journal-remote/journal-remote-main.c -@@ -212,7 +212,12 @@ static int process_http_upload( - break; - else if (r < 0) { - log_warning("Failed to process data for connection %p", connection); -- if (r == -E2BIG) -+ if (r == -ENOBUFS) -+ return mhd_respondf(connection, -+ r, MHD_HTTP_PAYLOAD_TOO_LARGE, -+ "Entry is above the maximum of %u, aborting connection %p.", -+ DATA_SIZE_MAX, connection); -+ else if (r == -E2BIG) - return mhd_respondf(connection, - r, MHD_HTTP_PAYLOAD_TOO_LARGE, - "Entry is too large, maximum is " STRINGIFY(DATA_SIZE_MAX) " bytes."); -diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c -index beb75a1cb4..67e3a70c06 100644 ---- a/src/journal-remote/journal-remote.c -+++ b/src/journal-remote/journal-remote.c -@@ -408,7 +408,10 @@ int journal_remote_handle_raw_source( - log_debug("%zu active sources remaining", s->active); - return 0; - } else if (r == -E2BIG) { -- log_notice_errno(E2BIG, "Entry too big, skipped"); -+ log_notice("Entry with too many fields, skipped"); -+ return 1; -+ } else if (r == -ENOBUFS) { -+ log_notice("Entry too big, skipped"); - return 1; - } else if (r == -EAGAIN) { - return 0; -diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c -index 5ff22a10af..951d092053 100644 ---- a/src/journal/journald-native.c -+++ b/src/journal/journald-native.c -@@ -140,6 +140,11 @@ static int server_process_entry( - } - - /* A property follows */ -+ if (n > ENTRY_FIELD_COUNT_MAX) { -+ log_debug("Received an entry that has more than " STRINGIFY(ENTRY_FIELD_COUNT_MAX) " fields, ignoring entry."); -+ r = 1; -+ goto finish; -+ } - - /* n existing properties, 1 new, +1 for _TRANSPORT */ - if (!GREEDY_REALLOC(iovec, m, --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch new file mode 100644 index 0000000000..2d06ab84a2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch @@ -0,0 +1,165 @@ +From 66a926cf906260c2fb5ea851e55efe03edd444dc Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Tue, 10 Mar 2020 11:05:20 +0000 +Subject: [PATCH] Handle missing gshadow + +gshadow usage is now present in the userdb code. Mask all uses of it to +allow compilation on musl + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> + +--- + src/shared/user-record-nss.c | 20 ++++++++++++++++++++ + src/shared/user-record-nss.h | 4 ++++ + src/shared/userdb.c | 7 ++++++- + 3 files changed, 30 insertions(+), 1 deletion(-) + +--- a/src/shared/user-record-nss.c ++++ b/src/shared/user-record-nss.c +@@ -331,8 +331,10 @@ int nss_group_to_group_record( + if (isempty(grp->gr_name)) + return -EINVAL; + ++#if ENABLE_GSHADOW + if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name)) + return -EINVAL; ++#endif + + g = group_record_new(); + if (!g) +@@ -348,6 +350,7 @@ int nss_group_to_group_record( + + g->gid = grp->gr_gid; + ++#if ENABLE_GSHADOW + if (sgrp) { + if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { + g->hashed_password = strv_new(sgrp->sg_passwd); +@@ -363,6 +366,7 @@ int nss_group_to_group_record( + if (r < 0) + return r; + } ++#endif + + r = json_build(&g->json, JSON_BUILD_OBJECT( + JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), +@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou + assert(ret_sgrp); + assert(ret_buffer); + ++#if ENABLE_GSHADOW + for (;;) { + _cleanup_free_ char *buf = NULL; + struct sgrp sgrp, *result; +@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou + buflen *= 2; + buf = mfree(buf); + } ++#else ++ return -ESRCH; ++#endif + } + + int nss_group_record_by_name( +@@ -427,7 +435,9 @@ int nss_group_record_by_name( + struct group grp, *result; + bool incomplete = false; + size_t buflen = 4096; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + assert(name); +@@ -457,6 +467,7 @@ int nss_group_record_by_name( + buf = mfree(buf); + } + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -468,6 +479,9 @@ int nss_group_record_by_name( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +@@ -484,7 +498,9 @@ int nss_group_record_by_gid( + struct group grp, *result; + bool incomplete = false; + size_t buflen = 4096; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + assert(ret); +@@ -512,6 +528,7 @@ int nss_group_record_by_gid( + buf = mfree(buf); + } + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -523,6 +540,9 @@ int nss_group_record_by_gid( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +--- a/src/shared/user-record-nss.h ++++ b/src/shared/user-record-nss.h +@@ -2,7 +2,11 @@ + #pragma once + + #include <grp.h> ++#if ENABLE_GSHADOW + #include <gshadow.h> ++#else ++struct sgrp; ++#endif + #include <pwd.h> + #include <shadow.h> + +--- a/src/shared/userdb.c ++++ b/src/shared/userdb.c +@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator + if (gr) { + _cleanup_free_ char *buffer = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp; +- ++#endif + if (streq_ptr(gr->gr_name, "root")) + iterator->synthesize_root = false; + if (gr->gr_gid == GID_NOBODY) + iterator->synthesize_nobody = false; + ++#if ENABLE_GSHADOW + if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { + r = nss_sgrp_for_group(gr, &sgrp, &buffer); + if (r < 0) { +@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator + } + + r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); ++#else ++ r = nss_group_to_group_record(gr, NULL, ret); ++#endif + if (r < 0) + return r; + diff --git a/meta/recipes-core/systemd/systemd/0026-journal-fix-out-of-bounds-read-CVE-2018-16866.patch b/meta/recipes-core/systemd/systemd/0026-journal-fix-out-of-bounds-read-CVE-2018-16866.patch deleted file mode 100644 index 3925a4abbb..0000000000 --- a/meta/recipes-core/systemd/systemd/0026-journal-fix-out-of-bounds-read-CVE-2018-16866.patch +++ /dev/null @@ -1,49 +0,0 @@ -From ebd06c37d4311db9851f4d3fdd023de3dd590de0 Mon Sep 17 00:00:00 2001 -From: Filipe Brandenburger <filbranden@google.com> -Date: Thu, 10 Jan 2019 14:53:33 -0800 -Subject: [PATCH] journal: fix out-of-bounds read CVE-2018-16866 - -The original code didn't account for the fact that strchr() would match on the -'\0' character, making it read past the end of the buffer if no non-whitespace -character was present. - -This bug was introduced in commit ec5ff4445cca6a which was first released in -systemd v221 and later fixed in commit 8595102d3ddde6 which was released in -v240, so versions in the range [v221, v240) are affected. - -Patch backported from systemd-stable at f005e73d3723d62a39be661931fcb6347119b52b -also includes a change from systemd master which removes a heap buffer overflow -a6aadf4ae0bae185dc4c414d492a4a781c80ffe5. - -CVE: CVE-2018-16866 -Upstream-Status: Backport -Signed-off-by: Marcus Cooper <marcusc@axis.com> ---- - src/journal/journald-syslog.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c -index 9dea116722..809b318c06 100644 ---- a/src/journal/journald-syslog.c -+++ b/src/journal/journald-syslog.c -@@ -194,7 +194,7 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid) - e = l; - l--; - -- if (p[l-1] == ']') { -+ if (l > 0 && p[l-1] == ']') { - size_t k = l-1; - - for (;;) { -@@ -219,7 +219,7 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid) - if (t) - *identifier = t; - -- if (strchr(WHITESPACE, p[e])) -+ if (p[e] != '\0' && strchr(WHITESPACE, p[e])) - e++; - *buf = p + e; - return e; --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch new file mode 100644 index 0000000000..f4a71be7cc --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch @@ -0,0 +1,42 @@ +From 6f0dd2ba75b68036d7b4ebfe47ac5eaf44d26f06 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 12 Apr 2021 23:44:53 -0700 +Subject: [PATCH] missing_syscall.h: Define MIPS ABI defines for musl + +musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64 +unlike glibc where these are provided by libc headers, therefore define +them here in case they are undefined + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + src/basic/missing_syscall.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/src/basic/missing_syscall.h ++++ b/src/basic/missing_syscall.h +@@ -20,6 +20,12 @@ + #include <asm/sgidefs.h> + #endif + ++#ifndef _MIPS_SIM_ABI32 ++#define _MIPS_SIM_ABI32 1 ++#define _MIPS_SIM_NABI32 2 ++#define _MIPS_SIM_ABI64 3 ++#endif ++ + #include "macro.h" + #include "missing_keyctl.h" + #include "missing_stat.h" +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -19,6 +19,7 @@ + #include "string-util.h" + #include "umask-util.h" + #include "user-util.h" ++#include "missing_syscall.h" + + typedef struct BaseFilesystem { + const char *dir; /* directory or symlink to create */ diff --git a/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch new file mode 100644 index 0000000000..782b9645cb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch @@ -0,0 +1,253 @@ +From 6f4e84126aaa4e26cb6865b054ea5ddebd3906e5 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <watanabe.yu+github@gmail.com> +Date: Thu, 3 Feb 2022 12:14:19 +0900 +Subject: [PATCH] network: enable KeepConfiguration= when running on network + filesystem +Cc: pavel@zhukoff.net + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/22383] +[YOCTO #14708] + +network-generator: rename DHCP_TYPE_DHCP -> DHCP_TYPE_DHCP4 + +To emphasize this is DHCPv4. No behavior is changed. + +stat-util: introduce path_is_network_fs() + +network: enable KeepConfiguration= when running on network filesystem + +Also, set KeepConfiguration=dhcp-on-stop by default when running in +initrd. + +Fixes #21967. +--- + man/systemd.network.xml | 6 +++-- + src/basic/stat-util.c | 9 +++++++ + src/basic/stat-util.h | 1 + + src/network/generator/network-generator.c | 4 ++-- + src/network/generator/network-generator.h | 2 +- + src/network/networkd-manager.c | 29 +++++++++++++++++++++++ + src/network/networkd-manager.h | 2 ++ + src/network/networkd-network.c | 12 ++++++---- + src/network/test-networkd-conf.c | 5 ++++ + 9 files changed, 60 insertions(+), 10 deletions(-) + +diff --git a/man/systemd.network.xml b/man/systemd.network.xml +index af431e4f2c..f90cff4cd6 100644 +--- a/man/systemd.network.xml ++++ b/man/systemd.network.xml +@@ -944,8 +944,10 @@ Table=1234</programlisting></para> + lease expires. This is contrary to the DHCP specification, but may be the best choice if, + e.g., the root filesystem relies on this connection. The setting <literal>dhcp</literal> + implies <literal>dhcp-on-stop</literal>, and <literal>yes</literal> implies +- <literal>dhcp</literal> and <literal>static</literal>. Defaults to <literal>no</literal>. +- </para> ++ <literal>dhcp</literal> and <literal>static</literal>. Defaults to ++ <literal>dhcp-on-stop</literal> when <command>systemd-networkd</command> is running in ++ initrd, <literal>yes</literal> when the root filesystem is a network filesystem, and ++ <literal>no</literal> otherwise.</para> + </listitem> + </varlistentry> + </variablelist> +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index efac7b002e..c2269844f8 100644 +--- a/src/basic/stat-util.c ++++ b/src/basic/stat-util.c +@@ -249,6 +249,15 @@ int path_is_temporary_fs(const char *path) { + return is_temporary_fs(&s); + } + ++int path_is_network_fs(const char *path) { ++ struct statfs s; ++ ++ if (statfs(path, &s) < 0) ++ return -errno; ++ ++ return is_network_fs(&s); ++} ++ + int stat_verify_regular(const struct stat *st) { + assert(st); + +diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h +index a566114f7c..f7d2f12aa9 100644 +--- a/src/basic/stat-util.h ++++ b/src/basic/stat-util.h +@@ -53,6 +53,7 @@ int fd_is_temporary_fs(int fd); + int fd_is_network_fs(int fd); + + int path_is_temporary_fs(const char *path); ++int path_is_network_fs(const char *path); + + /* Because statfs.t_type can be int on some architectures, we have to cast + * the const magic to the type, otherwise the compiler warns about +diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +index c081ec673c..063ad08d80 100644 +--- a/src/network/generator/network-generator.c ++++ b/src/network/generator/network-generator.c +@@ -47,7 +47,7 @@ static const char * const dracut_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "off", + [DHCP_TYPE_ON] = "on", + [DHCP_TYPE_ANY] = "any", +- [DHCP_TYPE_DHCP] = "dhcp", ++ [DHCP_TYPE_DHCP4] = "dhcp", + [DHCP_TYPE_DHCP6] = "dhcp6", + [DHCP_TYPE_AUTO6] = "auto6", + [DHCP_TYPE_EITHER6] = "either6", +@@ -62,7 +62,7 @@ static const char * const networkd_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "no", + [DHCP_TYPE_ON] = "yes", + [DHCP_TYPE_ANY] = "yes", +- [DHCP_TYPE_DHCP] = "ipv4", ++ [DHCP_TYPE_DHCP4] = "ipv4", + [DHCP_TYPE_DHCP6] = "ipv6", + [DHCP_TYPE_AUTO6] = "no", /* TODO: enable other setting? */ + [DHCP_TYPE_EITHER6] = "ipv6", /* TODO: enable other setting? */ +diff --git a/src/network/generator/network-generator.h b/src/network/generator/network-generator.h +index dd0a58738b..0e0da2a57a 100644 +--- a/src/network/generator/network-generator.h ++++ b/src/network/generator/network-generator.h +@@ -13,7 +13,7 @@ typedef enum DHCPType { + DHCP_TYPE_OFF, + DHCP_TYPE_ON, + DHCP_TYPE_ANY, +- DHCP_TYPE_DHCP, ++ DHCP_TYPE_DHCP4, + DHCP_TYPE_DHCP6, + DHCP_TYPE_AUTO6, + DHCP_TYPE_EITHER6, +diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c +index 7e89366ae8..3261f289e9 100644 +--- a/src/network/networkd-manager.c ++++ b/src/network/networkd-manager.c +@@ -398,6 +398,30 @@ static int signal_restart_callback(sd_event_source *s, const struct signalfd_sig + return sd_event_exit(sd_event_source_get_event(s), 0); + } + ++static int manager_set_keep_configuration(Manager *m) { ++ int r; ++ ++ assert(m); ++ ++ if (in_initrd()) { ++ log_debug("Running in initrd, keep DHCPv4 addresses on stopping networkd by default."); ++ m->keep_configuration = KEEP_CONFIGURATION_DHCP_ON_STOP; ++ return 0; ++ } ++ ++ r = path_is_network_fs("/"); ++ if (r < 0) ++ return log_error_errno(r, "Failed to detect if root is network filesystem: %m"); ++ if (r == 0) { ++ m->keep_configuration = _KEEP_CONFIGURATION_INVALID; ++ return 0; ++ } ++ ++ log_debug("Running on network filesystem, enabling KeepConfiguration= by default."); ++ m->keep_configuration = KEEP_CONFIGURATION_YES; ++ return 0; ++} ++ + int manager_setup(Manager *m) { + int r; + +@@ -453,6 +477,10 @@ int manager_setup(Manager *m) { + if (r < 0) + return r; + ++ r = manager_set_keep_configuration(m); ++ if (r < 0) ++ return r; ++ + m->state_file = strdup("/run/systemd/netif/state"); + if (!m->state_file) + return -ENOMEM; +@@ -468,6 +496,7 @@ int manager_new(Manager **ret, bool test_mode) { + return -ENOMEM; + + *m = (Manager) { ++ .keep_configuration = _KEEP_CONFIGURATION_INVALID, + .test_mode = test_mode, + .speed_meter_interval_usec = SPEED_METER_DEFAULT_TIME_INTERVAL, + .online_state = _LINK_ONLINE_STATE_INVALID, +diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h +index 36313589a3..86de529124 100644 +--- a/src/network/networkd-manager.h ++++ b/src/network/networkd-manager.h +@@ -28,6 +28,8 @@ struct Manager { + Hashmap *polkit_registry; + int ethtool_fd; + ++ KeepConfiguration keep_configuration; ++ + bool test_mode; + bool enumerating; + bool dirty; +diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c +index 3142be471f..edcd68d616 100644 +--- a/src/network/networkd-network.c ++++ b/src/network/networkd-network.c +@@ -124,6 +124,7 @@ int network_verify(Network *network) { + int r; + + assert(network); ++ assert(network->manager); + assert(network->filename); + + if (net_match_is_empty(&network->match) && !network->conditions) +@@ -248,10 +249,11 @@ int network_verify(Network *network) { + } + + if (network->dhcp_critical >= 0) { +- if (network->keep_configuration >= 0) +- log_warning("%s: Both KeepConfiguration= and deprecated CriticalConnection= are set. " +- "Ignoring CriticalConnection=.", network->filename); +- else if (network->dhcp_critical) ++ if (network->keep_configuration >= 0) { ++ if (network->manager->keep_configuration < 0) ++ log_warning("%s: Both KeepConfiguration= and deprecated CriticalConnection= are set. " ++ "Ignoring CriticalConnection=.", network->filename); ++ } else if (network->dhcp_critical) + /* CriticalConnection=yes also preserve foreign static configurations. */ + network->keep_configuration = KEEP_CONFIGURATION_YES; + else +@@ -386,7 +388,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi + .allmulticast = -1, + .promiscuous = -1, + +- .keep_configuration = _KEEP_CONFIGURATION_INVALID, ++ .keep_configuration = manager->keep_configuration, + + .dhcp_duid.type = _DUID_TYPE_INVALID, + .dhcp_critical = -1, +diff --git a/src/network/test-networkd-conf.c b/src/network/test-networkd-conf.c +index 4b00a98086..5f1328e39c 100644 +--- a/src/network/test-networkd-conf.c ++++ b/src/network/test-networkd-conf.c +@@ -6,6 +6,7 @@ + #include "net-condition.h" + #include "networkd-address.h" + #include "networkd-conf.h" ++#include "networkd-manager.h" + #include "networkd-network.h" + #include "strv.h" + +@@ -166,11 +167,15 @@ static void test_config_parse_ether_addr(void) { + } + + static void test_config_parse_address_one(const char *rvalue, int family, unsigned n_addresses, const union in_addr_union *u, unsigned char prefixlen) { ++ _cleanup_(manager_freep) Manager *manager = NULL; + _cleanup_(network_unrefp) Network *network = NULL; + ++ assert_se(manager_new(&manager, /* test_mode = */ true) >= 0); + assert_se(network = new0(Network, 1)); + network->n_ref = 1; ++ network->manager = manager; + assert_se(network->filename = strdup("hogehoge.network")); ++ + assert_se(config_parse_match_ifnames("network", "filename", 1, "section", 1, "Name", 0, "*", &network->match.ifname, network) == 0); + assert_se(config_parse_address("network", "filename", 1, "section", 1, "Address", 0, rvalue, network, network) == 0); + assert_se(ordered_hashmap_size(network->addresses_by_section) == 1); +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/99-default.preset b/meta/recipes-core/systemd/systemd/99-default.preset new file mode 100644 index 0000000000..1f29b50597 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/99-default.preset @@ -0,0 +1 @@ +disable * diff --git a/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf new file mode 100644 index 0000000000..f4d0271cdb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf @@ -0,0 +1,11 @@ +<?xml version="1.0"?> <!--*-nxml-*--> +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + +<busconfig> + <policy group="systemd-hostname"> + <allow own="org.freedesktop.hostname1"/> + <allow send_destination="org.freedesktop.hostname1"/> + <allow receive_sender="org.freedesktop.hostname1"/> + </policy> +</busconfig> diff --git a/meta/recipes-core/systemd/systemd/systemd-pager.sh b/meta/recipes-core/systemd/systemd/systemd-pager.sh new file mode 100644 index 0000000000..86e3e0ab78 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pager.sh @@ -0,0 +1,7 @@ +# Systemd expect a color capable pager, however the less provided +# by busybox is not. This make many interaction with systemd pretty +# annoying. As a workaround we disable the systemd pager if less +# is not the GNU version. +if ! less -V > /dev/null 2>&1 ; then + export SYSTEMD_PAGER= +fi diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_250.4.bb index f843f588bd..2b346113b5 100644 --- a/meta/recipes-core/systemd/systemd_239.bb +++ b/meta/recipes-core/systemd/systemd_250.4.bb @@ -4,11 +4,11 @@ PROVIDES = "udev" PE = "1" -DEPENDS = "intltool-native gperf-native libcap util-linux" +DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native" SECTION = "base/shell" -inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages distro_features_check +inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check # As this recipe builds udev, respect systemd being in DISTRO_FEATURES so # that we don't build both udev and systemd in world builds. @@ -16,62 +16,49 @@ REQUIRED_DISTRO_FEATURES = "systemd" SRC_URI += "file://touchscreen.rules \ file://00-create-volatile.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \ file://init \ + file://99-default.preset \ + file://systemd-pager.sh \ file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ - file://0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch \ file://0003-implment-systemd-sysv-install-for-OE.patch \ - file://0004-rules-whitelist-hd-devices.patch \ - file://0005-Make-root-s-home-directory-configurable.patch \ - file://0006-remove-nobody-user-group-checking.patch \ - file://0007-rules-watch-metadata-changes-in-ide-devices.patch \ - file://0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch \ - file://0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch \ - file://0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch \ - file://0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch \ - file://0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch \ - file://0023-resolvconf-fixes-for-the-compatibility-interface.patch \ - file://0001-core-when-deserializing-state-always-use-read_line-L.patch \ - file://0001-chown-recursive-let-s-rework-the-recursive-logic-to-.patch \ - file://0001-dhcp6-make-sure-we-have-enough-space-for-the-DHCP6-o.patch \ - file://0001-Revert-sysctl.d-request-ECN-on-both-in-and-outgoing-.patch \ - file://0001-timesync-changes-type-of-drift_freq-to-int64_t.patch \ - file://0001-sysctl-Don-t-pass-null-directive-argument-to-s.patch \ - file://0002-core-Fix-use-after-free-case-in-load_from_path.patch \ - file://0001-meson-rename-Ddebug-to-Ddebug-extra.patch \ - file://0024-journald-do-not-store-the-iovec-entry-for-process-co.patch \ - file://0025-journald-set-a-limit-on-the-number-of-fields.patch \ - file://0026-journal-fix-out-of-bounds-read-CVE-2018-16866.patch \ + file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \ + file://0001-test-parse-argument-Include-signal.h.patch \ + file://0029-network-enable-KeepConfiguration-when-running-on-net.patch \ " -# patches made for musl are only applied on TCLIBC is musl -SRC_URI += "${SRC_URI_MUSL}" -SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.patch \ +# patches needed by musl +SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" +SRC_URI_MUSL = "\ file://0002-don-t-use-glibc-specific-qsort_r.patch \ - file://0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ + file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ file://0004-add-fallback-parse_printf_format-implementation.patch \ - file://0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch \ - file://0006-src-basic-missing.h-check-for-missing-strndupa.patch \ - file://0007-Include-netinet-if_ether.h.patch \ - file://0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ - file://0009-add-missing-FTW_-macros-for-musl.patch \ - file://0010-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \ - file://0011-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch \ - file://0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ - file://0013-Use-uintmax_t-for-handling-rlim_t.patch \ - file://0014-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch \ - file://0015-test-hexdecoct.c-Include-missing.h-for-strndupa.patch \ - file://0016-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ - file://0017-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ - file://0018-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ - file://0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ - file://0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ - file://0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ + file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ + file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ + file://0008-add-missing-FTW_-macros-for-musl.patch \ + file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ + file://0010-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ + file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ + file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ + file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ + file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \ + file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \ + file://0019-Handle-missing-LOCK_EX.patch \ + file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \ + file://0021-test-json.c-define-M_PIl.patch \ + file://0022-do-not-disable-buffer-in-writing-files.patch \ + file://0025-Handle-__cpu_mask-usage.patch \ + file://0026-Handle-missing-gshadow.patch \ + file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ + file://0001-pass-correct-parameters-to-getdents64.patch \ + file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ + file://0001-Adjust-for-musl-headers.patch \ " -# Workaround undefined reference to `__stack_chk_fail_local' on qemux86 and qemuppc for musl -SRC_URI_append_libc-musl_qemux86 = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch" -SRC_URI_append_libc-musl_qemuppc = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch" - PAM_PLUGINS = " \ pam-plugin-unix \ pam-plugin-loginuid \ @@ -79,16 +66,16 @@ PAM_PLUGINS = " \ " PACKAGECONFIG ??= " \ - ${@bb.utils.filter('DISTRO_FEATURES', 'efi ldconfig pam selinux usrmerge polkit', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ - acl \ + ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \ backlight \ binfmt \ - firstboot \ gshadow \ hibernate \ hostnamed \ + idn \ ima \ kmod \ localed \ @@ -97,30 +84,44 @@ PACKAGECONFIG ??= " \ myhostname \ networkd \ nss \ + nss-mymachines \ + nss-resolve \ quotacheck \ randomseed \ resolved \ - smack \ + set-time-epoch \ sysusers \ + sysvinit \ timedated \ timesyncd \ + userdb \ utmp \ vconsole \ - xz \ + wheel-group \ + zstd \ " -PACKAGECONFIG_remove_libc-musl = " \ +PACKAGECONFIG:remove:libc-musl = " \ gshadow \ + idn \ localed \ myhostname \ nss \ - resolved \ - selinux \ - smack \ + nss-mymachines \ + nss-resolve \ sysusers \ + userdb \ utmp \ " +# https://github.com/seccomp/libseccomp/issues/347 +PACKAGECONFIG:remove:mipsarch = "seccomp" + +CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 " + +# Some of the dependencies are weak-style recommends - if not available at runtime, +# systemd won't fail but the library-related feature will be skipped with a warning. + # Use the upstream systemd serial-getty@.service and rely on # systemd-getty-generator instead of using the OE-core specific # systemd-serialgetty.bb - not enabled by default. @@ -131,61 +132,89 @@ PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit" PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false" PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false" PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2" +PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid" PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" -PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup" +PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup" +PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device" PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" +PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi" PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils" PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" +PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false" +PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false" # Sign the journal for anti-tampering PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false" PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" +PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" -# importd requires curl/xz/zlib/bzip2/gcrypt +# importd requires journal-upload/xz/zlib/bzip2/gcrypt PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" # Update NAT firewall rules PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod" -PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false" -PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn" +PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" +PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn" +PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2" +# Link udev shared with systemd helper library. +# If enabled the udev package depends on the systemd package (which has the needed shared library). +PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false" PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false" PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" -PACKAGECONFIG[myhostname] = "-Dmyhostname=true,-Dmyhostname=false" +PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false" +PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" +PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" +PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false" +PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" +PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" +# If polkit is disabled and networkd+hostnamed are in use, enabling this option and +# using dbus-broker will allow networkd to be authorized to change the +# hostname without acquiring additional privileges +PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit" PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" -PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode" +PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode" PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" -# libseccomp is found in meta-security PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" -PACKAGECONFIG[time-epoch] = "-Dtime-epoch=0,," +PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" +# When enabled use reproducble build timestamp if set as time epoch, +# or build time if not. When disabled, time epoch is unset. +def build_epoch(d): + epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" + return '-Dtime-epoch=%d' % int(epoch) +PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0" PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true" PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true" +PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false" PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" +PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false" +PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false" # Verify keymaps on locale change PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" +PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd" # Helper variables to clarify locations. This mirrors the logic in systemd's # build system. @@ -193,27 +222,26 @@ rootprefix ?= "${root_prefix}" rootlibdir ?= "${base_libdir}" rootlibexecdir = "${rootprefix}/lib" -# This links udev statically with systemd helper library. -# Otherwise udev package would depend on systemd package (which has the needed shared library), -# and always pull it into images. -EXTRA_OEMESON += "-Dlink-udev-shared=false" - EXTRA_OEMESON += "-Dnobody-user=nobody \ -Dnobody-group=nobody \ - -Droothomedir=${ROOT_HOME} \ -Drootlibdir=${rootlibdir} \ -Drootprefix=${rootprefix} \ - -Dsysvrcnd-path=${sysconfdir} \ + -Ddefault-locale=C \ + -Dmode=release \ + -Dsystem-alloc-uid-min=101 \ + -Dsystem-uid-max=999 \ + -Dsystem-alloc-gid-min=101 \ + -Dsystem-gid-max=999 \ " # Hardcode target binary paths to avoid using paths from sysroot EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ - -Dkill-path=${base_bindir}/kill \ -Dkmod-path=${base_bindir}/kmod \ -Dmount-path=${base_bindir}/mount \ -Dquotacheck-path=${sbindir}/quotacheck \ -Dquotaon-path=${sbindir}/quotaon \ -Dsulogin-path=${base_sbindir}/sulogin \ + -Dnologin-path=${base_sbindir}/nologin \ -Dumount-path=${base_bindir}/umount" do_install() { @@ -221,7 +249,7 @@ do_install() { install -d ${D}/${base_sbindir} if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then # Provided by a separate recipe - rm ${D}${systemd_unitdir}/system/serial-getty* -f + rm ${D}${systemd_system_unitdir}/serial-getty* -f fi # Provide support for initramfs @@ -230,9 +258,9 @@ do_install() { install -d ${D}${sysconfdir}/udev/rules.d/ install -d ${D}${sysconfdir}/tmpfiles.d - install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/ - install -d ${D}${libdir}/pkgconfig - install -m 0644 ${B}/src/udev/udev.pc ${D}${libdir}/pkgconfig/ + for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do + install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ + done install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ @@ -240,35 +268,40 @@ do_install() { install -d ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd + install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install fi - chown root:systemd-journal ${D}/${localstatedir}/log/journal - - # Delete journal README, as log can be symlinked inside volatile. - rm -f ${D}/${localstatedir}/log/README + if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then + # /var/log is typically a symbolic link to inside /var/volatile, + # which is expected to be empty. + rm -rf ${D}${localstatedir}/log + else + chown root:systemd-journal ${D}${localstatedir}/log/journal - # journal-remote creates this at start - rm -rf ${D}/${localstatedir}/log/journal/remote + # journal-remote creates this at start + rm -rf ${D}${localstatedir}/log/journal/remote + fi - install -d ${D}${systemd_unitdir}/system/graphical.target.wants - install -d ${D}${systemd_unitdir}/system/multi-user.target.wants - install -d ${D}${systemd_unitdir}/system/poweroff.target.wants - install -d ${D}${systemd_unitdir}/system/reboot.target.wants - install -d ${D}${systemd_unitdir}/system/rescue.target.wants + install -d ${D}${systemd_system_unitdir}/graphical.target.wants + install -d ${D}${systemd_system_unitdir}/multi-user.target.wants + install -d ${D}${systemd_system_unitdir}/poweroff.target.wants + install -d ${D}${systemd_system_unitdir}/reboot.target.wants + install -d ${D}${systemd_system_unitdir}/rescue.target.wants # Create symlinks for systemd-update-utmp-runlevel.service if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service fi # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it # for existence else it fails - if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then - ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf', d)} + if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] && + ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then + echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf fi if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf @@ -279,7 +312,10 @@ do_install() { sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd fi - install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install + if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then + rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf + rm -r ${D}${sysconfdir}/X11 + fi # If polkit is setup fixup permissions and ownership if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then @@ -289,27 +325,37 @@ do_install() { fi fi - # conf files are handled by systemd-conf - rm -f ${D}${sysconfdir}/machine-id - rm -f ${D}${sysconfdir}/systemd/coredump.conf - rm -f ${D}${sysconfdir}/systemd/journald.conf - rm -f ${D}${sysconfdir}/systemd/logind.conf - rm -f ${D}${sysconfdir}/systemd/system.conf - rm -f ${D}${sysconfdir}/systemd/user.conf + # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to + # request hostname changes via DBUS without elevating its privileges + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -d ${D}${datadir}/dbus-1/system.d/ + install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/ + fi + + # create link for existing udev rules + ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm # duplicate udevadm for postinst script install -d ${D}${libexecdir} ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm -} + # install default policy for presets + # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto + install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset + + # add a profile fragment to disable systemd pager with busybox less + install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh +} -python populate_packages_prepend (){ +python populate_packages:prepend (){ systemdlibdir = d.getVar("rootlibdir") - do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) + do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) } PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" -PACKAGES =+ "\ +PACKAGE_BEFORE_PN = "\ ${PN}-gui \ ${PN}-vconsole-setup \ ${PN}-initramfs \ @@ -318,112 +364,119 @@ PACKAGES =+ "\ ${PN}-rpm-macros \ ${PN}-binfmt \ ${PN}-zsh-completion \ - ${PN}-xorg-xinitrc \ ${PN}-container \ ${PN}-journal-gatewayd \ ${PN}-journal-upload \ ${PN}-journal-remote \ ${PN}-extra-utils \ + ${PN}-udev-rules \ + libsystemd-shared \ + udev \ + udev-hwdb \ " -SUMMARY_${PN}-container = "Tools for containers and VMs" -DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." +SUMMARY:${PN}-container = "Tools for containers and VMs" +DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." + +SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events" +DESCRIPTION:${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default." -SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events" -DESCRIPTION_${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default." +SUMMARY:${PN}-journal-upload = "Send journal messages over the network" +DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." -SUMMARY_${PN}-journal-upload = "Send journal messages over the network" -DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." +SUMMARY:${PN}-journal-remote = "Receive journal messages over the network" +DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." -SUMMARY_${PN}-journal-remote = "Receive journal messages over the network" -DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." +SUMMARY:libsystemd-shared = "Systemd shared library" SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ " -SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" +SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service" USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ " -GROUPADD_PARAM_${PN} = "-r systemd-journal" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}" -USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy" -USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway" -USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote" -USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload" - -FILES_${PN}-analyze = "${bindir}/systemd-analyze" - -FILES_${PN}-initramfs = "/init" -RDEPENDS_${PN}-initramfs = "${PN}" - -FILES_${PN}-gui = "${bindir}/systemadm" - -FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ - ${systemd_unitdir}/system/systemd-vconsole-setup.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" - -RDEPENDS_${PN}-kernel-install += "bash" -FILES_${PN}-kernel-install = "${bindir}/kernel-install \ +GROUPADD_PARAM:${PN} = "-r systemd-journal;" +GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" +USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy" +USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" +USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" +USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" + +FILES:${PN}-analyze = "${bindir}/systemd-analyze" + +FILES:${PN}-initramfs = "/init" +RDEPENDS:${PN}-initramfs = "${PN}" + +FILES:${PN}-gui = "${bindir}/systemadm" + +FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ + ${systemd_system_unitdir}/systemd-vconsole-setup.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service" + +RDEPENDS:${PN}-kernel-install += "bash" +FILES:${PN}-kernel-install = "${bindir}/kernel-install \ ${sysconfdir}/kernel/ \ ${exec_prefix}/lib/kernel \ " -FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ +FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ " -FILES_${PN}-xorg-xinitrc = "${sysconfdir}/X11/xinit/xinitrc.d/*" - -FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions" +FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" -FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ +FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ ${exec_prefix}/lib/binfmt.d \ ${rootlibexecdir}/systemd/systemd-binfmt \ - ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \ - ${systemd_unitdir}/system/systemd-binfmt.service" -RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" + ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \ + ${systemd_system_unitdir}/systemd-binfmt.service" +RRECOMMENDS:${PN}-binfmt = "kernel-module-binfmt-misc" -RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" +RRECOMMENDS:${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" -FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ +FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ ${datadir}/systemd/gatewayd/browse.html \ " -SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" +SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" -FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ +FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ ${systemd_system_unitdir}/systemd-journal-upload.service \ ${sysconfdir}/systemd/journal-upload.conf \ " -SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service" +SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service" -FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ +FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ ${sysconfdir}/systemd/journal-remote.conf \ ${systemd_system_unitdir}/systemd-journal-remote.service \ ${systemd_system_unitdir}/systemd-journal-remote.socket \ " -SYSTEMD_SERVICE_${PN}-remote = "systemd-journal-remote.socket" +SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket" -FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ +FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ + ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ ${base_bindir}/machinectl \ ${bindir}/systemd-nspawn \ ${nonarch_libdir}/systemd/import-pubring.gpg \ ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \ ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \ ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \ ${systemd_system_unitdir}/machine.slice \ ${systemd_system_unitdir}/machines.target \ ${systemd_system_unitdir}/org.freedesktop.import1.busname \ @@ -437,6 +490,7 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c ${rootlibexecdir}/systemd/systemd-machined \ ${rootlibexecdir}/systemd/systemd-pull \ ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ + ${exec_prefix}/lib/tmpfiles.d/README \ ${systemd_system_unitdir}/systemd-nspawn@.service \ ${libdir}/libnss_mymachines.so.2 \ ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ @@ -447,16 +501,22 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ " -RRECOMMENDS_${PN}-container += "\ - ${PN}-journal-upload \ - ${PN}-journal-remote \ +# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox. +RRECOMMENDS:${PN}-container += "\ ${PN}-journal-gatewayd \ + ${PN}-journal-remote \ + ${PN}-journal-upload \ + kernel-module-dm-mod \ + kernel-module-loop \ + kernel-module-tun \ + tar \ " -FILES_${PN}-extra-utils = "\ +FILES:${PN}-extra-utils = "\ ${base_bindir}/systemd-escape \ ${base_bindir}/systemd-inhibit \ ${bindir}/systemd-detect-virt \ + ${bindir}/systemd-dissect \ ${bindir}/systemd-path \ ${bindir}/systemd-run \ ${bindir}/systemd-cat \ @@ -464,38 +524,58 @@ FILES_${PN}-extra-utils = "\ ${bindir}/systemd-cgls \ ${bindir}/systemd-cgtop \ ${bindir}/systemd-stdio-bridge \ + ${bindir}/systemd-sysext \ ${base_bindir}/systemd-ask-password \ ${base_bindir}/systemd-tty-ask-password-agent \ - ${systemd_unitdir}/system/systemd-ask-password-console.path \ - ${systemd_unitdir}/system/systemd-ask-password-console.service \ - ${systemd_unitdir}/system/systemd-ask-password-wall.path \ - ${systemd_unitdir}/system/systemd-ask-password-wall.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \ - ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.service \ + ${systemd_system_unitdir}/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/systemd-ask-password-wall.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \ ${rootlibexecdir}/systemd/systemd-resolve-host \ ${rootlibexecdir}/systemd/systemd-ac-power \ ${rootlibexecdir}/systemd/systemd-activate \ ${rootlibexecdir}/systemd/systemd-bus-proxyd \ - ${systemd_unitdir}/system/systemd-bus-proxyd.service \ - ${systemd_unitdir}/system/systemd-bus-proxyd.socket \ + ${systemd_system_unitdir}/systemd-bus-proxyd.service \ + ${systemd_system_unitdir}/systemd-bus-proxyd.socket \ ${rootlibexecdir}/systemd/systemd-socket-proxyd \ ${rootlibexecdir}/systemd/systemd-reply-password \ ${rootlibexecdir}/systemd/systemd-sleep \ ${rootlibexecdir}/systemd/system-sleep \ - ${systemd_unitdir}/system/systemd-hibernate.service \ - ${systemd_unitdir}/system/systemd-hybrid-sleep.service \ - ${systemd_unitdir}/system/systemd-suspend.service \ - ${systemd_unitdir}/system/sleep.target \ + ${systemd_system_unitdir}/systemd-hibernate.service \ + ${systemd_system_unitdir}/systemd-hybrid-sleep.service \ + ${systemd_system_unitdir}/systemd-suspend.service \ + ${systemd_system_unitdir}/sleep.target \ ${rootlibexecdir}/systemd/systemd-initctl \ - ${systemd_unitdir}/system/systemd-initctl.service \ - ${systemd_unitdir}/system/systemd-initctl.socket \ - ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \ + ${systemd_system_unitdir}/systemd-initctl.service \ + ${systemd_system_unitdir}/systemd-initctl.socket \ + ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \ ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ ${rootlibexecdir}/systemd/systemd-cgroups-agent \ " -FILES_${PN} = " ${base_bindir}/* \ +FILES:${PN}-udev-rules = "\ + ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \ + ${rootlibexecdir}/udev/rules.d/71-seat.rules \ + ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \ + ${rootlibexecdir}/udev/rules.d/99-systemd.rules \ +" + +CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \ + ${sysconfdir}/systemd/journald.conf \ + ${sysconfdir}/systemd/logind.conf \ + ${sysconfdir}/systemd/networkd.conf \ + ${sysconfdir}/systemd/pstore.conf \ + ${sysconfdir}/systemd/resolved.conf \ + ${sysconfdir}/systemd/sleep.conf \ + ${sysconfdir}/systemd/system.conf \ + ${sysconfdir}/systemd/timesyncd.conf \ + ${sysconfdir}/systemd/user.conf \ +" + +FILES:${PN} = " ${base_bindir}/* \ ${base_sbindir}/shutdown \ ${base_sbindir}/halt \ ${base_sbindir}/poweroff \ @@ -512,13 +592,17 @@ FILES_${PN} = " ${base_bindir}/* \ ${sysconfdir}/dbus-1/ \ ${sysconfdir}/modules-load.d/ \ ${sysconfdir}/pam.d/ \ + ${sysconfdir}/profile.d/ \ ${sysconfdir}/sysctl.d/ \ ${sysconfdir}/systemd/ \ ${sysconfdir}/tmpfiles.d/ \ ${sysconfdir}/xdg/ \ ${sysconfdir}/init.d/README \ ${sysconfdir}/resolv-conf.systemd \ + ${sysconfdir}/X11/xinit/xinitrc.d/* \ ${rootlibexecdir}/systemd/* \ + ${libdir}/pam.d \ + ${nonarch_libdir}/pam.d \ ${systemd_unitdir}/* \ ${base_libdir}/security/*.so \ /cgroup \ @@ -530,7 +614,7 @@ FILES_${PN} = " ${base_bindir}/* \ ${bindir}/resolvectl \ ${bindir}/timedatectl \ ${bindir}/bootctl \ - ${bindir}/kernel-install \ + ${bindir}/oomctl \ ${exec_prefix}/lib/tmpfiles.d/*.conf \ ${exec_prefix}/lib/systemd \ ${exec_prefix}/lib/modules-load.d \ @@ -538,51 +622,56 @@ FILES_${PN} = " ${base_bindir}/* \ ${exec_prefix}/lib/sysusers.d \ ${exec_prefix}/lib/environment.d \ ${localstatedir} \ - ${nonarch_base_libdir}/udev/rules.d/70-uaccess.rules \ - ${nonarch_base_libdir}/udev/rules.d/71-seat.rules \ - ${nonarch_base_libdir}/udev/rules.d/73-seat-late.rules \ - ${nonarch_base_libdir}/udev/rules.d/99-systemd.rules \ - ${nonarch_base_libdir}/modprobe.d/systemd.conf \ + ${rootlibexecdir}/modprobe.d/systemd.conf \ + ${rootlibexecdir}/modprobe.d/README \ ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \ ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \ " -FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" +FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" -RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV}) util-linux-agetty util-linux-fsck" -RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" -RDEPENDS_${PN} += "volatile-binds update-rc.d systemd-conf" +RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck" +RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" +RDEPENDS:${PN} += "volatile-binds" -RRECOMMENDS_${PN} += "systemd-extra-utils \ - systemd-compat-units udev-hwdb \ +RRECOMMENDS:${PN} += "systemd-extra-utils \ + udev-hwdb \ e2fsprogs-e2fsck \ - kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ + kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ os-release \ + systemd-conf \ " -INSANE_SKIP_${PN} += "dev-so libdir" -INSANE_SKIP_${PN}-dbg += "libdir" -INSANE_SKIP_${PN}-doc += " libdir" +INSANE_SKIP:${PN} += "dev-so libdir" +INSANE_SKIP:${PN}-dbg += "libdir" +INSANE_SKIP:${PN}-doc += " libdir" +INSANE_SKIP:libsystemd-shared += "libdir" -PACKAGES =+ "udev udev-hwdb" +FILES:libsystemd-shared = "${rootlibexecdir}/systemd/libsystemd-shared*.so" -RPROVIDES_udev = "hotplug" +RPROVIDES:udev = "hotplug" -RDEPENDS_udev-hwdb += "udev" +RDEPENDS:udev-hwdb += "udev" -FILES_udev += "${base_sbindir}/udevd \ +FILES:udev += "${base_sbindir}/udevd \ + ${rootlibexecdir}/systemd/network/99-default.link \ ${rootlibexecdir}/systemd/systemd-udevd \ ${rootlibexecdir}/udev/accelerometer \ ${rootlibexecdir}/udev/ata_id \ ${rootlibexecdir}/udev/cdrom_id \ ${rootlibexecdir}/udev/collect \ + ${rootlibexecdir}/udev/dmi_memory_id \ + ${rootlibexecdir}/udev/fido_id \ ${rootlibexecdir}/udev/findkeyboards \ ${rootlibexecdir}/udev/keyboard-force-release.sh \ ${rootlibexecdir}/udev/keymap \ @@ -590,28 +679,77 @@ FILES_udev += "${base_sbindir}/udevd \ ${rootlibexecdir}/udev/scsi_id \ ${rootlibexecdir}/udev/v4l_id \ ${rootlibexecdir}/udev/keymaps \ - ${rootlibexecdir}/udev/rules.d/*.rules \ + ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \ + ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \ + ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ + ${rootlibexecdir}/udev/rules.d/60-block.rules \ + ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ + ${rootlibexecdir}/udev/rules.d/60-drm.rules \ + ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ + ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-input-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \ + ${rootlibexecdir}/udev/rules.d/60-sensor.rules \ + ${rootlibexecdir}/udev/rules.d/60-serial.rules \ + ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \ + ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \ + ${rootlibexecdir}/udev/rules.d/70-camera.rules \ + ${rootlibexecdir}/udev/rules.d/70-joystick.rules \ + ${rootlibexecdir}/udev/rules.d/70-memory.rules \ + ${rootlibexecdir}/udev/rules.d/70-mouse.rules \ + ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ + ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \ + ${rootlibexecdir}/udev/rules.d/75-net-description.rules \ + ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \ + ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \ + ${rootlibexecdir}/udev/rules.d/80-drivers.rules \ + ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ + ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \ + ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ + ${rootlibexecdir}/udev/rules.d/README \ ${sysconfdir}/udev \ ${sysconfdir}/init.d/systemd-udevd \ - ${systemd_unitdir}/system/*udev* \ - ${systemd_unitdir}/system/*.wants/*udev* \ + ${systemd_system_unitdir}/*udev* \ + ${systemd_system_unitdir}/*.wants/*udev* \ + ${base_bindir}/systemd-hwdb \ ${base_bindir}/udevadm \ + ${base_sbindir}/udevadm \ ${libexecdir}/${MLPREFIX}udevadm \ ${datadir}/bash-completion/completions/udevadm \ + ${systemd_system_unitdir}/systemd-hwdb-update.service \ " -FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d" +FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ + " + +RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" INITSCRIPT_PACKAGES = "udev" -INITSCRIPT_NAME_udev = "systemd-udevd" -INITSCRIPT_PARAMS_udev = "start 03 S ." +INITSCRIPT_NAME:udev = "systemd-udevd" +INITSCRIPT_PARAMS:udev = "start 03 S ." python __anonymous() { if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") + + if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d): + bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]") + + if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d): + bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]") +} + +python do_warn_musl() { + if d.getVar('TCLIBC') == "musl": + bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.") } +addtask warn_musl before do_configure -ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel resolv-conf" +ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" @@ -637,27 +775,27 @@ ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" ALTERNATIVE_PRIORITY[runlevel] ?= "300" -pkg_postinst_${PN} () { +pkg_postinst:${PN}:libc-glibc () { sed -e '/^hosts:/s/\s*\<myhostname\>//' \ -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ -i $D${sysconfdir}/nsswitch.conf } -pkg_prerm_${PN} () { +pkg_prerm:${PN}:libc-glibc () { sed -e '/^hosts:/s/\s*\<myhostname\>//' \ -e '/^hosts:/s/\s*myhostname//' \ -i $D${sysconfdir}/nsswitch.conf } PACKAGE_WRITE_DEPS += "qemu-native" -pkg_postinst_udev-hwdb () { +pkg_postinst:udev-hwdb () { if test -n "$D"; then - $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} + $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" else udevadm hwdb --update fi } -pkg_prerm_udev-hwdb () { +pkg_prerm:udev-hwdb () { rm -f $D${sysconfdir}/udev/hwdb.bin } |