summaryrefslogtreecommitdiff
path: root/poky/meta/recipes-extended/ltp
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/recipes-extended/ltp')
-rw-r--r--poky/meta/recipes-extended/ltp/ltp/0001-syscalls-ioctl_ns05.c-ioctl_ns06.c-Fix-too-small-buf.patch59
-rw-r--r--poky/meta/recipes-extended/ltp/ltp_20210524.bb21
2 files changed, 70 insertions, 10 deletions
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-ioctl_ns05.c-ioctl_ns06.c-Fix-too-small-buf.patch b/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-ioctl_ns05.c-ioctl_ns06.c-Fix-too-small-buf.patch
new file mode 100644
index 000000000..08b88a38f
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-ioctl_ns05.c-ioctl_ns06.c-Fix-too-small-buf.patch
@@ -0,0 +1,59 @@
+From af2b6f5ee6b171078b18246dd73f71cf6e350859 Mon Sep 17 00:00:00 2001
+From: Marius Hillenbrand <mhillen@linux.ibm.com>
+Date: Mon, 19 Jul 2021 13:58:35 +0800
+Subject: [PATCH] syscalls/ioctl_ns05.c, ioctl_ns06.c: Fix too small buffer for
+ path
+
+commit af2b6f5ee6b171078b18246dd73f71cf6e350859 upstream.
+
+Resize the buffer used for paths into /proc/ to grant enough space
+for long PIDs. While at it, replace sprintf with snprintf to avoid
+buffer overflows if we ever ran out of space again.
+
+Fixes: #847
+Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
+Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>
+Upstream-Status: Backport
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+
+diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
+index a67ddbe2c66f..52613810c7ce 100644
+--- a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
++++ b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
+@@ -59,10 +59,10 @@ static void run(void)
+ if (pid == -1)
+ tst_brk(TBROK | TERRNO, "ltp_clone failed");
+
+- char child_namespace[20];
++ char child_namespace[30];
+ int my_fd, child_fd, parent_fd;
+
+- sprintf(child_namespace, "/proc/%i/ns/pid", pid);
++ snprintf(child_namespace, sizeof(child_namespace), "/proc/%i/ns/pid", pid);
+ my_fd = SAFE_OPEN("/proc/self/ns/pid", O_RDONLY);
+ child_fd = SAFE_OPEN(child_namespace, O_RDONLY);
+ parent_fd = ioctl(child_fd, NS_GET_PARENT);
+diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
+index b6ac80208d02..c30f7de91e09 100644
+--- a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
++++ b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
+@@ -51,14 +51,14 @@ static int child(void *arg LTP_ATTRIBUTE_UNUSED)
+
+ static void run(void)
+ {
+- char child_namespace[20];
++ char child_namespace[30];
+
+ pid_t pid = ltp_clone(CLONE_NEWUSER | SIGCHLD, &child, 0,
+ STACK_SIZE, child_stack);
+ if (pid == -1)
+ tst_brk(TBROK | TERRNO, "ltp_clone failed");
+
+- sprintf(child_namespace, "/proc/%i/ns/user", pid);
++ snprintf(child_namespace, sizeof(child_namespace), "/proc/%i/ns/user", pid);
+ int my_fd, child_fd, parent_fd;
+
+ my_fd = SAFE_OPEN("/proc/self/ns/user", O_RDONLY);
+--
+2.32.0
+
diff --git a/poky/meta/recipes-extended/ltp/ltp_20210524.bb b/poky/meta/recipes-extended/ltp/ltp_20210524.bb
index 26fd9ac04..20e2deffa 100644
--- a/poky/meta/recipes-extended/ltp/ltp_20210524.bb
+++ b/poky/meta/recipes-extended/ltp/ltp_20210524.bb
@@ -15,22 +15,23 @@ LIC_FILES_CHKSUM = "\
"
DEPENDS = "attr libaio libcap acl openssl zip-native"
-DEPENDS_append_libc-musl = " fts "
-EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
-EXTRA_OECONF_append_libc-musl = " LIBS=-lfts "
+DEPENDS:append:libc-musl = " fts "
+EXTRA_OEMAKE:append:libc-musl = " LIBC=musl "
+EXTRA_OECONF:append:libc-musl = " LIBS=-lfts "
# since ltp contains x86-64 assembler which uses the frame-pointer register,
# set -fomit-frame-pointer x86-64 to handle cases where optimisation
# is set to -O0 or frame pointers have been enabled by -fno-omit-frame-pointer
# earlier in CFLAGS, etc.
-CFLAGS_append_x86-64 = " -fomit-frame-pointer"
+CFLAGS:append:x86-64 = " -fomit-frame-pointer"
-CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
-CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
+CFLAGS:append:powerpc64 = " -D__SANE_USERSPACE_TYPES__"
+CFLAGS:append:mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
SRCREV = "0fb171f2beddaf64bd27597577c206c0f892b3cd"
SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://0001-Remove-OOM-tests-from-runtest-mm.patch \
+ file://0001-syscalls-ioctl_ns05.c-ioctl_ns06.c-Fix-too-small-buf.patch \
"
S = "${WORKDIR}/git"
@@ -75,7 +76,7 @@ do_install(){
sed -e '/^memcg_stress/d' -i ${D}${prefix}/runtest/controllers
}
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
attr \
bash \
bc \
@@ -105,11 +106,11 @@ RDEPENDS_${PN} = "\
tar \
"
-FILES_${PN} += "${prefix}/* ${prefix}/runtest/* ${prefix}/scenario_groups/* ${prefix}/testcases/bin/* ${prefix}/testcases/bin/*/bin/* ${prefix}/testscripts/* ${prefix}/testcases/open_posix_testsuite/* ${prefix}/testcases/open_posix_testsuite/conformance/* ${prefix}/testcases/open_posix_testsuite/Documentation/* ${prefix}/testcases/open_posix_testsuite/functional/* ${prefix}/testcases/open_posix_testsuite/include/* ${prefix}/testcases/open_posix_testsuite/scripts/* ${prefix}/testcases/open_posix_testsuite/stress/* ${prefix}/testcases/open_posix_testsuite/tools/* ${prefix}/testcases/data/nm01/lib.a ${prefix}/lib/libmem.a"
+FILES:${PN} += "${prefix}/* ${prefix}/runtest/* ${prefix}/scenario_groups/* ${prefix}/testcases/bin/* ${prefix}/testcases/bin/*/bin/* ${prefix}/testscripts/* ${prefix}/testcases/open_posix_testsuite/* ${prefix}/testcases/open_posix_testsuite/conformance/* ${prefix}/testcases/open_posix_testsuite/Documentation/* ${prefix}/testcases/open_posix_testsuite/functional/* ${prefix}/testcases/open_posix_testsuite/include/* ${prefix}/testcases/open_posix_testsuite/scripts/* ${prefix}/testcases/open_posix_testsuite/stress/* ${prefix}/testcases/open_posix_testsuite/tools/* ${prefix}/testcases/data/nm01/lib.a ${prefix}/lib/libmem.a"
# Avoid stripping some generated binaries otherwise some of the ltp tests such as ldd01 & nm01 fail
INHIBIT_PACKAGE_STRIP_FILES = "${prefix}/testcases/bin/nm01 ${prefix}/testcases/bin/ldd01"
-INSANE_SKIP_${PN} += "already-stripped staticdev"
+INSANE_SKIP:${PN} += "already-stripped staticdev"
remove_broken_musl_sources() {
[ "${TCLIBC}" = "musl" ] || return 0
@@ -135,4 +136,4 @@ do_patch[postfuncs] += "remove_broken_musl_sources"
# exist on the running system. For instance it has specific checks for
# csh and ksh which are not typically part of OpenEmbedded systems (but
# can be added via additional layers.)
-SKIP_FILEDEPS_${PN} = '1'
+SKIP_FILEDEPS:${PN} = '1'