!49 solve coredump bug caused by fstype being NULL during mount
Merge pull request !49 from JingWoo/4.0.3
This commit is contained in:
commit
449229f961
@ -1,7 +1,7 @@
|
|||||||
From 8a62b519510080bb361cdd058d0e7a5edd955a95 Mon Sep 17 00:00:00 2001
|
From 8a62b519510080bb361cdd058d0e7a5edd955a95 Mon Sep 17 00:00:00 2001
|
||||||
From: lifeng68 <lifeng68@huawei.com>
|
From: lifeng68 <lifeng68@huawei.com>
|
||||||
Date: Wed, 15 Jul 2020 09:32:32 +0800
|
Date: Wed, 15 Jul 2020 09:32:32 +0800
|
||||||
Subject: [PATCH 1/4] huawei: adapt to huawei 4.0.3
|
Subject: [PATCH 1/5] huawei: adapt to huawei 4.0.3
|
||||||
|
|
||||||
Signed-off-by: lifeng68 <lifeng68@huawei.com>
|
Signed-off-by: lifeng68 <lifeng68@huawei.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From 0b8bc902c0c7acb54efb1fd4be5121dbf9a08598 Mon Sep 17 00:00:00 2001
|
From 0b8bc902c0c7acb54efb1fd4be5121dbf9a08598 Mon Sep 17 00:00:00 2001
|
||||||
From: wujing <wujing50@huawei.com>
|
From: wujing <wujing50@huawei.com>
|
||||||
Date: Wed, 15 Jul 2020 16:09:35 +0800
|
Date: Wed, 15 Jul 2020 16:09:35 +0800
|
||||||
Subject: [PATCH 2/4] add mount label for rootfs
|
Subject: [PATCH 2/5] add mount label for rootfs
|
||||||
|
|
||||||
Signed-off-by: wujing <wujing50@huawei.com>
|
Signed-off-by: wujing <wujing50@huawei.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From c0f37e083c49cfcb9441743a409fdee44d32d7c5 Mon Sep 17 00:00:00 2001
|
From c0f37e083c49cfcb9441743a409fdee44d32d7c5 Mon Sep 17 00:00:00 2001
|
||||||
From: wujing <wujing50@huawei.com>
|
From: wujing <wujing50@huawei.com>
|
||||||
Date: Thu, 16 Jul 2020 16:39:35 +0800
|
Date: Thu, 16 Jul 2020 16:39:35 +0800
|
||||||
Subject: [PATCH 3/4] format code and verify mount mode
|
Subject: [PATCH 3/5] format code and verify mount mode
|
||||||
|
|
||||||
Signed-off-by: wujing <wujing50@huawei.com>
|
Signed-off-by: wujing <wujing50@huawei.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From b1ef723b4f437aad3c0c0497174bc7d3444426cd Mon Sep 17 00:00:00 2001
|
From b1ef723b4f437aad3c0c0497174bc7d3444426cd Mon Sep 17 00:00:00 2001
|
||||||
From: wujing <wujing50@huawei.com>
|
From: wujing <wujing50@huawei.com>
|
||||||
Date: Mon, 20 Jul 2020 15:30:42 +0800
|
Date: Mon, 20 Jul 2020 15:30:42 +0800
|
||||||
Subject: [PATCH 4/4] Removes the definition of the thread attributes object
|
Subject: [PATCH 4/5] Removes the definition of the thread attributes object
|
||||||
|
|
||||||
Signed-off-by: wujing <wujing50@huawei.com>
|
Signed-off-by: wujing <wujing50@huawei.com>
|
||||||
---
|
---
|
||||||
|
|||||||
@ -0,0 +1,65 @@
|
|||||||
|
From 405b048dc82a8695b8a400524787243f3898cbd6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wujing <wujing50@huawei.com>
|
||||||
|
Date: Tue, 21 Jul 2020 17:30:17 +0800
|
||||||
|
Subject: [PATCH 5/5] solve coredump bug caused by fstype being NULL during
|
||||||
|
mount
|
||||||
|
|
||||||
|
Signed-off-by: wujing <wujing50@huawei.com>
|
||||||
|
---
|
||||||
|
src/lxc/lsm/selinux.c | 3 +--
|
||||||
|
src/lxc/utils.c | 7 ++++---
|
||||||
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lxc/lsm/selinux.c b/src/lxc/lsm/selinux.c
|
||||||
|
index ceac0889..837a3da3 100644
|
||||||
|
--- a/src/lxc/lsm/selinux.c
|
||||||
|
+++ b/src/lxc/lsm/selinux.c
|
||||||
|
@@ -68,7 +68,6 @@ static int selinux_process_label_set(const char *inlabel, struct lxc_conf *conf,
|
||||||
|
|
||||||
|
label = inlabel ? inlabel : conf->lsm_se_context;
|
||||||
|
if (!label) {
|
||||||
|
-
|
||||||
|
label = DEFAULT_LABEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -273,7 +272,7 @@ static int selinux_relabel(const char *path, const char *label, bool shared)
|
||||||
|
{
|
||||||
|
__do_free char *tmp_file_label = NULL;
|
||||||
|
|
||||||
|
- if (label == NULL) {
|
||||||
|
+ if (path == NULL || label == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
|
||||||
|
index 5ec6117f..95c00cfe 100644
|
||||||
|
--- a/src/lxc/utils.c
|
||||||
|
+++ b/src/lxc/utils.c
|
||||||
|
@@ -1230,7 +1230,7 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
|
||||||
|
|
||||||
|
ret = mount(mntsrc, destbuf, fstype, flags, mnt_opts);
|
||||||
|
saved_errno = errno;
|
||||||
|
- if (ret < 0 && strcmp(fstype, "mqueue") == 0) {
|
||||||
|
+ if (ret < 0 && fstype != NULL && strcmp(fstype, "mqueue") == 0) {
|
||||||
|
INFO("older kernels don't support labeling of /dev/mqueue, retry without selinux context");
|
||||||
|
ret = mount(mntsrc, destbuf, fstype, flags, data);
|
||||||
|
saved_errno = errno;
|
||||||
|
@@ -1250,12 +1250,13 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ISULAD
|
||||||
|
- if (strcmp(fstype, "mqueue") == 0 && lsm_file_label_set(dest, mount_label) != 0) {
|
||||||
|
+ if (fstype != NULL && strcmp(fstype, "mqueue") == 0 && lsm_file_label_set(dest, mount_label) != 0) {
|
||||||
|
ERROR("Failed to set file label on %s", dest);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (strcmp(fstype, "bind") == 0 && relabel_bind_mount_source(src, fstype, (const char *)data, mount_label) != 0) {
|
||||||
|
+ if (fstype != NULL && strcmp(fstype, "bind") == 0 &&
|
||||||
|
+ relabel_bind_mount_source(src, fstype, (const char *)data, mount_label) != 0) {
|
||||||
|
ERROR("Failed to reabel %s with %s", src, mount_label);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
1
lxc.spec
1
lxc.spec
@ -12,6 +12,7 @@ Patch9001: 0001-huawei-adapt-to-huawei-4.0.3.patch
|
|||||||
Patch9002: 0002-add-mount-label-for-rootfs.patch
|
Patch9002: 0002-add-mount-label-for-rootfs.patch
|
||||||
Patch9003: 0003-format-code-and-verify-mount-mode.patch
|
Patch9003: 0003-format-code-and-verify-mount-mode.patch
|
||||||
Patch9004: 0004-Removes-the-definition-of-the-thread-attributes-obje.patch
|
Patch9004: 0004-Removes-the-definition-of-the-thread-attributes-obje.patch
|
||||||
|
Patch9005: 0005-solve-coredump-bug-caused-by-fstype-being-NULL-durin.patch
|
||||||
|
|
||||||
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
||||||
BuildRequires: pkgconfig(libseccomp)
|
BuildRequires: pkgconfig(libseccomp)
|
||||||
|
|||||||
@ -2,3 +2,4 @@
|
|||||||
0002-add-mount-label-for-rootfs.patch
|
0002-add-mount-label-for-rootfs.patch
|
||||||
0003-format-code-and-verify-mount-mode.patch
|
0003-format-code-and-verify-mount-mode.patch
|
||||||
0004-Removes-the-definition-of-the-thread-attributes-obje.patch
|
0004-Removes-the-definition-of-the-thread-attributes-obje.patch
|
||||||
|
0005-solve-coredump-bug-caused-by-fstype-being-NULL-durin.patch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user