diff options
author | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
---|---|---|
committer | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
commit | 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch) | |
tree | cd70a267a5ef105ba32f200aa088e281fbd85747 /external/poky/meta/recipes-core/systemd | |
parent | 4204309872da5cb401cbb2729d9e2d4869a87f42 (diff) |
basesystem-jjsandbox/ToshikazuOhiwa/master-jj
recipes
Diffstat (limited to 'external/poky/meta/recipes-core/systemd')
77 files changed, 2591 insertions, 3452 deletions
diff --git a/external/poky/meta/recipes-core/systemd/systemd-boot_239.bb b/external/poky/meta/recipes-core/systemd/systemd-boot_244.3.bb index 2450d52c..f92c6398 100644 --- a/external/poky/meta/recipes-core/systemd/systemd-boot_239.bb +++ b/external/poky/meta/recipes-core/systemd/systemd-boot_244.3.bb @@ -1,26 +1,31 @@ require systemd.inc FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" -DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" +require conf/image-uefi.conf -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 \ - " +DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" inherit meson pkgconfig gettext inherit deploy -EFI_CC ?= "${CC}" +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 +} + EXTRA_OEMESON += "-Defi=true \ -Dgnu-efi=true \ -Defi-includedir=${STAGING_INCDIR}/efi \ - -Defi-ldsdir=${STAGING_LIBDIR} \ -Defi-libdir=${STAGING_LIBDIR} \ + -Defi-ld=${@ d.getVar('LD').split()[0]} \ -Dman=false \ - -Defi-cc='${EFI_CC}' \ - -Defi-ld='${LD}' \ + --cross-file ${WORKDIR}/meson-${PN}.cross \ " # install to the image as boot*.efi if its the EFI_PROVIDER, @@ -30,16 +35,13 @@ 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" + 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} = "/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE}" +FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" RDEPENDS_${PN} += "virtual/systemd-bootconf" @@ -58,10 +60,8 @@ do_compile() { } 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} + install -d ${D}${EFI_FILES_PATH} + install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} } do_deploy () { diff --git a/external/poky/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/external/poky/meta/recipes-core/systemd/systemd-bootconf_1.00.bb index e9c24664..d13b8c51 100644 --- a/external/poky/meta/recipes-core/systemd/systemd-bootconf_1.00.bb +++ b/external/poky/meta/recipes-core/systemd/systemd-bootconf_1.00.bb @@ -3,6 +3,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384 SUMMARY = "Basic systemd-boot configuration files" RPROVIDES_${PN} += "virtual/systemd-bootconf" +PACKAGE_ARCH = "${MACHINE_ARCH}" inherit systemd-boot-cfg diff --git a/external/poky/meta/recipes-core/systemd/systemd-compat-units.bb b/external/poky/meta/recipes-core/systemd/systemd-compat-units.bb index d228a51c..361dc1cb 100644 --- a/external/poky/meta/recipes-core/systemd/systemd-compat-units.bb +++ b/external/poky/meta/recipes-core/systemd/systemd-compat-units.bb @@ -8,7 +8,9 @@ PACKAGE_WRITE_DEPS += "systemd-systemctl-native" S = "${WORKDIR}" -inherit distro_features_check +inherit features_check + +INHIBIT_DEFAULT_DEPS = "1" ALLOW_EMPTY_${PN} = "1" diff --git a/external/poky/meta/recipes-core/systemd/systemd-conf.bb b/external/poky/meta/recipes-core/systemd/systemd-conf.bb deleted file mode 100644 index 9bb27fd9..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd-conf/journald.conf b/external/poky/meta/recipes-core/systemd/systemd-conf/journald.conf new file mode 100644 index 00000000..fd4d969f --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd-conf/journald.conf @@ -0,0 +1,3 @@ +[Journal] +ForwardToSyslog=yes +RuntimeMaxUse=64M diff --git a/external/poky/meta/recipes-core/systemd/systemd-conf/logind.conf b/external/poky/meta/recipes-core/systemd/systemd-conf/logind.conf new file mode 100644 index 00000000..bf7f6920 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd-conf/logind.conf @@ -0,0 +1,2 @@ +[Login] +KillUserProcesses=yes diff --git a/external/poky/meta/recipes-core/systemd/systemd-conf/system.conf b/external/poky/meta/recipes-core/systemd/systemd-conf/system.conf new file mode 100644 index 00000000..554cab26 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd-conf/system.conf @@ -0,0 +1,2 @@ +[Manager] +DefaultMemoryAccounting=yes diff --git a/external/poky/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall b/external/poky/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall new file mode 100644 index 00000000..741be27c --- /dev/null +++ b/external/poky/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/external/poky/meta/recipes-core/systemd/systemd-conf/wired.network b/external/poky/meta/recipes-core/systemd/systemd-conf/wired.network new file mode 100644 index 00000000..ff807ba3 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd-conf/wired.network @@ -0,0 +1,10 @@ +[Match] +Name=en* eth* +KernelCommandLine=!nfsroot + +[Network] +DHCP=yes + +[DHCP] +RouteMetric=10 +ClientIdentifier=mac diff --git a/external/poky/meta/recipes-core/systemd/systemd-conf_244.3.bb b/external/poky/meta/recipes-core/systemd/systemd-conf_244.3.bb new file mode 100644 index 00000000..d9ec023b --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd-conf_244.3.bb @@ -0,0 +1,38 @@ +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" + +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 + install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network +} + +# 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 + + # Do not install wired.network for qemu bsps + rm -rf ${D}${systemd_unitdir}/network +} + +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/external/poky/meta/recipes-core/systemd/systemd-serialgetty.bb b/external/poky/meta/recipes-core/systemd/systemd-serialgetty.bb index 65a931f4..044c6c5b 100644 --- a/external/poky/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/external/poky/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -12,7 +12,7 @@ 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() { diff --git a/external/poky/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/external/poky/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service index e8b027e9..549d5660 100644 --- a/external/poky/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service +++ b/external/poky/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" ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM Type=idle Restart=always -RestartSec=0 UtmpIdentifier=%I TTYPath=/dev/%I TTYReset=yes diff --git a/external/poky/meta/recipes-core/systemd/systemd-systemctl/systemctl b/external/poky/meta/recipes-core/systemd/systemd-systemctl/systemctl index 2bc64896..990de1ab 100755 --- a/external/poky/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/external/poky/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -1,196 +1,321 @@ -#!/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): + pass + + +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): + # 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'): + SystemdUnit(self.root, also).enable() + + 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: + SystemdUnit(root, service).enable() + + # 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=1, 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[0] + if command == "mask": + for service in args.service: + SystemdUnit(root, service).mask() + elif command == "enable": + for service in args.service: + SystemdUnit(root, service).enable() + 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/external/poky/meta/recipes-core/systemd/systemd.inc b/external/poky/meta/recipes-core/systemd/systemd.inc index 736e0a0e..e73b397b 100644 --- a/external/poky/meta/recipes-core/systemd/systemd.inc +++ b/external/poky/meta/recipes-core/systemd/systemd.inc @@ -14,8 +14,8 @@ LICENSE = "GPLv2 & LGPLv2.1" 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 = "b7ed902b2394f94e7f1fbe6c3194b5cd9a9429e6" +SRCBRANCH = "v244-stable" +SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" S = "${WORKDIR}/git" diff --git a/external/poky/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch deleted file mode 100644 index e2e19ba0..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch deleted file mode 100644 index d745800c..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-Revert-sysctl.d-request-ECN-on-both-in-and-outgoing-.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-Revert-sysctl.d-request-ECN-on-both-in-and-outgoing-.patch deleted file mode 100644 index 7fd6d018..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-Use-getenv-when-secure-versions-are-not-available.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-Use-getenv-when-secure-versions-are-not-available.patch deleted file mode 100644 index 03f6ead1..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch index e24e7f83..6eaaec71 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch +++ b/external/poky/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 c73a87871df31b4f8d96c9d443759c6f702935f6 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,7 +26,7 @@ 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 6a3a0d0dea22..bbb1b78618c3 100644 --- a/units/meson.build +++ b/units/meson.build @@ -46,8 +46,7 @@ units = [ @@ -43,11 +46,11 @@ index e4ac6ced6..698734e44 100644 - ['systemd-binfmt.service', 'ENABLE_BINFMT', - 'sysinit.target.wants/'], + ['systemd-binfmt.service', 'ENABLE_BINFMT'], - ['systemd-coredump@.service', 'ENABLE_COREDUMP'], - ['systemd-exit.service', ''], - ['systemd-firstboot.service', 'ENABLE_FIRSTBOOT', + ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'], + ['systemd-boot-check-no-failures.service', ''], + ['systemd-boot-system-token.service', 'ENABLE_EFI', diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount -index 30a6bc991..4231f3b70 100644 +index 30a6bc991844..4231f3b70fe9 100644 --- a/units/proc-sys-fs-binfmt_misc.automount +++ b/units/proc-sys-fs-binfmt_misc.automount @@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ @@ -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 0c0f26451b67..763c4c466c16 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 + After=proc-sys-fs-binfmt_misc.mount Before=sysinit.target shutdown.target - ConditionPathIsReadWrite=/proc/sys/ -@@ -28,3 +29,6 @@ Type=oneshot +@@ -29,3 +30,6 @@ Type=oneshot RemainAfterExit=yes ExecStart=@rootlibexecdir@/systemd-binfmt TimeoutSec=90s + +[Install] +WantedBy=sysinit.target --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0001-chown-recursive-let-s-rework-the-recursive-logic-to-.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-chown-recursive-let-s-rework-the-recursive-logic-to-.patch deleted file mode 100644 index 9d350eba..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-core-when-deserializing-state-always-use-read_line-L.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-core-when-deserializing-state-always-use-read_line-L.patch deleted file mode 100644 index 215d6807..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-dhcp6-make-sure-we-have-enough-space-for-the-DHCP6-o.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-dhcp6-make-sure-we-have-enough-space-for-the-DHCP6-o.patch deleted file mode 100644 index 0c912f25..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 00000000..f1c7181e --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch @@ -0,0 +1,411 @@ +From f4a0caaea346b70cf5064f9159a53a1b8020071e 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/smack-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/login/logind-dbus.c | 2 +- + src/nspawn/nspawn-cgroup.c | 2 +- + src/nspawn/nspawn.c | 6 +++--- + src/shared/cgroup-setup.c | 4 ++-- + src/shared/sysctl-util.c | 2 +- + src/sleep/sleep.c | 8 ++++---- + src/udev/udevadm-trigger.c | 2 +- + src/udev/udevd.c | 2 +- + src/vconsole/vconsole-setup.c | 2 +- + 18 files changed, 35 insertions(+), 35 deletions(-) + +diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c +index a5141f4cbedd..04c06e7a55cb 100644 +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -739,7 +739,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + 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)) +@@ -757,7 +757,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + 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; + +@@ -784,7 +784,7 @@ int cg_uninstall_release_agent(const char *controller) { + 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; + +@@ -794,7 +794,7 @@ int cg_uninstall_release_agent(const char *controller) { + 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; + +@@ -1650,7 +1650,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri + 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) { +diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c +index da7e836f143e..2138f20bcc03 100644 +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) { + * 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; + +diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c +index da9a2139d31a..5e91f5b8f5d9 100644 +--- a/src/basic/smack-util.c ++++ b/src/basic/smack-util.c +@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { + 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; + +diff --git a/src/basic/util.c b/src/basic/util.c +index 2b3b3918a32f..aff8d0fcd473 100644 +--- a/src/basic/util.c ++++ b/src/basic/util.c +@@ -267,7 +267,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"); + } +diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c +index 7ff844c78c3a..5c5721d7c2f7 100644 +--- a/src/binfmt/binfmt.c ++++ b/src/binfmt/binfmt.c +@@ -47,7 +47,7 @@ static int delete_rule(const char *rule) { + if (!fn) + return log_oom(); + +- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(fn, "-1", 0); + } + + static int apply_rule(const char *rule) { +@@ -55,7 +55,7 @@ static int apply_rule(const char *rule) { + + (void) delete_rule(rule); + +- 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, "Failed to add binary format: %m"); + +@@ -212,7 +212,7 @@ static int run(int argc, char *argv[]) { + } + + /* Flush out all rules */ +- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + + STRV_FOREACH(f, files) { + k = apply_file(*f, true); +diff --git a/src/core/main.c b/src/core/main.c +index c24b696b1663..195be7d2df0d 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1303,7 +1303,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, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); ++ 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, + "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); +@@ -1527,7 +1527,7 @@ static void initialize_core_pattern(bool skip_setup) { + 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); + } +diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c +index 4427397f2715..8aeb5c829513 100644 +--- a/src/core/smack-setup.c ++++ b/src/core/smack-setup.c +@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) { + } + + #ifdef 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 +diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c +index 17e7cd1a009b..87a766771663 100644 +--- 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; +diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c +index f35612fe12bc..20351bf7fa70 100644 +--- a/src/libsystemd/sd-device/sd-device.c ++++ b/src/libsystemd/sd-device/sd-device.c +@@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, + 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) { + if (r == -ELOOP) + return -EINVAL; +diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c +index 69b59948786f..b4973c596d48 100644 +--- a/src/login/logind-dbus.c ++++ b/src/login/logind-dbus.c +@@ -1322,7 +1322,7 @@ static int trigger_device(Manager *m, sd_device *d) { + if (!t) + return -ENOMEM; + +- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); ++ (void) write_string_file(t, "change", 0); + } + + return 0; +diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c +index f5048d9473cb..b6383ab5c97e 100644 +--- a/src/nspawn/nspawn-cgroup.c ++++ b/src/nspawn/nspawn-cgroup.c +@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { + 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; +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 873a76596f0b..4e496548bb94 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -2425,7 +2425,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" +@@ -3633,13 +3633,13 @@ static int setup_uid_map(pid_t pid) { + + xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); + xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); +- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, line, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + + /* We always assign the same UID and GID ranges */ + xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, line, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c +index e8398cbde5ba..ba682ec0c9e7 100644 +--- a/src/shared/cgroup-setup.c ++++ b/src/shared/cgroup-setup.c +@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { + + 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; + +@@ -817,7 +817,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); +diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c +index 12fb3ef7ea0e..132ac847c091 100644 +--- a/src/shared/sysctl-util.c ++++ b/src/shared/sysctl-util.c +@@ -87,7 +87,7 @@ int sysctl_write_ip_property(int af, const char *ifname, 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); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); + } + + int sysctl_read(const char *property, char **content) { +diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c +index 89b80367f8f4..33dbb21364d0 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -45,7 +45,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca + assert(hibernate_location->swap); + assert(hibernate_location->resume); + +- r = write_string_file("/sys/power/resume", hibernate_location->resume, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", hibernate_location->resume, 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, hibernate_location->resume); +@@ -72,7 +72,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca + } + + xsprintf(offset_str, "%" PRIu64, hibernate_location->resume_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); +@@ -89,7 +89,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; + +@@ -108,7 +108,7 @@ static int write_state(FILE **f, char **states) { + 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); +diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c +index 60c68b5029cf..fdca03d3d42c 100644 +--- a/src/udev/udevadm-trigger.c ++++ b/src/udev/udevadm-trigger.c +@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se + if (!filename) + return log_oom(); + +- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(filename, action, 0); + if (r < 0) { + bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS); + +diff --git a/src/udev/udevd.c b/src/udev/udevd.c +index 7678331897f5..6871cde7aa65 100644 +--- a/src/udev/udevd.c ++++ b/src/udev/udevd.c +@@ -1089,7 +1089,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) { + + filename = strjoina(syspath, "/uevent"); + log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath); +- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(filename, "change", 0); + if (r < 0) + return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename); + return 0; +diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c +index 9d706085fb47..30dcfa86f4d0 100644 +--- a/src/vconsole/vconsole-setup.c ++++ b/src/vconsole/vconsole-setup.c +@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { + 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)); + diff --git a/external/poky/meta/recipes-core/systemd/systemd/0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch deleted file mode 100644 index ba08e345..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-meson-rename-Ddebug-to-Ddebug-extra.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-meson-rename-Ddebug-to-Ddebug-extra.patch deleted file mode 100644 index d6d305cb..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch deleted file mode 100644 index 45c9b5b1..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-sysctl-Don-t-pass-null-directive-argument-to-s.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-sysctl-Don-t-pass-null-directive-argument-to-s.patch deleted file mode 100644 index 0538c7bb..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0001-timesync-changes-type-of-drift_freq-to-int64_t.patch b/external/poky/meta/recipes-core/systemd/systemd/0001-timesync-changes-type-of-drift_freq-to-int64_t.patch deleted file mode 100644 index 8d395c2f..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0002-core-Fix-use-after-free-case-in-load_from_path.patch b/external/poky/meta/recipes-core/systemd/systemd/0002-core-Fix-use-after-free-case-in-load_from_path.patch deleted file mode 100644 index 4da96e29..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/external/poky/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch index 8e0d669e..6b85ff0f 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch @@ -1,31 +1,100 @@ -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 49501c80d32c1bc5ecb07f40c324feb82af0b057 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> + --- - 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/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++----- + src/shared/format-table.c | 36 ++++++++++++++++++++---------- + 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 +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index e029f8646eb0..27d68b341cf3 100644 +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -54,17 +54,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn + int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ + qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ + }) +- +-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_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]), (__compar_d_fn_t) _func_, userdata); \ +- }) +diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c +index c83575c7c876..72f8f3a05048 100644 +--- a/src/libsystemd/sd-hwdb/hwdb-util.c ++++ b/src/libsystemd/sd-hwdb/hwdb-util.c +@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) { + + DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); + +-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 *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, +@@ -158,7 +162,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + .value_off = v, + }; + +- 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. */ +@@ -184,7 +191,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + .line_number = line_number, + }; + node->values_count++; +- 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; } --static int table_data_compare(const void *x, const void *y, void *userdata) { +diff --git a/src/shared/format-table.c b/src/shared/format-table.c +index 4617ae8badc4..17d6b9616256 100644 +--- a/src/shared/format-table.c ++++ b/src/shared/format-table.c +@@ -1109,31 +1109,33 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t + return CMP(index_a, index_b); + } + +-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; ++ const size_t *a = x, *b=y; size_t i; int r; @@ -57,11 +126,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) { +- 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 */ +@@ -1533,7 +1535,12 @@ int table_print(Table *t, FILE *f) { for (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 +145,17 @@ 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_); \ - }) - --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); --} - - /** - * 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) { - - DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); - --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, -@@ -166,7 +165,10 @@ 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) { - /* 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; - 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; - } - -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, - }; +@@ -1997,7 +2004,12 @@ int table_to_json(Table *t, JsonVariant **ret) { + for (i = 0; i < n_rows; i++) + sorted[i] = i * t->n_columns; -- 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; - } +- 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; + } --- -2.18.0 - + if (t->display_map) diff --git a/external/poky/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch b/external/poky/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch new file mode 100644 index 00000000..ba7424d8 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch @@ -0,0 +1,29 @@ +From 106922335ec502bcb4451c54a89be49f88fa54de 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] Include sys/wait.h + +Fixes: +src/login/logind-brightness.c:158:85: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'? + 158 | r = sd_event_add_child(w->manager->event, &w->child_event_source, w->child, WEXITED, on_brightness_writer_exit, w); + | ^~~~~~~ + +Upstream-Status: Pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- + src/login/logind-brightness.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c +index 3f4b65e1fdf1..5af7e3d5ce3f 100644 +--- a/src/login/logind-brightness.c ++++ b/src/login/logind-brightness.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <sys/wait.h> + #include "bus-util.h" + #include "device-util.h" + #include "hash-funcs.h" diff --git a/external/poky/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/external/poky/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch deleted file mode 100644 index 1d7f5230..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch b/external/poky/meta/recipes-core/systemd/systemd/0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch deleted file mode 100644 index 115fb33c..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch b/external/poky/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch index 6c595ae7..c6204786 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch +++ b/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/external/poky/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch new file mode 100644 index 00000000..14048951 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch @@ -0,0 +1,76 @@ +From 233de872b9b033ec842c2135152d2e006ac44c16 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/journal/catalog.c | 1 + + 4 files changed, 12 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index bf8a6caa1b46..c487e65e7bde 100644 +--- 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 +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index 27d68b341cf3..307ea4ac0e8e 100644 +--- 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" + + void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, + __compar_d_fn_t compar, void *arg); +diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c +index 128674327362..09ccd613e32c 100644 +--- a/src/core/kmod-setup.c ++++ b/src/core/kmod-setup.c +@@ -10,6 +10,7 @@ + #include "kmod-setup.h" + #include "macro.h" + #include "string-util.h" ++#include "missing_type.h" + + #if HAVE_KMOD + #include "module-util.h" +diff --git a/src/journal/catalog.c b/src/journal/catalog.c +index 70b2c8b46c4e..d574a64586f1 100644 +--- a/src/journal/catalog.c ++++ b/src/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/external/poky/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch b/external/poky/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch new file mode 100644 index 00000000..538a99c7 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch @@ -0,0 +1,31 @@ +From 082d2eb2a65525890a913723764e67a36ee75384 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] Include signal.h + +Fixes several signal set related errors: +src/basic/copy.c:92:19: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration] +src/basic/copy.c:93:19: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration] +src/basic/copy.c:93:34: error: 'SIGINT' undeclared (first use in this function) +src/basic/copy.c:95:13: error: implicit declaration of function 'sigtimedwait' [-Werror=implicit-function-declaration] + +Upstream-Status: Pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- + src/basic/copy.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/basic/copy.c b/src/basic/copy.c +index 9028868f696d..5168586fa522 100644 +--- a/src/basic/copy.c ++++ b/src/basic/copy.c +@@ -8,6 +8,7 @@ + #include <sys/sendfile.h> + #include <sys/xattr.h> + #include <unistd.h> ++#include <signal.h> + + #include "alloc-util.h" + #include "btrfs-util.h" diff --git a/external/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/external/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch index 7652a2d8..71e52c49 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch @@ -1,18 +1,21 @@ -From 582af7ec13131dfcc620ed81de7b211914c4cb03 Mon Sep 17 00:00:00 2001 +From 142dcaef0d24a78d3c0c94168b66fdf234497e97 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 +Date: Mon, 25 Feb 2019 14:04:21 +0800 +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/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++ + src/basic/parse-printf-format.h | 57 +++++++ src/basic/stdio-util.h | 2 +- src/journal/journal-send.c | 2 +- 6 files changed, 338 insertions(+), 2 deletions(-) @@ -20,11 +23,11 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> create mode 100644 src/basic/parse-printf-format.h diff --git a/meson.build b/meson.build -index e045b9224..8c16bc979 100644 +index 21d6968abdf4..bab0bf84806c 100644 --- a/meson.build +++ b/meson.build -@@ -598,6 +598,7 @@ foreach header : ['crypt.h', - 'linux/btrfs.h', +@@ -628,6 +628,7 @@ endif + foreach header : ['crypt.h', 'linux/memfd.h', 'linux/vm_sockets.h', + 'printf.h', @@ -32,13 +35,13 @@ index e045b9224..8c16bc979 100644 'valgrind/memcheck.h', 'valgrind/valgrind.h', diff --git a/src/basic/meson.build b/src/basic/meson.build -index 31625b178..0c27528e7 100644 +index f70d1b8bf8a0..4cd57373e10d 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build -@@ -302,6 +302,11 @@ foreach item : [['af', af_list_txt, 'af', ''], +@@ -311,6 +311,11 @@ foreach item : [['af', af_list_txt, 'af', ''], endforeach - basic_sources += [missing_h] + generated_gperf_headers + basic_sources += generated_gperf_headers + +if conf.get('HAVE_PRINTF_H') != 1 + basic_sources += [files('parse-printf-format.c')] @@ -49,7 +52,7 @@ index 31625b178..0c27528e7 100644 '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 +index 000000000000..49437e544540 --- /dev/null +++ b/src/basic/parse-printf-format.c @@ -0,0 +1,273 @@ @@ -328,7 +331,7 @@ index 000000000..49437e544 +} diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h new file mode 100644 -index 000000000..47be7522d +index 000000000000..47be7522d7fa --- /dev/null +++ b/src/basic/parse-printf-format.h @@ -0,0 +1,57 @@ @@ -390,10 +393,10 @@ index 000000000..47be7522d + +#endif /* HAVE_PRINTF_H */ diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h -index 73c03274c..30192cd71 100644 +index c3b9448d4f4f..2937aa13b178 100644 --- a/src/basic/stdio-util.h +++ b/src/basic/stdio-util.h -@@ -1,12 +1,12 @@ +@@ -1,13 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once @@ -403,12 +406,13 @@ 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 +index 912ecef73cce..43ed756bda53 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -2,7 +2,6 @@ @@ -417,16 +421,13 @@ index a0621524a..65bcbcd2e 100644 #include <fcntl.h> -#include <printf.h> #include <stddef.h> - #include <sys/socket.h> #include <sys/un.h> -@@ -21,6 +20,7 @@ + #include <unistd.h> +@@ -20,6 +19,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/external/poky/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch b/external/poky/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch deleted file mode 100644 index 7e37cbc2..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch b/external/poky/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch new file mode 100644 index 00000000..685df01a --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch @@ -0,0 +1,58 @@ +From 6883ffc99168056101c667c6421f8353d5ad675a 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 27812dfd5923..0ab40731ea93 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 a710db5370b8..d1601ad9292d 100644 +--- a/src/test/test-sizeof.c ++++ b/src/test/test-sizeof.c +@@ -1,6 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + +-#include <sched.h> + #include <stdio.h> + #include <string.h> + +@@ -8,6 +7,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/external/poky/meta/recipes-core/systemd/systemd/0005-Make-root-s-home-directory-configurable.patch b/external/poky/meta/recipes-core/systemd/systemd/0005-Make-root-s-home-directory-configurable.patch deleted file mode 100644 index c1370872..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch b/external/poky/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch deleted file mode 100644 index 6d5faf5f..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/external/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 00000000..aa4bb063 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch @@ -0,0 +1,653 @@ +From 9597196234a0ccf30d7f65cf185a8c24cb3158b3 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] + +--- + 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/parse-util.c | 1 + + src/basic/proc-cmdline.c | 1 + + src/basic/procfs-util.c | 1 + + src/basic/selinux-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/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-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/path-lookup.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 + + 48 files changed, 59 insertions(+) + +diff --git a/meson.build b/meson.build +index bab0bf84806c..f4e1736cf09e 100644 +--- a/meson.build ++++ b/meson.build +@@ -517,6 +517,7 @@ foreach ident : [ + #include <unistd.h>'''], + ['get_mempolicy', '''#include <stdlib.h> + #include <unistd.h>'''], ++ ['strndupa' , '''#include <string.h>'''], + ] + + have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 048441429025..01d74ea0ed4e 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -17,6 +17,7 @@ + #include "string-util.h" + #include "strv.h" + #include "util.h" ++#include "missing_stdlib.h" + + static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { + const char *subsystem, *sysname, *value; +diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c +index 54fc6ecf8b20..a5141f4cbedd 100644 +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -37,6 +37,7 @@ + #include "strv.h" + #include "unit-name.h" + #include "user-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; +diff --git a/src/basic/env-util.c b/src/basic/env-util.c +index b8dc98915f81..5049b37594bc 100644 +--- a/src/basic/env-util.c ++++ b/src/basic/env-util.c +@@ -15,6 +15,7 @@ + #include "string-util.h" + #include "strv.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + #define VALID_CHARS_ENV_NAME \ + DIGITS LETTERS \ +diff --git a/src/basic/log.c b/src/basic/log.c +index 17557e1844b2..6cec4d324aab 100644 +--- a/src/basic/log.c ++++ b/src/basic/log.c +@@ -34,6 +34,7 @@ + #include "terminal-util.h" + #include "time-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + #define SNDBUF_SIZE (8*1024*1024) + +diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h +index 188a8d44066a..1e16ec287aad 100644 +--- 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 +diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c +index fa682d4c438e..37902551490a 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_stdlib.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/parse-util.c b/src/basic/parse-util.c +index aec6099c9cc1..744b9b134ce4 100644 +--- a/src/basic/parse-util.c ++++ b/src/basic/parse-util.c +@@ -18,6 +18,7 @@ + #include "process-util.h" + #include "stat-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + + int parse_boolean(const char *v) { + if (!v) +diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c +index d3d99d9a7f90..e0b9efad03a2 100644 +--- 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; +diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c +index 7aaf95bfced2..da7e836f143e 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_stdlib.h" + + int procfs_tasks_get_limit(uint64_t *ret) { + _cleanup_free_ char *value = NULL; +diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c +index f35e760233be..e4b0a8aa445e 100644 +--- a/src/basic/selinux-util.c ++++ b/src/basic/selinux-util.c +@@ -26,6 +26,7 @@ + #include "selinux-util.h" + #include "stdio-util.h" + #include "time-util.h" ++#include "missing_stdlib.h" + + #if HAVE_SELINUX + DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon); +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index bfe2c60da173..d7ef30d2fe52 100644 +--- 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) { + +diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c +index b96e1f927fff..cba979baca3e 100644 +--- a/src/boot/bless-boot.c ++++ b/src/boot/bless-boot.c +@@ -18,6 +18,7 @@ + #include "util.h" + #include "verbs.h" + #include "virt.h" ++#include "missing_stdlib.h" + + static char **arg_path = NULL; + +diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c +index 27dc9e43c3e2..b1a83023600b 100644 +--- a/src/core/dbus-cgroup.c ++++ b/src/core/dbus-cgroup.c +@@ -15,6 +15,7 @@ + #include "fileio.h" + #include "limits-util.h" + #include "path-util.h" ++#include "missing_stdlib.h" + + BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); + +diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c +index 1d0bc1ede3cb..313654913345 100644 +--- a/src/core/dbus-execute.c ++++ b/src/core/dbus-execute.c +@@ -41,6 +41,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); +diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c +index 7862beaacb6d..3b1ea53a5f0d 100644 +--- a/src/core/dbus-util.c ++++ b/src/core/dbus-util.c +@@ -7,6 +7,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, +diff --git a/src/core/execute.c b/src/core/execute.c +index abc164ff5bef..f04b8ba05002 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -88,6 +88,7 @@ + #include "unit.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) +diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c +index 09ccd613e32c..f4e64fa283e9 100644 +--- a/src/core/kmod-setup.c ++++ b/src/core/kmod-setup.c +@@ -11,6 +11,7 @@ + #include "macro.h" + #include "string-util.h" + #include "missing_type.h" ++#include "missing_stdlib.h" + + #if HAVE_KMOD + #include "module-util.h" +diff --git a/src/core/service.c b/src/core/service.c +index 49ad166c2604..c3b14067e201 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -41,6 +41,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, +diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c +index 35885dfb47c4..bb9f0660a6a0 100644 +--- 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 */ +diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c +index ac2bf648d2af..06c86f0201af 100644 +--- a/src/journal-remote/journal-remote-main.c ++++ b/src/journal-remote/journal-remote-main.c +@@ -21,6 +21,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" +diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c +index 95b6bfee172a..e0bcfb9d4233 100644 +--- a/src/journal/journalctl.c ++++ b/src/journal/journalctl.c +@@ -68,6 +68,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) + +diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c +index eb029e445326..8da2c5d51a75 100644 +--- a/src/libsystemd/sd-bus/bus-message.c ++++ b/src/libsystemd/sd-bus/bus-message.c +@@ -21,6 +21,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); + +diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c +index ae643cacc740..f766e235206d 100644 +--- a/src/libsystemd/sd-bus/bus-objects.c ++++ b/src/libsystemd/sd-bus/bus-objects.c +@@ -13,6 +13,7 @@ + #include "set.h" + #include "string-util.h" + #include "strv.h" ++#include "missing_stdlib.h" + + static int node_vtable_get_userdata( + sd_bus *bus, +diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c +index 18d30d010a20..be2ab703f8ed 100644 +--- 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) + +diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c +index 058492a83eec..54c896f572b9 100644 +--- a/src/libsystemd/sd-bus/sd-bus.c ++++ b/src/libsystemd/sd-bus/sd-bus.c +@@ -41,6 +41,7 @@ + #include "process-util.h" + #include "string-util.h" + #include "strv.h" ++#include "missing_stdlib.h" + + #define log_debug_bus_message(m) \ + do { \ +diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c +index 8de0a859ee94..58044b6ba908 100644 +--- a/src/libsystemd/sd-bus/test-bus-benchmark.c ++++ b/src/libsystemd/sd-bus/test-bus-benchmark.c +@@ -14,6 +14,7 @@ + #include "missing_resource.h" + #include "time-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + #define MAX_SIZE (2*1024*1024) + +diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c +index 519dd0d188cf..a8f536915bb2 100644 +--- a/src/locale/keymap-util.c ++++ b/src/locale/keymap-util.c +@@ -21,6 +21,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); +diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c +index aa6e5ea7aca8..c439c21b2872 100644 +--- a/src/login/pam_systemd.c ++++ b/src/login/pam_systemd.c +@@ -28,6 +28,7 @@ + #include "hostname-util.h" + #include "login-util.h" + #include "macro.h" ++#include "missing_stdlib.h" + #include "parse-util.h" + #include "path-util.h" + #include "process-util.h" +diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +index 81afa9530762..2c5328f97c63 100644 +--- 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 +diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c +index 5fb5b49bbcc3..785ccc2da307 100644 +--- a/src/nspawn/nspawn-settings.c ++++ b/src/nspawn/nspawn-settings.c +@@ -16,6 +16,7 @@ + #include "strv.h" + #include "user-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + Settings *settings_new(void) { + Settings *s; +diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c +index 364356da5622..47d4ea44e40f 100644 +--- a/src/nss-mymachines/nss-mymachines.c ++++ b/src/nss-mymachines/nss-mymachines.c +@@ -19,6 +19,7 @@ + #include "signal-util.h" + #include "string-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + NSS_GETHOSTBYNAME_PROTOTYPES(mymachines); + NSS_GETPW_PROTOTYPES(mymachines); +diff --git a/src/portable/portable.c b/src/portable/portable.c +index 34b123e84692..5a48504d00ac 100644 +--- a/src/portable/portable.c ++++ b/src/portable/portable.c +@@ -29,6 +29,7 @@ + #include "strv.h" + #include "tmpfile-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile"); + +diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c +index 0a96a18b3836..432d6ebc3730 100644 +--- a/src/resolve/resolvectl.c ++++ b/src/resolve/resolvectl.c +@@ -31,6 +31,7 @@ + #include "strv.h" + #include "terminal-util.h" + #include "verbs.h" ++#include "missing_stdlib.h" + + static int arg_family = AF_UNSPEC; + static int arg_ifindex = 0; +diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c +index b21fe393265f..af2640005c1d 100644 +--- 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; +diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c +index 22a15493d7f3..3f4c51975675 100644 +--- a/src/shared/bus-unit-util.c ++++ b/src/shared/bus-unit-util.c +@@ -34,6 +34,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); +diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c +index aea46d311996..223426298144 100644 +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -34,6 +34,7 @@ + #include "stdio-util.h" + #include "strv.h" + #include "user-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; +diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c +index b812665315f6..8e68f7f8fc6c 100644 +--- a/src/shared/dns-domain.c ++++ b/src/shared/dns-domain.c +@@ -23,6 +23,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; +diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c +index 7c4fc7021dec..3fbaf5a63969 100644 +--- a/src/shared/journal-importer.c ++++ b/src/shared/journal-importer.c +@@ -14,6 +14,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 */ +diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c +index 95b2e3376e9a..facc23aaecd5 100644 +--- a/src/shared/logs-show.c ++++ b/src/shared/logs-show.c +@@ -37,6 +37,7 @@ + #include "time-util.h" + #include "utf8.h" + #include "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 +diff --git a/src/shared/pager.c b/src/shared/pager.c +index 1fe9db179176..67954b5cab93 100644 +--- a/src/shared/pager.c ++++ b/src/shared/pager.c +@@ -23,6 +23,7 @@ + #include "strv.h" + #include "terminal-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + static pid_t pager_pid = 0; + +diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c +index 5b1620974536..0e7cd1c2af12 100644 +--- a/src/shared/path-lookup.c ++++ b/src/shared/path-lookup.c +@@ -19,6 +19,7 @@ + #include "tmpfile-util.h" + #include "user-util.h" + #include "util.h" ++#include "missing_stdlib.h" + + int xdg_user_runtime_dir(char **ret, const char *suffix) { + const char *e; +diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c +index 7cb7d8a477e9..8e7d7f9e7ca6 100644 +--- 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); +diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c +index 2fb9c854fa50..58cef31458f7 100644 +--- 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) + +diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c +index 52217429b154..70708dedf318 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_stdlib.h" + + static void test_hexchar(void) { + assert_se(hexchar(0xa) == 'a'); +diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c +index ca38f5608791..9d8cf4d2807b 100644 +--- a/src/udev/udev-builtin-path_id.c ++++ b/src/udev/udev-builtin-path_id.c +@@ -22,6 +22,7 @@ + #include "strv.h" + #include "sysexits.h" + #include "udev-builtin.h" ++#include "missing_stdlib.h" + + _printf_(2,3) + static void path_prepend(char **path, const char *fmt, ...) { +diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c +index 58d484280aa5..90eab6806b55 100644 +--- a/src/udev/udev-event.c ++++ b/src/udev/udev-event.c +@@ -34,6 +34,7 @@ + #include "udev-util.h" + #include "udev-watch.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + typedef struct Spawn { + sd_device *device; +diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c +index 6168b332d3b2..245fe0a64d22 100644 +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -30,6 +30,7 @@ + #include "udev-rules.h" + #include "user-util.h" + #include "virt.h" ++#include "missing_stdlib.h" + + #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") + diff --git a/external/poky/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/external/poky/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch new file mode 100644 index 00000000..ea003fd7 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch @@ -0,0 +1,278 @@ +From 3932ce7f6c8ace5e1210aad20e1a141cb29329b1 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 26 Oct 2017 22:10:42 -0700 +Subject: [PATCH] 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 { + ^~~~~~ + +and related arphdr, arpreq, and arpreq_old errors +/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr' + struct arphdr { + ^~~~~~ + +The latter requires removing some includes of net/if_arp.h to avoid +conflicting with netinet/if_ether.h. + +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> + +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/libsystemd-network/sd-dhcp6-client.c | 1 - + src/libsystemd/sd-netlink/netlink-types.c | 1 + + src/machine/machine-dbus.c | 1 + + src/network/netdev/bond.c | 1 + + src/network/netdev/bridge.c | 1 + + src/network/netdev/macsec.c | 1 + + src/network/netdev/netdev-gperf.gperf | 1 + + src/network/netdev/netdev.c | 1 + + src/network/networkd-brvlan.c | 1 + + src/network/networkd-dhcp-common.c | 1 + + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-dhcp6.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-network.c | 1 + + src/network/test-network-tables.c | 1 + + src/shared/ethtool-util.c | 1 + + src/shared/ethtool-util.h | 1 + + src/udev/net/link-config.c | 1 + + src/udev/udev-builtin-net_setup_link.c | 1 + + 19 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c +index 5417ba8c5feb..d3aba928dd96 100644 +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -5,7 +5,6 @@ + + #include <errno.h> + #include <sys/ioctl.h> +-#include <linux/if_arp.h> + #include <linux/if_infiniband.h> + + #include "sd-dhcp6-client.h" +diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c +index a55460f03407..6f9cd527c800 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/can/vxcan.h> + #include <linux/netlink.h> + #include <linux/rtnetlink.h> +diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c +index 3b2ac3829859..760ccb445cd0 100644 +--- a/src/machine/machine-dbus.c ++++ b/src/machine/machine-dbus.c +@@ -3,6 +3,7 @@ + #include <errno.h> + #include <sys/mount.h> + #include <sys/wait.h> ++#include <netinet/if_ether.h> + + /* When we include libgen.h because we need dirname() we immediately + * undefine basename() since libgen.h defines it as a macro to the POSIX +diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c +index 185b155440e7..dc1cd236c814 100644 +--- a/src/network/netdev/bond.c ++++ b/src/network/netdev/bond.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include "alloc-util.h" + #include "bond.h" + #include "conf-parser.h" +diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c +index 59a40faef8fa..8e821a3216b3 100644 +--- a/src/network/netdev/bridge.c ++++ b/src/network/netdev/bridge.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <net/if.h> + + #include "bridge.h" +diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c +index 25dc23ff0338..f20d11fbcf53 100644 +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if_ether.h> + #include <linux/if_macsec.h> +diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf +index 09a5f4822e03..873299b1f98a 100644 +--- a/src/network/netdev/netdev-gperf.gperf ++++ b/src/network/netdev/netdev-gperf.gperf +@@ -2,6 +2,7 @@ + #if __GNUC__ >= 7 + _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") + #endif ++#include <netinet/if_ether.h> + #include <stddef.h> + #include "bond.h" + #include "bridge.h" +diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c +index 6908c4e811b0..e0d8c459ab63 100644 +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <net/if.h> + #include <netinet/in.h> + +diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c +index c3c5d535ac66..ebea408c89a8 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/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c +index 6465a8cfe9c7..bd4b2cdfac15 100644 +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -4,6 +4,7 @@ + #include "escape.h" + #include "in-addr-util.h" + #include "networkd-dhcp-common.h" ++#include <netinet/if_ether.h> + #include "networkd-network.h" + #include "parse-util.h" + #include "string-table.h" +diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c +index 8ca87d99d4db..a66284896cf3 100644 +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -1,8 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "dhcp-client-internal.h" +diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c +index 647623ac3778..325c641c6231 100644 +--- a/src/network/networkd-dhcp6.c ++++ b/src/network/networkd-dhcp6.c +@@ -3,9 +3,9 @@ + Copyright © 2014 Intel Corporation. All rights reserved. + ***/ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> + #include "sd-radv.h" + + #include "sd-dhcp6-client.h" +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c +index 2e60adbf7818..05aa8672d585 100644 +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -1,8 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> + #include <unistd.h> + + #include "alloc-util.h" +diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c +index 6e443975f171..d1aab0ca5ba2 100644 +--- a/src/network/networkd-network.c ++++ b/src/network/networkd-network.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <net/if.h> + #include <netinet/in.h> + #include <linux/netdevice.h> +diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c +index 25b939639775..530e4928835c 100644 +--- a/src/network/test-network-tables.c ++++ b/src/network/test-network-tables.c +@@ -1,3 +1,4 @@ ++#include <netinet/if_ether.h> + #include "bond.h" + #include "dhcp6-internal.h" + #include "dhcp6-protocol.h" +diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c +index 3119b2b92e3b..927ddd067eef 100644 +--- a/src/shared/ethtool-util.c ++++ b/src/shared/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/shared/ethtool-util.h b/src/shared/ethtool-util.h +index d408bcd90a0b..7a1e399af023 100644 +--- a/src/shared/ethtool-util.h ++++ b/src/shared/ethtool-util.h +@@ -2,6 +2,7 @@ + #pragma once + + #include <macro.h> ++#include <netinet/if_ether.h> + #include <linux/ethtool.h> + + #include "conf-parser.h" +diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c +index 7b07e2f38fa8..18680a8e5484 100644 +--- a/src/udev/net/link-config.c ++++ b/src/udev/net/link-config.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <linux/netdevice.h> + #include <netinet/ether.h> + +diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c +index ee3ca9fa3846..9aa4e828741f 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 "device-util.h" + #include "alloc-util.h" + #include "link-config.h" diff --git a/external/poky/meta/recipes-core/systemd/systemd/0006-remove-nobody-user-group-checking.patch b/external/poky/meta/recipes-core/systemd/systemd/0006-remove-nobody-user-group-checking.patch deleted file mode 100644 index eb6eb8bf..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0006-src-basic-missing.h-check-for-missing-strndupa.patch b/external/poky/meta/recipes-core/systemd/systemd/0006-src-basic-missing.h-check-for-missing-strndupa.patch deleted file mode 100644 index 107a7943..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0007-Include-netinet-if_ether.h.patch b/external/poky/meta/recipes-core/systemd/systemd/0007-Include-netinet-if_ether.h.patch deleted file mode 100644 index 2df8cf95..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/external/poky/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch index bee5fb65..580c49fe 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch +++ b/external/poky/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 77f98727f1d19a8fb327b55c92f1a9ee7b859e9f 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,33 @@ 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 +index e3aa6c2e152b..38070b79c83a 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,16 +48,15 @@ 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 flags, glob_t *pglob) { 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 @@ -62,22 +64,23 @@ index 9fac676f2..8adb9559e 100644 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 +index 667d15335fbf..76a84443aacf 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" +@@ -12,6 +12,12 @@ #include "rm-rf.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) { char name[] = "/tmp/test-glob_exists.XXXXXX"; -@@ -40,11 +45,13 @@ static void test_glob_no_dot(void) { + int fd = -1; +@@ -39,11 +45,13 @@ static void test_glob_no_dot(void) { const char *fn; _cleanup_globfree_ glob_t g = { @@ -91,7 +94,7 @@ index d78d6223c..f5943b26d 100644 }; int r; -@@ -52,11 +59,19 @@ static void test_glob_no_dot(void) { +@@ -51,11 +59,19 @@ static void test_glob_no_dot(void) { assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -112,12 +115,12 @@ index d78d6223c..f5943b26d 100644 (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c -index 927de35f3..5f0283da5 100644 +index 193ed0bc781b..2f94fd2efd8f 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c -@@ -60,6 +60,12 @@ +@@ -58,6 +58,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 +131,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: +@@ -1850,7 +1856,9 @@ finish: static int glob_item(Item *i, action_t action) { _cleanup_globfree_ glob_t g = { @@ -138,7 +141,7 @@ index 927de35f3..5f0283da5 100644 }; int r = 0, k; char **fn; -@@ -1365,7 +1373,9 @@ static int glob_item(Item *i, action_t action) { +@@ -1870,7 +1878,9 @@ static int glob_item(Item *i, action_t action) { static int glob_item_recursively(Item *i, fdaction_t action) { _cleanup_globfree_ glob_t g = { @@ -148,6 +151,3 @@ index 927de35f3..5f0283da5 100644 }; int r = 0, k; char **fn; --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0007-rules-watch-metadata-changes-in-ide-devices.patch b/external/poky/meta/recipes-core/systemd/systemd/0007-rules-watch-metadata-changes-in-ide-devices.patch deleted file mode 100644 index a5f65e66..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch b/external/poky/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch deleted file mode 100644 index abecdc76..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/external/poky/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch new file mode 100644 index 00000000..1f618932 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch @@ -0,0 +1,45 @@ +From 7c440cfc53aa52c9dc91c3a8c105bcf314c53af6 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 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index c487e65e7bde..23602ebbd533 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *); + #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 diff --git a/external/poky/meta/recipes-core/systemd/systemd/0009-add-missing-FTW_-macros-for-musl.patch b/external/poky/meta/recipes-core/systemd/systemd/0009-add-missing-FTW_-macros-for-musl.patch deleted file mode 100644 index 95287cce..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch b/external/poky/meta/recipes-core/systemd/systemd/0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch deleted file mode 100644 index a635fa91..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/external/poky/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch index d41bc4a0..0de11219 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch @@ -1,20 +1,21 @@ -From 1fadf805cb391e3bcbd9a0286a9e4b7adb9e7427 Mon Sep 17 00:00:00 2001 +From 5166a6657570d4072cdce118621791e4a8186e07 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 9b6c4c31f713..24fec5ecb53a 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) { +@@ -1114,11 +1117,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/external/poky/meta/recipes-core/systemd/systemd/0010-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch b/external/poky/meta/recipes-core/systemd/systemd/0010-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch deleted file mode 100644 index 16547981..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0013-Use-uintmax_t-for-handling-rlim_t.patch b/external/poky/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch index 69b3c151..e00600ab 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0013-Use-uintmax_t-for-handling-rlim_t.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch @@ -1,7 +1,7 @@ -From a0ac0cfd90af6431c64d1b276f422a2092d569b3 Mon Sep 17 00:00:00 2001 +From f6df7f25a6bb00d5540915216adfff8afefec2b0 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 +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 @@ -18,18 +18,20 @@ execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned i 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 | 8 ++++---- - src/core/execute.c | 8 ++++---- - 3 files changed, 8 insertions(+), 16 deletions(-) + src/basic/format-util.h | 8 +------- + src/basic/rlimit-util.c | 10 +++++----- + src/core/execute.c | 4 ++-- + 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/basic/format-util.h b/src/basic/format-util.h -index 160550cd6..61245d1e3 100644 +index 59622508a333..779b6826d50e 100644 --- a/src/basic/format-util.h +++ b/src/basic/format-util.h -@@ -43,14 +43,6 @@ +@@ -44,13 +44,7 @@ # define PRI_TIMEX "li" #endif @@ -40,51 +42,54 @@ index 160550cd6..61245d1e3 100644 -#else -# error Unknown rlim_t size -#endif -- ++#define RLIM_FMT "%ju" + #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 +index 2dc13eabc30d..0633cc67f417 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) { +@@ -306,13 +306,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); ++ (void) asprintf(&s, "infinity:" RLIM_FMT, (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); ++ (void) asprintf(&s, RLIM_FMT ":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); ++ (void) asprintf(&s, RLIM_FMT, (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); ++ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); if (!s) 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; + } diff --git a/src/core/execute.c b/src/core/execute.c -index 8ac69d1a0..efedf3842 100644 +index f04b8ba05002..084cf1420078 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) { - +@@ -4455,9 +4455,9 @@ 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", + fprintf(f, "%sLimit%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", + 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) { --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch b/external/poky/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch deleted file mode 100644 index 1a22ffd9..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0014-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch b/external/poky/meta/recipes-core/systemd/systemd/0014-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch deleted file mode 100644 index 258a631c..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0016-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/external/poky/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch index c06a3706..aa23c7ab 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0016-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch @@ -1,22 +1,22 @@ -From c4bbf3efefffe0a4efadbf4e3f0adb54d76fe0e7 Mon Sep 17 00:00:00 2001 +From 7874912817b5ac7ed7f8557359a12d9d4b2f53eb 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 +index 7fc16a62b656..a710db5370b8 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c -@@ -40,8 +40,10 @@ int main(void) { +@@ -42,8 +42,10 @@ int main(void) { info(unsigned); info(long unsigned); info(long long unsigned); @@ -27,7 +27,7 @@ index 7a1e496ed..386b314d5 100644 info(float); info(double); -@@ -59,7 +61,9 @@ int main(void) { +@@ -61,7 +63,9 @@ int main(void) { info(ssize_t); info(time_t); info(usec_t); @@ -37,6 +37,3 @@ index 7a1e496ed..386b314d5 100644 info(pid_t); info(uid_t); info(gid_t); --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0017-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/external/poky/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch index 8e47c6f5..efeef072 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0017-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -1,7 +1,7 @@ -From 91bb4f5c9c11464468e8d3fa4746d98d59997264 Mon Sep 17 00:00:00 2001 +From e6f871078d8d6f076c84f908fa57af15417ab87d 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,16 +25,17 @@ 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/shared/base-filesystem.c | 6 +++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h -index 28566773c..14b864cc5 100644 +index 78d68be9fd85..c5dc84d41868 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); +@@ -40,7 +40,27 @@ int fchmod_opath(int fd, mode_t m); int fd_warn_permissions(const char *path, int fd); @@ -64,10 +65,10 @@ index 28566773c..14b864cc5 100644 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 +index 657407da2d37..fbd5782d84fc 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) { +@@ -54,7 +54,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { return log_error_errno(errno, "Failed to open root file system: %m"); for (i = 0; i < ELEMENTSOF(table); i ++) { @@ -76,7 +77,7 @@ index 89d7a7d59..34b4ad53a 100644 continue; if (table[i].target) { -@@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -62,7 +62,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { /* check if one of the targets exists */ NULSTR_FOREACH(s, table[i].target) { @@ -85,7 +86,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) { +@@ -73,7 +73,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { if (!p) return log_oom(); @@ -94,6 +95,3 @@ index 89d7a7d59..34b4ad53a 100644 continue; } --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0015-test-hexdecoct.c-Include-missing.h-for-strndupa.patch b/external/poky/meta/recipes-core/systemd/systemd/0015-test-hexdecoct.c-Include-missing.h-for-strndupa.patch deleted file mode 100644 index c7ca9cd4..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0018-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/external/poky/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch index 1bd0d602..19a3eef8 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0018-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -1,8 +1,7 @@ -From 97fed07132533a1b2bce9c60e305a5d09aee2e9b Mon Sep 17 00:00:00 2001 +From ec335ef3bb903a7eaf054103cc51411e71e6448c 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,24 @@ 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 +index 760ccb445cd0..0df20f3864b3 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c -@@ -11,6 +11,10 @@ +@@ -11,6 +11,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 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/external/poky/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index 942f4c09..56f45381 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0017-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 a6f3359042219abaa8ae06dfcce41a4721e8c21f 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,15 +17,18 @@ 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 +index 24fec5ecb53a..642b02443c85 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -1473,7 +1473,7 @@ int set_oom_score_adjust(int value) { +@@ -1492,7 +1492,7 @@ int set_oom_score_adjust(int value) { sprintf(t, "%i", value); return write_string_file("/proc/self/oom_score_adj", t, @@ -34,6 +37,3 @@ index 3543bc045..d0572e034 100644 } static const char *const ioprio_class_table[] = { --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/external/poky/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index 5c78cabb..84a492f2 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -1,7 +1,7 @@ -From dd53dc9b9542cbd2c39a39096941dfed70d06506 Mon Sep 17 00:00:00 2001 +From 4938705454cf46cfe8deac8ce457d5d2432cbead 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,16 +18,17 @@ 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 +++++ 2 files changed, 10 insertions(+) diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c -index 65bcbcd2e..aef80dd8f 100644 +index 43ed756bda53..227ea64dbb48 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 +@@ -336,7 +336,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove char* j; errno = 0; @@ -41,10 +42,10 @@ index 65bcbcd2e..aef80dd8f 100644 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 +index f760f0fdd21c..28a5159c4480 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) { +@@ -379,7 +379,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { return; errno = 0; @@ -57,6 +58,3 @@ index ec359ac13..d2aa86cea 100644 if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; --- -2.11.0 - diff --git a/external/poky/meta/recipes-core/systemd/systemd/0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/external/poky/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch index 668f2732..3b806467 100644 --- a/external/poky/meta/recipes-core/systemd/systemd/0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch +++ b/external/poky/meta/recipes-core/systemd/systemd/0019-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 1c4c73a7cc0fb59eb68ab70699f7f51af5c163b2 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 28a5159c4480..962a4de10c56 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[] = { +@@ -54,8 +54,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/external/poky/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch b/external/poky/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch new file mode 100644 index 00000000..db4041bb --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch @@ -0,0 +1,28 @@ +From 8303d49cabaf3ab8890ba1d266972c721dfe6ee8 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 23602ebbd533..917d314a81bf 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/external/poky/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch b/external/poky/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch new file mode 100644 index 00000000..7dacc368 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -0,0 +1,30 @@ +From 6364ff5534678c158a7fb8d4e50d0a6ce72c1ad8 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 f80cd17f346b..47e489354053 100644 +--- a/src/basic/missing_prctl.h ++++ b/src/basic/missing_prctl.h +@@ -1,7 +1,9 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + #pragma once + ++#ifdef __GLIBC__ + #include <linux/prctl.h> ++#endif + + /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ + #ifndef PR_CAP_AMBIENT diff --git a/external/poky/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch b/external/poky/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch deleted file mode 100644 index 962463f0..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0023-resolvconf-fixes-for-the-compatibility-interface.patch b/external/poky/meta/recipes-core/systemd/systemd/0023-resolvconf-fixes-for-the-compatibility-interface.patch deleted file mode 100644 index 2f3e776a..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0024-journald-do-not-store-the-iovec-entry-for-process-co.patch b/external/poky/meta/recipes-core/systemd/systemd/0024-journald-do-not-store-the-iovec-entry-for-process-co.patch deleted file mode 100644 index c2f78be3..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch b/external/poky/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch new file mode 100644 index 00000000..80beada3 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch @@ -0,0 +1,31 @@ +From a05cc5fb3dc0e51682c40196285cdda34ec90783 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(+) + +diff --git a/src/test/test-json.c b/src/test/test-json.c +index a6613043b924..ca823ea79f05 100644 +--- a/src/test/test-json.c ++++ b/src/test/test-json.c +@@ -12,6 +12,10 @@ + #include "tests.h" + #include "util.h" + ++#ifndef M_PIl ++#define M_PIl 3.141592653589793238462643383279502884L ++#endif ++ + static void test_tokenizer(const char *data, ...) { + unsigned line = 0, column = 0; + void *state = NULL; diff --git a/external/poky/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields.patch b/external/poky/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields.patch deleted file mode 100644 index ae9ef5de..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/0026-journal-fix-out-of-bounds-read-CVE-2018-16866.patch b/external/poky/meta/recipes-core/systemd/systemd/0026-journal-fix-out-of-bounds-read-CVE-2018-16866.patch deleted file mode 100644 index 3925a4ab..00000000 --- a/external/poky/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/external/poky/meta/recipes-core/systemd/systemd/99-default.preset b/external/poky/meta/recipes-core/systemd/systemd/99-default.preset new file mode 100644 index 00000000..1f29b505 --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/99-default.preset @@ -0,0 +1 @@ +disable * diff --git a/external/poky/meta/recipes-core/systemd/systemd/CVE-2019-6454.patch b/external/poky/meta/recipes-core/systemd/systemd/CVE-2019-6454.patch deleted file mode 100644 index 80170dac..00000000 --- a/external/poky/meta/recipes-core/systemd/systemd/CVE-2019-6454.patch +++ /dev/null @@ -1,210 +0,0 @@ -Description: sd-bus: enforce a size limit for dbus paths, and don't allocate - them on the stacka -Forwarded: no - -Patch from: systemd_239-7ubuntu10.8 - -For information see: -https://usn.ubuntu.com/3891-1/ -https://git.launchpad.net/ubuntu/+source/systemd/commit/?id=f8e75d5634904c8e672658856508c3a02f349adb - -CVE: CVE-2019-6454 -Upstream-Status: Backport - -Signed-off-by: George McCollister <george.mccollister@gmail.com> - ---- a/src/libsystemd/sd-bus/bus-internal.c -+++ b/src/libsystemd/sd-bus/bus-internal.c -@@ -45,7 +45,7 @@ - if (slash) - return false; - -- return true; -+ return (q - p) <= BUS_PATH_SIZE_MAX; - } - - char* object_path_startswith(const char *a, const char *b) { ---- a/src/libsystemd/sd-bus/bus-internal.h -+++ b/src/libsystemd/sd-bus/bus-internal.h -@@ -333,6 +333,10 @@ - - #define BUS_MESSAGE_SIZE_MAX (128*1024*1024) - #define BUS_AUTH_SIZE_MAX (64*1024) -+/* Note that the D-Bus specification states that bus paths shall have no size limit. We enforce here one -+ * anyway, since truly unbounded strings are a security problem. The limit we pick is relatively large however, -+ * to not clash unnecessarily with real-life applications. */ -+#define BUS_PATH_SIZE_MAX (64*1024) - - #define BUS_CONTAINER_DEPTH 128 - ---- a/src/libsystemd/sd-bus/bus-objects.c -+++ b/src/libsystemd/sd-bus/bus-objects.c -@@ -1134,7 +1134,8 @@ - const char *path, - sd_bus_error *error) { - -- char *prefix; -+ _cleanup_free_ char *prefix = NULL; -+ size_t pl; - int r; - - assert(bus); -@@ -1150,7 +1151,12 @@ - return 0; - - /* Second, add fallback vtables registered for any of the prefixes */ -- prefix = alloca(strlen(path) + 1); -+ pl = strlen(path); -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; -+ - OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - r = object_manager_serialize_path(bus, reply, prefix, path, true, error); - if (r < 0) -@@ -1346,6 +1352,7 @@ - } - - int bus_process_object(sd_bus *bus, sd_bus_message *m) { -+ _cleanup_free_ char *prefix = NULL; - int r; - size_t pl; - bool found_object = false; -@@ -1370,9 +1377,12 @@ - assert(m->member); - - pl = strlen(m->path); -- do { -- char prefix[pl+1]; -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; - -+ do { - bus->nodes_modified = false; - - r = object_find_and_run(bus, m, m->path, false, &found_object); -@@ -1499,9 +1509,15 @@ - - n = hashmap_get(bus->nodes, path); - if (!n) { -- char *prefix; -+ _cleanup_free_ char *prefix = NULL; -+ size_t pl; -+ -+ pl = strlen(path); -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; - -- prefix = alloca(strlen(path) + 1); - OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - n = hashmap_get(bus->nodes, prefix); - if (n) -@@ -2091,8 +2107,9 @@ - char **names) { - - BUS_DONT_DESTROY(bus); -+ _cleanup_free_ char *prefix = NULL; - bool found_interface = false; -- char *prefix; -+ size_t pl; - int r; - - assert_return(bus, -EINVAL); -@@ -2111,6 +2128,12 @@ - if (names && names[0] == NULL) - return 0; - -+ pl = strlen(path); -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; -+ - do { - bus->nodes_modified = false; - -@@ -2120,7 +2143,6 @@ - if (bus->nodes_modified) - continue; - -- prefix = alloca(strlen(path) + 1); - OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - r = emit_properties_changed_on_interface(bus, prefix, path, interface, true, &found_interface, names); - if (r != 0) -@@ -2252,7 +2274,8 @@ - - static int object_added_append_all(sd_bus *bus, sd_bus_message *m, const char *path) { - _cleanup_set_free_ Set *s = NULL; -- char *prefix; -+ _cleanup_free_ char *prefix = NULL; -+ size_t pl; - int r; - - assert(bus); -@@ -2297,7 +2320,12 @@ - if (bus->nodes_modified) - return 0; - -- prefix = alloca(strlen(path) + 1); -+ pl = strlen(path); -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; -+ - OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - r = object_added_append_all_prefix(bus, m, s, prefix, path, true); - if (r < 0) -@@ -2436,7 +2464,8 @@ - - static int object_removed_append_all(sd_bus *bus, sd_bus_message *m, const char *path) { - _cleanup_set_free_ Set *s = NULL; -- char *prefix; -+ _cleanup_free_ char *prefix = NULL; -+ size_t pl; - int r; - - assert(bus); -@@ -2468,7 +2497,12 @@ - if (bus->nodes_modified) - return 0; - -- prefix = alloca(strlen(path) + 1); -+ pl = strlen(path); -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; -+ - OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - r = object_removed_append_all_prefix(bus, m, s, prefix, path, true); - if (r < 0) -@@ -2618,7 +2652,8 @@ - const char *path, - const char *interface) { - -- char *prefix; -+ _cleanup_free_ char *prefix = NULL; -+ size_t pl; - int r; - - assert(bus); -@@ -2632,7 +2667,12 @@ - if (bus->nodes_modified) - return 0; - -- prefix = alloca(strlen(path) + 1); -+ pl = strlen(path); -+ assert(pl <= BUS_PATH_SIZE_MAX); -+ prefix = new(char, pl + 1); -+ if (!prefix) -+ return -ENOMEM; -+ - OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - r = interfaces_added_append_one_prefix(bus, m, prefix, path, interface, true); - if (r != 0) diff --git a/external/poky/meta/recipes-core/systemd/systemd/CVE-2020-13776.patch b/external/poky/meta/recipes-core/systemd/systemd/CVE-2020-13776.patch new file mode 100644 index 00000000..7b5e3e7f --- /dev/null +++ b/external/poky/meta/recipes-core/systemd/systemd/CVE-2020-13776.patch @@ -0,0 +1,96 @@ +From 156a5fd297b61bce31630d7a52c15614bf784843 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> +Date: Sun, 31 May 2020 18:21:09 +0200 +Subject: [PATCH 1/1] basic/user-util: always use base 10 for user/group + numbers + +We would parse numbers with base prefixes as user identifiers. For example, +"0x2b3bfa0" would be interpreted as UID==45334432 and "01750" would be +interpreted as UID==1000. This parsing was used also in cases where either a +user/group name or number may be specified. This means that names like +0x2b3bfa0 would be ambiguous: they are a valid user name according to our +documented relaxed rules, but they would also be parsed as numeric uids. + +This behaviour is definitely not expected by users, since tools generally only +accept decimal numbers (e.g. id, getent passwd), while other tools only accept +user names and thus will interpret such strings as user names without even +attempting to convert them to numbers (su, ssh). So let's follow suit and only +accept numbers in decimal notation. Effectively this means that we will reject +such strings as a username/uid/groupname/gid where strict mode is used, and try +to look up a user/group with such a name in relaxed mode. + +Since the function changed is fairly low-level and fairly widely used, this +affects multiple tools: loginctl show-user/enable-linger/disable-linger foo', +the third argument in sysusers.d, fourth and fifth arguments in tmpfiles.d, +etc. + +Fixes #15985. +--- + src/basic/user-util.c | 2 +- + src/test/test-user-util.c | 10 ++++++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +--- end of commit 156a5fd297b61bce31630d7a52c15614bf784843 --- + + +Add definition of safe_atou32_full() from commit b934ac3d6e7dcad114776ef30ee9098693e7ab7e + +CVE: CVE-2020-13776 + +Upstream-Status: Backport [https://github.com/systemd/systemd.git] + +Signed-off-by: Joe Slater <joe.slater@windriver.com> + + + +--- git.orig/src/basic/user-util.c ++++ git/src/basic/user-util.c +@@ -49,7 +49,7 @@ int parse_uid(const char *s, uid_t *ret) + assert(s); + + assert_cc(sizeof(uid_t) == sizeof(uint32_t)); +- r = safe_atou32(s, &uid); ++ r = safe_atou32_full(s, 10, &uid); + if (r < 0) + return r; + +--- git.orig/src/test/test-user-util.c ++++ git/src/test/test-user-util.c +@@ -48,9 +48,19 @@ static void test_parse_uid(void) { + + r = parse_uid("65535", &uid); + assert_se(r == -ENXIO); ++ assert_se(uid == 100); ++ ++ r = parse_uid("0x1234", &uid); ++ assert_se(r == -EINVAL); ++ assert_se(uid == 100); ++ ++ r = parse_uid("01234", &uid); ++ assert_se(r == 0); ++ assert_se(uid == 1234); + + r = parse_uid("asdsdas", &uid); + assert_se(r == -EINVAL); ++ assert_se(uid == 1234); + } + + static void test_uid_ptr(void) { +--- git.orig/src/basic/parse-util.h ++++ git/src/basic/parse-util.h +@@ -45,9 +45,13 @@ static inline int safe_atoux16(const cha + + int safe_atoi16(const char *s, int16_t *ret); + +-static inline int safe_atou32(const char *s, uint32_t *ret_u) { ++static inline int safe_atou32_full(const char *s, unsigned base, uint32_t *ret_u) { + assert_cc(sizeof(uint32_t) == sizeof(unsigned)); +- return safe_atou(s, (unsigned*) ret_u); ++ return safe_atou_full(s, base, (unsigned*) ret_u); ++} ++ ++static inline int safe_atou32(const char *s, uint32_t *ret_u) { ++ return safe_atou32_full(s, 0, (unsigned*) ret_u); + } + + static inline int safe_atoi32(const char *s, int32_t *ret_i) { diff --git a/external/poky/meta/recipes-core/systemd/systemd/sd-bus-if-we-receive-an-invalid-dbus-message-ignore-.patch b/external/poky/meta/recipes-core/systemd/systemd/sd-bus-if-we-receive-an-invalid-dbus-message-ignore-.patch deleted file mode 100644 index 57311faa..00000000 --- a/external/poky/meta/recipes-core/systemd/systemd/sd-bus-if-we-receive-an-invalid-dbus-message-ignore-.patch +++ /dev/null @@ -1,61 +0,0 @@ -Description: sd-bus: if we receive an invalid dbus message, ignore and - proceeed - . - dbus-daemon might have a slightly different idea of what a valid msg is - than us (for example regarding valid msg and field sizes). Let's hence - try to proceed if we can and thus drop messages rather than fail the - connection if we fail to validate a message. - . - Hopefully the differences in what is considered valid are not visible - for real-life usecases, but are specific to exploit attempts only. -Author: Lennart Poettering <lennart@poettering.net> -Forwarded: other,https://github.com/systemd/systemd/pull/11708/ - -Patch from: systemd_239-7ubuntu10.8 - -For information see: -https://usn.ubuntu.com/3891-1/ -https://git.launchpad.net/ubuntu/+source/systemd/commit/?id=f8e75d5634904c8e672658856508c3a02f349adb - -CVE: CVE-2019-6454 -Upstream-Status: Backport - -Signed-off-by: George McCollister <george.mccollister@gmail.com> - -diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c -index 30d6455b6f..441b4a816f 100644 ---- a/src/libsystemd/sd-bus/bus-socket.c -+++ b/src/libsystemd/sd-bus/bus-socket.c -@@ -1072,7 +1072,7 @@ static int bus_socket_read_message_need(sd_bus *bus, size_t *need) { - } - - static int bus_socket_make_message(sd_bus *bus, size_t size) { -- sd_bus_message *t; -+ sd_bus_message *t = NULL; - void *b; - int r; - -@@ -1097,7 +1097,9 @@ static int bus_socket_make_message(sd_bus *bus, size_t size) { - bus->fds, bus->n_fds, - NULL, - &t); -- if (r < 0) { -+ if (r == -EBADMSG) -+ log_debug_errno(r, "Received invalid message from connection %s, dropping.", strna(bus->description)); -+ else if (r < 0) { - free(b); - return r; - } -@@ -1108,7 +1110,8 @@ static int bus_socket_make_message(sd_bus *bus, size_t size) { - bus->fds = NULL; - bus->n_fds = 0; - -- bus->rqueue[bus->rqueue_size++] = t; -+ if (t) -+ bus->rqueue[bus->rqueue_size++] = t; - - return 1; - } --- -2.17.1 - diff --git a/external/poky/meta/recipes-core/systemd/systemd_239.bb b/external/poky/meta/recipes-core/systemd/systemd_244.3.bb index 7fbd64ce..850d64e8 100644 --- a/external/poky/meta/recipes-core/systemd/systemd_239.bb +++ b/external/poky/meta/recipes-core/systemd/systemd_244.3.bb @@ -8,7 +8,7 @@ DEPENDS = "intltool-native gperf-native libcap util-linux" 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. @@ -17,63 +17,39 @@ REQUIRED_DISTRO_FEATURES = "systemd" SRC_URI += "file://touchscreen.rules \ file://00-create-volatile.conf \ file://init \ + file://99-default.preset \ 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://CVE-2019-6454.patch \ - file://sd-bus-if-we-receive-an-invalid-dbus-message-ignore-.patch \ + file://CVE-2020-13776.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://0006-Include-netinet-if_ether.h.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://0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ + file://0011-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ + file://0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ + file://0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ + file://0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ + file://0020-missing_type.h-add-__compar_d_fn_t-definition.patch \ + file://0021-avoid-redefinition-of-prctl_mm_map-structure.patch \ + file://0024-test-json.c-define-M_PIl.patch \ + file://0001-do-not-disable-buffer-in-writing-files.patch \ + file://0002-src-login-brightness.c-include-sys-wait.h.patch \ + file://0003-src-basic-copy.c-include-signal.h.patch \ + file://0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.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 \ @@ -81,16 +57,15 @@ PAM_PLUGINS = " \ " PACKAGECONFIG ??= " \ - ${@bb.utils.filter('DISTRO_FEATURES', 'efi ldconfig pam selinux usrmerge', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ - acl \ backlight \ binfmt \ - firstboot \ gshadow \ hibernate \ hostnamed \ + idn \ ima \ kmod \ localed \ @@ -99,12 +74,14 @@ PACKAGECONFIG ??= " \ myhostname \ networkd \ nss \ - polkit \ + nss-mymachines \ + nss-resolve \ quotacheck \ randomseed \ resolved \ - smack \ + set-time-epoch \ sysusers \ + sysvinit \ timedated \ timesyncd \ utmp \ @@ -114,16 +91,18 @@ PACKAGECONFIG ??= " \ PACKAGECONFIG_remove_libc-musl = " \ gshadow \ + idn \ localed \ myhostname \ nss \ - resolved \ - selinux \ - smack \ + nss-mymachines \ + nss-resolve \ sysusers \ utmp \ " +CFLAGS_append_libc-musl = " -D__UAPI_DEF_ETHHDR=0 " + # 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. @@ -134,10 +113,12 @@ 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[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" # Sign the journal for anti-tampering @@ -146,6 +127,7 @@ 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 PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" @@ -153,18 +135,23 @@ PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" 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[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn" +PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2" 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[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" PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode" @@ -177,7 +164,13 @@ 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=,,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" @@ -203,20 +196,19 @@ 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 \ " # 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() { @@ -234,8 +226,6 @@ 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/ install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ @@ -243,6 +233,7 @@ 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 @@ -282,7 +273,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 @@ -292,19 +286,17 @@ 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 + # 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 +} python populate_packages_prepend (){ systemdlibdir = d.getVar("rootlibdir") @@ -312,7 +304,7 @@ python populate_packages_prepend (){ } PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" -PACKAGES =+ "\ +PACKAGE_BEFORE_PN = "\ ${PN}-gui \ ${PN}-vconsole-setup \ ${PN}-initramfs \ @@ -321,12 +313,13 @@ 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 \ + udev \ + udev-hwdb \ " SUMMARY_${PN}-container = "Tools for containers and VMs" @@ -383,8 +376,6 @@ FILES_${PN}-kernel-install = "${bindir}/kernel-install \ 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}-binfmt = "${sysconfdir}/binfmt.d/ \ @@ -416,17 +407,20 @@ FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ ${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 \ ${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 \ @@ -498,6 +492,15 @@ FILES_${PN}-extra-utils = "\ ${rootlibexecdir}/systemd/systemd-cgroups-agent \ " +CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \ + ${sysconfdir}/systemd/journald.conf \ + ${sysconfdir}/systemd/logind.conf \ + ${sysconfdir}/systemd/system.conf \ + ${sysconfdir}/systemd/user.conf \ + ${sysconfdir}/systemd/resolved.conf \ + ${sysconfdir}/systemd/timesyncd.conf \ +" + FILES_${PN} = " ${base_bindir}/* \ ${base_sbindir}/shutdown \ ${base_sbindir}/halt \ @@ -521,6 +524,7 @@ FILES_${PN} = " ${base_bindir}/* \ ${sysconfdir}/xdg/ \ ${sysconfdir}/init.d/README \ ${sysconfdir}/resolv-conf.systemd \ + ${sysconfdir}/X11/xinit/xinitrc.d/* \ ${rootlibexecdir}/systemd/* \ ${systemd_unitdir}/* \ ${base_libdir}/security/*.so \ @@ -533,7 +537,6 @@ FILES_${PN} = " ${base_bindir}/* \ ${bindir}/resolvectl \ ${bindir}/timedatectl \ ${bindir}/bootctl \ - ${bindir}/kernel-install \ ${exec_prefix}/lib/tmpfiles.d/*.conf \ ${exec_prefix}/lib/systemd \ ${exec_prefix}/lib/modules-load.d \ @@ -541,11 +544,11 @@ 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}/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 \ + ${rootlibexecdir}/modprobe.d/systemd.conf \ ${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 \ @@ -561,31 +564,32 @@ FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ $ RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount 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} += "volatile-binds" RRECOMMENDS_${PN} += "systemd-extra-utils \ systemd-compat-units 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" -PACKAGES =+ "udev udev-hwdb" - RPROVIDES_udev = "hotplug" RDEPENDS_udev-hwdb += "udev" 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/fido_id \ ${rootlibexecdir}/udev/findkeyboards \ ${rootlibexecdir}/udev/keyboard-force-release.sh \ ${rootlibexecdir}/udev/keymap \ @@ -593,17 +597,49 @@ 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-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-joystick.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/90-vconsole.rules \ ${sysconfdir}/udev \ ${sysconfdir}/init.d/systemd-udevd \ ${systemd_unitdir}/system/*udev* \ ${systemd_unitdir}/system/*.wants/*udev* \ + ${base_bindir}/systemd-hwdb \ ${base_bindir}/udevadm \ + ${base_sbindir}/udevadm \ ${libexecdir}/${MLPREFIX}udevadm \ ${datadir}/bash-completion/completions/udevadm \ + ${systemd_unitdir}/system/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" @@ -614,7 +650,13 @@ python __anonymous() { d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") } -ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel resolv-conf" +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 ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" @@ -640,13 +682,13 @@ 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 @@ -655,7 +697,7 @@ pkg_prerm_${PN} () { PACKAGE_WRITE_DEPS += "qemu-native" 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 |