From ff9d657d4492552115d0dfbc84202e7d01f863da Mon Sep 17 00:00:00 2001 From: jikai Date: Thu, 22 Feb 2024 17:35:53 +0800 Subject: [PATCH] append mntopt to mntdata if not found in mount_opt Signed-off-by: jikai --- ...to-mntdata-if-not-found-in-mount_opt.patch | 60 +++++++++++++++++++ lxc.spec | 9 ++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 0015-append-mntopt-to-mntdata-if-not-found-in-mount_opt.patch diff --git a/0015-append-mntopt-to-mntdata-if-not-found-in-mount_opt.patch b/0015-append-mntopt-to-mntdata-if-not-found-in-mount_opt.patch new file mode 100644 index 0000000..699c17f --- /dev/null +++ b/0015-append-mntopt-to-mntdata-if-not-found-in-mount_opt.patch @@ -0,0 +1,60 @@ +From 1d885dd392eb84816050b6ecffcfcccdfb8e812c Mon Sep 17 00:00:00 2001 +From: jikai +Date: Thu, 22 Feb 2024 17:22:12 +0800 +Subject: [PATCH] append mntopt to mntdata if not found in mount_opt + +Signed-off-by: jikai +--- + src/lxc/conf.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/src/lxc/conf.c b/src/lxc/conf.c +index c73ba04..595e605 100644 +--- a/src/lxc/conf.c ++++ b/src/lxc/conf.c +@@ -2469,7 +2469,11 @@ int parse_mntopts_legacy(const char *mntopts, unsigned long *mntflags, char **mn + return 0; + } + ++#ifdef HAVE_ISULAD ++static int parse_vfs_attr(struct lxc_mount_options *opts, char *opt, size_t size, char **end, char *mntopts_new) ++#else + static int parse_vfs_attr(struct lxc_mount_options *opts, char *opt, size_t size) ++#endif + { + /* + * If opt is found in mount_opt, set or clear flags. +@@ -2525,6 +2529,18 @@ static int parse_vfs_attr(struct lxc_mount_options *opts, char *opt, size_t size + return 0; + } + ++#ifdef HAVE_ISULAD ++ /* Add opt to opts->data if not found in mount_opt and propagation_opt. ++ * Since in safe_mount, if 'z' option was set and selinux was enabled ++ * isulad should relabel the mount point as share using opts->data. ++ */ ++ if (!*end) { ++ *end = stpcpy(mntopts_new, opt); ++ } else { ++ *end = stpcpy(*end, ","); ++ *end = stpcpy(*end, opt); ++ } ++#endif + return 0; + } + +@@ -2564,7 +2580,11 @@ int parse_mount_attrs(struct lxc_mount_options *opts, const char *mntopts) + } + + /* This is a generic vfs option. */ ++#ifdef HAVE_ISULAD ++ ret = parse_vfs_attr(opts, mntopt_cur, size, &end, mntopts_new); ++#else + ret = parse_vfs_attr(opts, mntopt_cur, size); ++#endif + if (ret < 0) + return syserror("Failed to parse mount attributes: \"%s\"", mntopt_cur); + } +-- +2.33.0 + diff --git a/lxc.spec b/lxc.spec index 73f98c2..e2c3658 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 11 +%global _release 12 %global enable_isulad 1 Name: lxc @@ -23,6 +23,7 @@ Patch0011: 0011-skip-setup-console-if-disable-pty-and-fix-syscontain.patch Patch0012: 0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch Patch0013: 0013-ensure-cpuset-cgroup-built-while-writing-cgroup.proc.patch Patch0014: 0014-fix-cpuset-cgroup-error.patch +Patch0015: 0015-append-mntopt-to-mntdata-if-not-found-in-mount_opt.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -210,6 +211,12 @@ meson test -C build %endif %changelog +* Thu Feb 22 2024 jikai - 5.0.2-12 +- Type: bugfix +- ID:NA +- SUG:NA +- DESC: append mntopt to mntdata if not found in mount_opt + * Wed Feb 07 2024 jikai - 5.0.2-11 - Type: bugfix - ID:NA -- Gitee