SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-05-05 14:06:21 +00:00 committed by Git OBS Bridge
parent 50434a72f7
commit d27ebe7f42
7 changed files with 333 additions and 0 deletions

View File

@ -0,0 +1,111 @@
Backport of 7ca1d31964a2553f7bd011bc10ac42e0ebc1f975 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 2 May 2014 22:29:18 +0200
Subject: [PATCH] sd-rtnl-message: append - fix uninitialized memory
We were not properly clearing the padding at the front of some containers.
---
src/libsystemd/sd-rtnl/rtnl-message.c | 42 +++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 15 deletions(-)
--- src/libsystemd/sd-rtnl/rtnl-message.c
+++ src/libsystemd/sd-rtnl/rtnl-message.c 2014-05-05 13:33:01.998235340 +0000
@@ -314,24 +314,28 @@ int sd_rtnl_message_link_get_flags(sd_rt
/* If successful the updated message will be correctly aligned, if
unsuccessful the old message is untouched. */
static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) {
- uint32_t rta_length, message_length;
+ uint32_t rta_length;
+ size_t message_length, padding_length;
struct nlmsghdr *new_hdr;
struct rtattr *rta;
char *padding;
unsigned i;
+ int offset;
assert(m);
assert(m->hdr);
assert(!m->sealed);
assert(NLMSG_ALIGN(m->hdr->nlmsg_len) == m->hdr->nlmsg_len);
- assert(!data || data_length > 0);
- assert(data || m->n_containers < RTNL_CONTAINER_DEPTH);
+ assert(!data || data_length);
+
+ /* get offset of the new attribute */
+ offset = m->hdr->nlmsg_len;
/* get the size of the new rta attribute (with padding at the end) */
rta_length = RTA_LENGTH(data_length);
/* get the new message size (with padding at the end) */
- message_length = m->hdr->nlmsg_len + RTA_ALIGN(rta_length);
+ message_length = offset + RTA_ALIGN(rta_length);
/* realloc to fit the new attribute */
new_hdr = realloc(m->hdr, message_length);
@@ -340,32 +344,35 @@ static int add_rtattr(sd_rtnl_message *m
m->hdr = new_hdr;
/* get pointer to the attribute we are about to add */
- rta = (struct rtattr *) ((uint8_t *) m->hdr + m->hdr->nlmsg_len);
+ rta = (struct rtattr *) ((uint8_t *) m->hdr + offset);
/* if we are inside containers, extend them */
for (i = 0; i < m->n_containers; i++)
- GET_CONTAINER(m, i)->rta_len += message_length - m->hdr->nlmsg_len;
+ GET_CONTAINER(m, i)->rta_len += message_length - offset;
/* fill in the attribute */
rta->rta_type = type;
rta->rta_len = rta_length;
- if (!data) {
- /* this is the start of a new container */
- m->container_offsets[m->n_containers ++] = m->hdr->nlmsg_len;
- } else {
+ if (data)
/* we don't deal with the case where the user lies about the type
* and gives us too little data (so don't do that)
- */
+ */
padding = mempcpy(RTA_DATA(rta), data, data_length);
- /* make sure also the padding at the end of the message is initialized */
- memzero(padding,
- (uint8_t *) m->hdr + message_length - (uint8_t *) padding);
+ else {
+ /* if no data was passed, make sure we still initialize the padding
+ note that we can have data_length > 0 (used by some containers) */
+ padding = RTA_DATA(rta);
+ data_length = 0;
}
+ /* make sure also the padding at the end of the message is initialized */
+ padding_length = (uint8_t*)m->hdr + message_length - (uint8_t*)padding;
+ memzero(padding, padding_length);
+
/* update message size */
m->hdr->nlmsg_len = message_length;
- return 0;
+ return offset;
}
int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data) {
@@ -498,6 +505,7 @@ int sd_rtnl_message_append_u32(sd_rtnl_m
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
+ assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE);
r = sd_rtnl_message_get_type(m, &rtm_type);
if (r < 0)
@@ -548,6 +556,10 @@ int sd_rtnl_message_append_u32(sd_rtnl_m
if (r < 0)
return r;
+ m->container_offsets[m->n_containers ++] = r;
+
+ m->container_offsets[m->n_containers ++] = r;
+
return 0;
}

View File

@ -0,0 +1,43 @@
--- systemd-210/src/core/manager.c 2014-05-05 11:46:17.700483956 +0200
+++ systemd-210/src/core/manager.c 2014-05-05 13:29:13.296503646 +0200
@@ -152,6 +152,29 @@
}
}
+static int check_for_password_prompt(void) {
+ DIR *d;
+ struct dirent *de;
+
+ if (!(d = opendir("/run/systemd/ask-password"))) {
+ log_error("opendir(): %m");
+
+ if (errno == ENOENT)
+ return 1;
+
+ return -errno;
+ }
+
+ while ((de = readdir(d))) {
+ if (startswith(de->d_name, "ask.")) {
+ closedir(d);
+ return 0;
+ }
+ }
+ closedir(d);
+ return 1;
+}
+
static void manager_print_jobs_in_progress(Manager *m) {
static int is_ansi_console = -1;
_cleanup_free_ char *job_of_n = NULL;
@@ -195,6 +217,10 @@
m->jobs_in_progress_iteration++;
+ //don't overwrite the crypt password prompt with job status messages
+ if (check_for_password_prompt() == 0);
+ return 0;
+
if (m->n_running_jobs > 1)
if (asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs) < 0)
job_of_n = NULL;

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon May 5 14:02:16 UTC 2014 - werner@suse.de
- Port upstream patch
0001-sd-rtnl-message-append-fix-uninitialized-memory.patch
back to 210
- Add patch keep-crypt-password-prompt.patch from Thomas Blume
to fix bnc#875502 - fails to boot when swap space is encrypted
- Port upstream patch set for net_id back in patch
upstream-net_id-changes.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 2 10:12:26 UTC 2014 - werner@suse.de Fri May 2 10:12:26 UTC 2014 - werner@suse.de

View File

@ -399,6 +399,10 @@ Patch202: 0004-implement-a-union-to-pad-out-file_handle.patch
Patch203: respect-nfs-bg-option.patch Patch203: respect-nfs-bg-option.patch
# PATCH-FIX-UPSTREAM Stop useless messages on dual_timestamp_is_set is failed. # PATCH-FIX-UPSTREAM Stop useless messages on dual_timestamp_is_set is failed.
Patch204: shut-up-annoying-assertion-monotonic-clock-message.patch Patch204: shut-up-annoying-assertion-monotonic-clock-message.patch
# PATCH-FIX-SUSE Do not override the passphrase prompts due messages of busy jobs
Patch205: keep-crypt-password-prompt.patch
# PATCH-FIX-UPSTREAM Fix uninitialized memory
Patch206: 0001-sd-rtnl-message-append-fix-uninitialized-memory.patch
# UDEV PATCHES # UDEV PATCHES
# ============ # ============
@ -432,6 +436,8 @@ Patch1011: 1011-64-btrfs.rules-skip-btrfs-check-if-devices-are-not-r.patch
Patch1012: 1012-Skip-persistent-device-link-creation-on-multipath-de.patch Patch1012: 1012-Skip-persistent-device-link-creation-on-multipath-de.patch
# PATCH-FIX-SUSE Do not use runtime PM for some IBM consoles (bnc#868931) # PATCH-FIX-SUSE Do not use runtime PM for some IBM consoles (bnc#868931)
Patch1013: 1013-no-runtime-PM-for-IBM-consoles.patch Patch1013: 1013-no-runtime-PM-for-IBM-consoles.patch
# PATCH-FIX-UPSTREAM Move forward to git Head for net_id
Patch1014: upstream-net_id-changes.patch
%description %description
Systemd is a system and service manager, compatible with SysV and LSB Systemd is a system and service manager, compatible with SysV and LSB
@ -784,6 +790,8 @@ cp %{SOURCE7} m4/
%patch202 -p0 %patch202 -p0
%patch203 -p1 %patch203 -p1
%patch204 -p1 %patch204 -p1
%patch205 -p1
%patch206 -p0
# udev patches # udev patches
%patch1001 -p1 %patch1001 -p1
@ -800,6 +808,9 @@ cp %{SOURCE7} m4/
%patch1011 -p1 %patch1011 -p1
%patch1012 -p1 %patch1012 -p1
%patch1013 -p1 %patch1013 -p1
%if 0%{?suse_version} > 1310
%patch1014 -p0
%endif
# ensure generate files are removed # ensure generate files are removed
rm -f units/emergency.service rm -f units/emergency.service

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon May 5 14:02:16 UTC 2014 - werner@suse.de
- Port upstream patch
0001-sd-rtnl-message-append-fix-uninitialized-memory.patch
back to 210
- Add patch keep-crypt-password-prompt.patch from Thomas Blume
to fix bnc#875502 - fails to boot when swap space is encrypted
- Port upstream patch set for net_id back in patch
upstream-net_id-changes.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 2 10:12:26 UTC 2014 - werner@suse.de Fri May 2 10:12:26 UTC 2014 - werner@suse.de

View File

@ -394,6 +394,10 @@ Patch202: 0004-implement-a-union-to-pad-out-file_handle.patch
Patch203: respect-nfs-bg-option.patch Patch203: respect-nfs-bg-option.patch
# PATCH-FIX-UPSTREAM Stop useless messages on dual_timestamp_is_set is failed. # PATCH-FIX-UPSTREAM Stop useless messages on dual_timestamp_is_set is failed.
Patch204: shut-up-annoying-assertion-monotonic-clock-message.patch Patch204: shut-up-annoying-assertion-monotonic-clock-message.patch
# PATCH-FIX-SUSE Do not override the passphrase prompts due messages of busy jobs
Patch205: keep-crypt-password-prompt.patch
# PATCH-FIX-UPSTREAM Fix uninitialized memory
Patch206: 0001-sd-rtnl-message-append-fix-uninitialized-memory.patch
# UDEV PATCHES # UDEV PATCHES
# ============ # ============
@ -427,6 +431,8 @@ Patch1011: 1011-64-btrfs.rules-skip-btrfs-check-if-devices-are-not-r.patch
Patch1012: 1012-Skip-persistent-device-link-creation-on-multipath-de.patch Patch1012: 1012-Skip-persistent-device-link-creation-on-multipath-de.patch
# PATCH-FIX-SUSE Do not use runtime PM for some IBM consoles (bnc#868931) # PATCH-FIX-SUSE Do not use runtime PM for some IBM consoles (bnc#868931)
Patch1013: 1013-no-runtime-PM-for-IBM-consoles.patch Patch1013: 1013-no-runtime-PM-for-IBM-consoles.patch
# PATCH-FIX-UPSTREAM Move forward to git Head for net_id
Patch1014: upstream-net_id-changes.patch
%description %description
Systemd is a system and service manager, compatible with SysV and LSB Systemd is a system and service manager, compatible with SysV and LSB
@ -779,6 +785,8 @@ cp %{SOURCE7} m4/
%patch202 -p0 %patch202 -p0
%patch203 -p1 %patch203 -p1
%patch204 -p1 %patch204 -p1
%patch205 -p1
%patch206 -p0
# udev patches # udev patches
%patch1001 -p1 %patch1001 -p1
@ -795,6 +803,9 @@ cp %{SOURCE7} m4/
%patch1011 -p1 %patch1011 -p1
%patch1012 -p1 %patch1012 -p1
%patch1013 -p1 %patch1013 -p1
%if 0%{?suse_version} > 1310
%patch1014 -p0
%endif
# ensure generate files are removed # ensure generate files are removed
rm -f units/emergency.service rm -f units/emergency.service

View File

@ -0,0 +1,135 @@
This the diff between systemd-210 and 19aa72f74e41045510b4af3f1415b419d42ff20b
But we do not remove the ATA support as in HEAD
---
src/udev/udev-builtin-net_id.c | 54 ++++++----------------------------------
src/udev/udev-builtin-path_id.c | 3 --
2 files changed, 9 insertions(+), 48 deletions(-)
--- src/udev/udev-builtin-net_id.c
+++ src/udev/udev-builtin-net_id.c 2014-04-08 07:16:45.094235605 +0000
@@ -33,6 +33,8 @@
* ww -- wwan
*
* Type of names:
+ * b<number> -- BCMA bus core number
+ * ccw<name> -- CCW bus group name
* o<index> -- on-board device index number
* s<slot>[f<function>][d<dev_id>] -- hotplug slot index number
* x<MAC> -- MAC address
@@ -92,6 +94,7 @@
#include <string.h>
#include <errno.h>
#include <net/if.h>
+#include <net/if_arp.h>
#include <linux/pci_regs.h>
#include "udev.h"
@@ -119,12 +122,8 @@ struct netnames {
const char *pci_onboard_label;
char usb_ports[IFNAMSIZ];
-
char bcma_core[IFNAMSIZ];
-
- char virtio_core[IFNAMSIZ];
-
- char ccw_core[IFNAMSIZ];
+ char ccw_group[IFNAMSIZ];
};
/* retrieve on-board index number and label from firmware */
@@ -351,25 +350,6 @@ static int names_bcma(struct udev_device
return 0;
}
-static int names_virtio(struct udev_device *dev, struct netnames *names) {
- struct udev_device *virtdev;
- unsigned int core;
-
- virtdev = udev_device_get_parent_with_subsystem_devtype(dev, "virtio", NULL);
- if (!virtdev)
- return -ENOENT;
-
- /* core num */
- if (sscanf(udev_device_get_sysname(virtdev), "virtio%u", &core) != 1)
- return -EINVAL;
- /* suppress the common core == 0 */
- if (core > 0)
- snprintf(names->virtio_core, sizeof(names->virtio_core), "v%u", core);
-
- names->type = NET_VIRTIO;
- return 0;
-}
-
static int names_ccw(struct udev_device *dev, struct netnames *names) {
struct udev_device *cdev;
const char *bus_id;
@@ -402,8 +382,8 @@ static int names_ccw(struct udev_device
return -EINVAL;
/* Store the CCW bus-ID for use as network device name */
- rc = snprintf(names->ccw_core, sizeof(names->ccw_core), "ccw%s", bus_id);
- if (rc >= 0 && rc < (int)sizeof(names->ccw_core))
+ rc = snprintf(names->ccw_group, sizeof(names->ccw_group), "ccw%s", bus_id);
+ if (rc >= 0 && rc < (int)sizeof(names->ccw_group))
names->type = NET_CCWGROUP;
return 0;
}
@@ -472,10 +452,10 @@ static int builtin_net_id(struct udev_de
return EXIT_FAILURE;
i = strtoul(s, NULL, 0);
switch (i) {
- case 1: /* ARPHRD_ETHER */
+ case ARPHRD_ETHER:
prefix = "en";
break;
- case 256: /* ARPHRD_SLIP */
+ case ARPHRD_SLIP:
prefix = "sl";
break;
default:
@@ -517,7 +497,7 @@ static int builtin_net_id(struct udev_de
if (err >= 0 && names.type == NET_CCWGROUP) {
char str[IFNAMSIZ];
- if (snprintf(str, sizeof(str), "%s%s", prefix, names.ccw_core) < (int)sizeof(str))
+ if (snprintf(str, sizeof(str), "%s%s", prefix, names.ccw_group) < (int)sizeof(str))
udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
goto out;
}
@@ -578,22 +558,6 @@ static int builtin_net_id(struct udev_de
udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);
goto out;
}
-
- /* virtio bus */
- err = names_virtio(dev, &names);
- if (err >= 0 && names.type == NET_VIRTIO) {
- char str[IFNAMSIZ];
-
- if (names.pci_path[0])
- if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.virtio_core) < (int)sizeof(str))
- udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
-
- if (names.pci_slot[0])
- if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.virtio_core) < (int)sizeof(str))
- udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);
- goto out;
- }
-
out:
return EXIT_SUCCESS;
}
--- src/udev/udev-builtin-path_id.c
+++ src/udev/udev-builtin-path_id.c 2014-03-28 09:27:20.402735390 +0000
@@ -571,9 +571,6 @@ static int builtin_path_id(struct udev_d
} else if (streq(subsys, "xen")) {
path_prepend(&path, "xen-%s", udev_device_get_sysname(parent));
parent = skip_subsystem(parent, "xen");
- } else if (streq(subsys, "virtio")) {
- path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent));
- parent = skip_subsystem(parent, "virtio");
} else if (streq(subsys, "scm")) {
path_prepend(&path, "scm-%s", udev_device_get_sysname(parent));
parent = skip_subsystem(parent, "scm");