[OE-core] [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel

2019-09-03 Thread Hongzhi.Song
There are two errors when compile an out of tree kernel module
using sdk:

1. "In file included from ./include/linux/seqlock.h:36:0,
 from ./include/linux/time.h:6,
 from ./include/linux/stat.h:19,
 from ./include/linux/module.h:10,
 from kernel-module/char.c:1:
./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
file or directory"

mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.

And there is only generated/ under ${B}/arch/${ARCH}/include/,
so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
in case of other files under generated/ is needed in the future.

2. "/bin/sh: scripts/mod/modpost: No such file or directory"

Copy above files or directory to $kerneldir/build/ fix the errors.

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb 
b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 3900489..feff9f1 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -80,6 +80,12 @@ do_install() {
 
cp .config $kerneldir/build
 
+   if [ -d arch/${ARCH}/include ]; then
+   cp -a --parents arch/${ARCH}/include $kerneldir/build/
+   fi
+
+   cp --parents scripts/mod/modpost $kerneldir/build/
+
# This scripts copy blow up QA, so for now, we require a more
# complex 'make scripts' to restore these, versus copying them
# here. Left as a reference to indicate that we know the scripts must
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta-realtime][PATCH] layer.conf: add openembedded-layer to LAYERDEPENDS

2019-08-30 Thread Hongzhi.Song
latencytop.bb depends on gtk+ which exists at openembedded-layer.

So we should add openembedded-layer to LAYERDEPENDS, otherwise
"yocto-check-layer-wrapper meta-realtime --dependency 'cat mylist'"
will fail with "NO PROVIDE gtk+ ..."

Signed-off-by: Hongzhi.Song 
---
 conf/layer.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/conf/layer.conf b/conf/layer.conf
index cb24358..72ae7ad 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -16,4 +16,4 @@ BBFILE_PRIORITY_realtime = "5"
 # cause compatibility issues with other layers
 LAYERVERSION_realtime = "1"
 LAYERSERIES_COMPAT_realtime = "thud warrior"
-LAYERDEPENDS_realtime = "core"
+LAYERDEPENDS_realtime = "core openembedded-layer"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] kernel-devsrc: cp Documentation/ to sdk kernel

2019-08-12 Thread Hongzhi.Song
A new patch let kernel source Documentation/Kconfig in top Kconfig
So kernel-devsrc should include Documentation/ too.
Otherwise "make scripts" will fails.

patch:
commit b1663d7e3a7961fc45262fd68a89253f2803036c
Author: Mauro Carvalho Chehab 
Date:   Tue Jun 4 09:26:27 2019 -0300

docs: Kbuild/Makefile: allow check for missing docs at build time

While this doesn't make sense for production Kernels, in order to
avoid regressions when documents are touched, let's add a
check target at the make file.

Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Jonathan Corbet 

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb 
b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 5ec5929..a874e06 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -65,7 +65,7 @@ do_install() {
 )
 
 # then drop all but the needed Makefiles/Kconfig files
-rm -rf $kerneldir/build/Documentation
+#rm -rf $kerneldir/build/Documentation
 rm -rf $kerneldir/build/scripts
 rm -rf $kerneldir/build/include
 
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] lttng-tools: enable manpages option for configure

2019-08-09 Thread Hongzhi.Song
If disable this option, production will prompt "No manual entry for
lttng-help" when execute "lttng --help" series commands.

Enable the option will make lttng-tools compile manpages and then
package them into lttng-tools-doc/.

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb 
b/meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb
index aa6d19d..9270916 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.10.7.bb
@@ -21,7 +21,7 @@ PYTHON_OPTION = 
"am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
  am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
  
PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
 "
-PACKAGECONFIG ??= "lttng-ust"
+PACKAGECONFIG ??= "lttng-ust manpages"
 PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 
swig-native"
 PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust"
 PACKAGECONFIG[kmod] = "--with-kmod, --without-kmod, kmod"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: getrlimit03: adjust-a-bit-of-code-to-compatiable-with mips32

2019-07-17 Thread Hongzhi.Song
Error info:
getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
 but __NR_getrlimit(0) had rlim_cur = 7fff

According to kernel code: [arch/mips/include/uapi/asm/resource.h]
RLIM_INFINITY is set to 0x7fffUL instead of ULONG_MAX on mips32.

 /*
 * SuS says limits have to be unsigned.
 * Which makes a ton more sense anyway,
 * but we keep the old value on MIPS32,
 * for compatibility:
 */
 #ifndef __mips64
 # define RLIM_INFINITY  0x7fffUL
 #endif

Adding conditional statement about mips to fix this.

Signed-off-by: Hongzhi.Song 
---
 ...-adjust-a-bit-of-code-to-compatiable-with.patch | 62 ++
 ...efine-TST_ABI-32-64-to-detect-target-type.patch | 74 ++
 meta/recipes-extended/ltp/ltp_20190115.bb  |  2 +
 3 files changed, 138 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-lapi-Define-TST_ABI-32-64-to-detect-target-type.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch
 
b/meta/recipes-extended/ltp/ltp/0001-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch
new file mode 100644
index 000..7b66229
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch
@@ -0,0 +1,62 @@
+From e79652a3839869b1983d65999e5d5dcb50bc9cd7 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Mon, 15 Jul 2019 03:39:06 -0400
+Subject: [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32
+
+Error info:
+getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
+ but __NR_getrlimit(0) had rlim_cur = 7fff
+
+According to kernel code: [arch/mips/include/uapi/asm/resource.h]
+RLIM_INFINITY is set to 0x7fffUL instead of ULONG_MAX on mips32.
+
+ /*
+ * SuS says limits have to be unsigned.
+ * Which makes a ton more sense anyway,
+ * but we keep the old value on MIPS32,
+ * for compatibility:
+ */
+ #ifndef __mips64
+ # define RLIM_INFINITY  0x7fffUL
+ #endif
+
+Adding conditional statement about mips to fix this.
+
+Signed-off-by: Jan Stancek 
+Signed-off-by: Hongzhi.Song 
+
+Upstream-Status: Backport
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c 
b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+index e4d56c4..03bd821 100644
+--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
 b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+@@ -26,6 +26,7 @@
+ 
+ #include "tst_test.h"
+ #include "lapi/syscalls.h"
++#include "lapi/abisize.h"
+ 
+ /**
+  * Linux provides an "old" getrlimit syscall handler that uses signed long,
+@@ -61,7 +62,12 @@ struct rlimit_ulong {
+   unsigned long rlim_cur;
+   unsigned long rlim_max;
+ };
+-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
++
++#if defined(__mips__) && defined(TST_ABI32)
++  const unsigned long RLIM_INFINITY_UL = 0x7fffUL;
++#else
++  const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
++#endif
+ 
+ static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
+ {
+-- 
+2.8.1
+
diff --git 
a/meta/recipes-extended/ltp/ltp/0001-lapi-Define-TST_ABI-32-64-to-detect-target-type.patch
 
b/meta/recipes-extended/ltp/ltp/0001-lapi-Define-TST_ABI-32-64-to-detect-target-type.patch
new file mode 100644
index 000..a6129d3
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-lapi-Define-TST_ABI-32-64-to-detect-target-type.patch
@@ -0,0 +1,74 @@
+From d5293d73b760268a6b200ab7d9323e37700e6a8c Mon Sep 17 00:00:00 2001
+From: Petr Vorel 
+Date: Thu, 28 Mar 2019 07:11:25 +0100
+Subject: [PATCH] lapi: Define TST_ABI{,32,64} to detect target type
+
+This is meant to be a replacement of __WORDSIZE definition.
+
+Motivation was instead of finding, where all libc define
+__WORDSIZE, which is usually used for detecting target type
+(at least MUSL defines it in different place than other libc)
+we define our own constant.
+
+Suggested-by: Cyril Hrubis 
+Signed-off-by: Petr Vorel 
+
+Upstream-Status: Backport
+Signed-off-by: Hongzhi.Song 
+---
+ include/lapi/abisize.h | 29 +
+ 1 file changed, 13 insertions(+), 16 deletions(-)
+
+diff --git a/include/lapi/abisize.h b/include/lapi/abisize.h
+index 897bdfd..9e6622c 100644
+--- a/include/lapi/abisize.h
 b/include/lapi/abisize.h
+@@ -1,25 +1,22 @@
++// SPDX-License-Identifier: GPL-2.0-or-later
+ /*
+- * Copyright (c) 2014 Linux Test Project
++ * Copyright (c) 2014-2019 Linux Test Project
+  *  Cyril Hrubis 
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License as
+- * published by the Free Software Fou

[OE-core] [PATCH] ltp: diotest4: Let kernel pick an address when calling mmap

2019-07-01 Thread Hongzhi.Song
Error:
diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
diotest4 11 TBROK : diotest4.c:368: Remaining cases broken

This is because the manually specified addr from mmap is invalid.
We should let kernel itself pick an addrress.

Signed-off-by: Hongzhi.Song 
---
 ...nel-pick-an-address-when-calling-mma.patch | 49 +++
 meta/recipes-extended/ltp/ltp_20190115.bb |  3 +-
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
 
b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
new file mode 100644
index 00..620027bd0d
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
@@ -0,0 +1,49 @@
+From 785809201ad7dea2872d493efbfd65bb215710d6 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Sun, 30 Jun 2019 21:56:16 -0400
+Subject: [PATCH] diotest4: Let kernel pick an address when calling mmap
+
+Error:
+diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
+diotest4 11 TBROK : diotest4.c:368: Remaining cases broken
+
+This is because the specified addr from mmap is invalid.
+We should let kernel itself pick an addrress.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Submitted 
[https://lists.linux.it/pipermail/ltp/2019-June/012570.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/io/direct_io/diotest4.c | 8 ++--
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/testcases/kernel/io/direct_io/diotest4.c 
b/testcases/kernel/io/direct_io/diotest4.c
+index e4616e4..d88c431 100644
+--- a/testcases/kernel/io/direct_io/diotest4.c
 b/testcases/kernel/io/direct_io/diotest4.c
+@@ -352,18 +352,14 @@ int main(int argc, char *argv[])
+   total++;
+ 
+   /* Test-10: read, write to a mmaped file */
+-  shm_base = (char *)(((long)sbrk(0) + (shmsz - 1)) & ~(shmsz - 1));
+-  if (shm_base == NULL) {
+-  tst_brkm(TBROK, cleanup, "sbrk failed: %s", strerror(errno));
+-  }
+   offset = 4096;
+   count = bufsize;
+   if ((fd = open(filename, O_DIRECT | O_RDWR)) < 0) {
+   tst_brkm(TBROK, cleanup, "can't open %s: %s",
+filename, strerror(errno));
+   }
+-  shm_base = mmap(shm_base, 0x10, PROT_READ | PROT_WRITE,
+-  MAP_SHARED | MAP_FIXED, fd, 0);
++  shm_base = mmap(NULL, 0x10, PROT_READ | PROT_WRITE,
++  MAP_SHARED, fd, 0);
+   if (shm_base == (caddr_t) - 1) {
+   tst_brkm(TBROK, cleanup, "can't mmap file: %s",
+strerror(errno));
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20190115.bb 
b/meta/recipes-extended/ltp/ltp_20190115.bb
index e91dea2f19..b8a7e673d3 100644
--- a/meta/recipes-extended/ltp/ltp_20190115.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -50,7 +50,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
file://setregid01-security-string-formatting.patch \

file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
-  
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+   
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+   
file://0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch\
"
 
 S = "${WORKDIR}/git"
-- 
2.21.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: diotest4: Let kernel pick an address when calling mmap

2019-07-01 Thread Hongzhi.Song
Error:
diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
diotest4 11 TBROK : diotest4.c:368: Remaining cases broken

This is because the manually specified addr from mmap is invalid.
We should let kernel itself pick an addrress.

Signed-off-by: Hongzhi.Song 
---
 ...nel-pick-an-address-when-calling-mma.patch | 50 +++
 meta/recipes-extended/ltp/ltp_20190115.bb |  3 +-
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
 
b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
new file mode 100644
index 00..109c8ea80c
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
@@ -0,0 +1,50 @@
+From 785809201ad7dea2872d493efbfd65bb215710d6 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Sun, 30 Jun 2019 21:56:16 -0400
+Subject: [PATCH] diotest4: Let kernel pick an address when calling mmap
+
+Error:
+diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
+diotest4 11 TBROK : diotest4.c:368: Remaining cases broken
+
+This is because the specified addr from mmap is invalid.
+We should let kernel itself pick an addrress.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Submitted
+[https://lists.linux.it/pipermail/ltp/2019-June/012570.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/io/direct_io/diotest4.c | 8 ++--
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/testcases/kernel/io/direct_io/diotest4.c 
b/testcases/kernel/io/direct_io/diotest4.c
+index e4616e4..d88c431 100644
+--- a/testcases/kernel/io/direct_io/diotest4.c
 b/testcases/kernel/io/direct_io/diotest4.c
+@@ -352,18 +352,14 @@ int main(int argc, char *argv[])
+   total++;
+ 
+   /* Test-10: read, write to a mmaped file */
+-  shm_base = (char *)(((long)sbrk(0) + (shmsz - 1)) & ~(shmsz - 1));
+-  if (shm_base == NULL) {
+-  tst_brkm(TBROK, cleanup, "sbrk failed: %s", strerror(errno));
+-  }
+   offset = 4096;
+   count = bufsize;
+   if ((fd = open(filename, O_DIRECT | O_RDWR)) < 0) {
+   tst_brkm(TBROK, cleanup, "can't open %s: %s",
+filename, strerror(errno));
+   }
+-  shm_base = mmap(shm_base, 0x10, PROT_READ | PROT_WRITE,
+-  MAP_SHARED | MAP_FIXED, fd, 0);
++  shm_base = mmap(NULL, 0x10, PROT_READ | PROT_WRITE,
++  MAP_SHARED, fd, 0);
+   if (shm_base == (caddr_t) - 1) {
+   tst_brkm(TBROK, cleanup, "can't mmap file: %s",
+strerror(errno));
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20190115.bb 
b/meta/recipes-extended/ltp/ltp_20190115.bb
index e91dea2f19..b8a7e673d3 100644
--- a/meta/recipes-extended/ltp/ltp_20190115.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -50,7 +50,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
file://setregid01-security-string-formatting.patch \

file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
-  
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+   
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+   
file://0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch\
"
 
 S = "${WORKDIR}/git"
-- 
2.21.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: diotest4: Let kernel pick an address when calling mmap

2019-07-01 Thread Hongzhi.Song
Error:
diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
diotest4 11 TBROK : diotest4.c:368: Remaining cases broken

This is because the manually specified addr from mmap is invalid.
We should let kernel itself pick an addrress.

Signed-off-by: Hongzhi.Song 
---
 ...nel-pick-an-address-when-calling-mma.patch | 50 +++
 meta/recipes-extended/ltp/ltp_20190115.bb |  3 +-
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
 
b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
new file mode 100644
index 00..109c8ea80c
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
@@ -0,0 +1,50 @@
+From 785809201ad7dea2872d493efbfd65bb215710d6 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Sun, 30 Jun 2019 21:56:16 -0400
+Subject: [PATCH] diotest4: Let kernel pick an address when calling mmap
+
+Error:
+diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
+diotest4 11 TBROK : diotest4.c:368: Remaining cases broken
+
+This is because the specified addr from mmap is invalid.
+We should let kernel itself pick an addrress.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Submitted
+[https://lists.linux.it/pipermail/ltp/2019-June/012570.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/io/direct_io/diotest4.c | 8 ++--
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/testcases/kernel/io/direct_io/diotest4.c 
b/testcases/kernel/io/direct_io/diotest4.c
+index e4616e4..d88c431 100644
+--- a/testcases/kernel/io/direct_io/diotest4.c
 b/testcases/kernel/io/direct_io/diotest4.c
+@@ -352,18 +352,14 @@ int main(int argc, char *argv[])
+   total++;
+ 
+   /* Test-10: read, write to a mmaped file */
+-  shm_base = (char *)(((long)sbrk(0) + (shmsz - 1)) & ~(shmsz - 1));
+-  if (shm_base == NULL) {
+-  tst_brkm(TBROK, cleanup, "sbrk failed: %s", strerror(errno));
+-  }
+   offset = 4096;
+   count = bufsize;
+   if ((fd = open(filename, O_DIRECT | O_RDWR)) < 0) {
+   tst_brkm(TBROK, cleanup, "can't open %s: %s",
+filename, strerror(errno));
+   }
+-  shm_base = mmap(shm_base, 0x10, PROT_READ | PROT_WRITE,
+-  MAP_SHARED | MAP_FIXED, fd, 0);
++  shm_base = mmap(NULL, 0x10, PROT_READ | PROT_WRITE,
++  MAP_SHARED, fd, 0);
+   if (shm_base == (caddr_t) - 1) {
+   tst_brkm(TBROK, cleanup, "can't mmap file: %s",
+strerror(errno));
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20190115.bb 
b/meta/recipes-extended/ltp/ltp_20190115.bb
index e91dea2f19..b8a7e673d3 100644
--- a/meta/recipes-extended/ltp/ltp_20190115.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -50,7 +50,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
file://setregid01-security-string-formatting.patch \

file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
-  
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+   
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+   
file://0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch\
"
 
 S = "${WORKDIR}/git"
-- 
2.21.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH] ltp: fix shmctl01 failure when executed.

2019-06-27 Thread Hongzhi.Song
schmctl01 fails with following error:
[shmctl015  TFAIL  :  shmctl01.c:171: shmctl01 call failed - errno =
22 : Invalid argument]

Backport the patch from upstream can fix it.

Signed-off-by: Hongzhi.Song 
---
 ...se-hardcoded-index-0-for-SHM_STAT-te.patch | 81 +++
 meta/recipes-extended/ltp/ltp_20190115.bb |  1 +
 2 files changed, 82 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch
 
b/meta/recipes-extended/ltp/ltp/0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch
new file mode 100644
index 00..d837f073a9
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch
@@ -0,0 +1,81 @@
+From db0a43d9388be2c347a8306751bbe6bec086d062 Mon Sep 17 00:00:00 2001
+From: Jan Stancek 
+Date: Mon, 20 May 2019 20:47:20 +0200
+Subject: [PATCH] shmctl01: don't use hardcoded index == 0 for SHM_STAT test
+
+Test fails on SHM_STAT testcase:
+   shmctl015  TFAIL  :  shmctl01.c:173: shmctl01 call failed
+errno = 22 : Invalid argument
+   shmctl(0, SHM_STAT, 0x601060)   = -EINVAL
+
+since following commit:
+   commit 99db46ea292780cd978d56932d9445b1e8bdafe8
+   Author: Manfred Spraul 
+   Date:   Tue May 14 15:46:36 2019 -0700
+ ipc: do cyclic id allocation for the ipc object.
+
+Don't rely on index 0 being always available, but instead
+use (maximum) index returned by SHM_INFO.
+
+Signed-off-by: Jan Stancek 
+Reviewed-by: Petr Vorel 
+Acked-by: Cyril Hrubis 
+
+Upstream-Status: Backport from v20190517
+[https://lists.linux.it/pipermail/ltp/2019-May/012051.html]
+
+Signed-off-by: Hongzhi Song 
+---
+ testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 21 ++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c 
b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+index 1b46977..52bf23a 100644
+--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
 b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+@@ -79,6 +79,7 @@ static void func_info(int ret);
+ 
+ /* Check routine for SHM_STAT */
+ static void func_sstat(int ret);
++static void func_sstat_setup(void);
+ 
+ /* Check routine for SHM_LOCK */
+ static void func_lock(int ret);
+@@ -110,7 +111,7 @@ static struct test_case_t {
+ #endif
+   {_id_1, IPC_SET, , func_set, set_setup},
+   {_id_1, IPC_INFO, (struct shmid_ds *) , func_info, NULL},
+-  {_index, SHM_STAT, , func_sstat, NULL},
++  {_index, SHM_STAT, , func_sstat, func_sstat_setup},
+   {_id_1, SHM_LOCK, NULL, func_lock, NULL},
+   {_id_1, SHM_UNLOCK, NULL, func_unlock, NULL},
+   {_id_1, IPC_RMID, NULL, func_rmid, NULL},
+@@ -407,9 +408,23 @@ static void func_info(int ret)
+ static void func_sstat(int ret)
+ {
+   if (ret >= 0)
+-  tst_resm(TPASS, "get correct shared memory id");
++  tst_resm(TPASS, "get correct shared memory id for index: %d",
++  shm_index);
+   else
+-  tst_resm(TFAIL, "shared memory id is incorrect");
++  tst_resm(TFAIL, "shared memory id is incorrect, index: %d",
++  shm_index);
++}
++
++static void func_sstat_setup(void)
++{
++  struct shm_info tmp;
++  int ret;
++
++  ret = shmctl(shm_id_1, SHM_INFO, (void *));
++  if (ret < 0)
++  tst_resm(TFAIL|TERRNO, "shmctl(SHM_INFO)");
++  else
++  shm_index = ret;
+ }
+ 
+ static void func_lock(int ret)
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20190115.bb 
b/meta/recipes-extended/ltp/ltp_20190115.bb
index 1d0c00b64b..e91dea2f19 100644
--- a/meta/recipes-extended/ltp/ltp_20190115.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -50,6 +50,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
file://setregid01-security-string-formatting.patch \

file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
+  
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
"
 
 S = "${WORKDIR}/git"
-- 
2.21.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] runtime/ksample.py: correct a syntax and perfect item about architecture

2019-01-22 Thread Hongzhi.Song
Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 584d0fb..de2366a 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -105,7 +105,7 @@ class KSampleTest(KSample):
 # kprobe
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_kprobe_test(self):
-self.check_arch("x86 ppc")
+self.check_arch("x86_64 i686 ppc")
 index = ["kprobe", "kretprobe"]
 for i in index:
 self.kprobe_func(i)
@@ -173,9 +173,9 @@ class KSampleTest(KSample):
 def test_hw_breakpoint_example(self):
 # check arch
 status, output = self.target.run("uname -m")
-result = ("x86" in output) or ("aarch64" in output)
+result = ("x86_64" in output) or ("aarch64" in output)
 if not result:
-self.skipTest("the arch doesn't support hw breakpoint" % output)
+self.skipTest("the arch %s doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] oeqa/runtime/ksample.py: skip kprobe case except x86 and powerpc

2019-01-17 Thread Hongzhi.Song
A new commit was introduced to kernel, which caused kprobe sample case
failed on arm.
[kernel commit: e46daee53bb50b, ARM: 8806/1: kprobes: Fix false positive
with FORTIFY_SOURCE]

And according to author, the case just works on x86 and powerpc.
So we just promise that the case can pass on x86 and powerpc.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 354cc97673..584d0fb5e4 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -22,6 +22,12 @@ class KSample(OERuntimeTestCase):
 self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
+def check_arch(self, archset=''):
+status, output = self.target.run("uname -m")
+result = ("%s" % output) in archset
+if not result:
+self.skipTest("This case doesn't support %s" % output)
+
 def check_config(self, config_opt=''):
 cmd = "zcat /proc/config.gz | grep %s" % config_opt
 status, output = self.target.run(cmd)
@@ -99,6 +105,7 @@ class KSampleTest(KSample):
 # kprobe
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_kprobe_test(self):
+self.check_arch("x86 ppc")
 index = ["kprobe", "kretprobe"]
 for i in index:
 self.kprobe_func(i)
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] kern-tools: modify grep pattern for tools/kconf_check

2018-12-12 Thread Hongzhi.Song
The cmd line, , can't
match all expect config options.

This is because that it is not always space after 'config'
in kernel-source/*/.../Kconfig.
e.g. "config  IP_VS_IPV6" in net/netfilter/ipvs/Kconfig
^^
These are not spaces.

So we should change the cmd to grep '^[  ]*\(menu\)*config\s'.

License-Update: 

Signed-off-by: Hongzhi.Song 
---
 ...0001-tool-kconf_check-modify-grep-pattern.patch | 37 ++
 .../kern-tools/kern-tools-native_git.bb| 13 +---
 2 files changed, 46 insertions(+), 4 deletions(-)
 create mode 100644 
meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch

diff --git 
a/meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch
 
b/meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch
new file mode 100644
index 000..7f9c5a2
--- /dev/null
+++ 
b/meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch
@@ -0,0 +1,37 @@
+From 080a0662e235bb359ef06f6ba922f56a6040078f Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Tue, 11 Dec 2018 04:54:59 -0500
+Subject: [PATCH] tool/kconf_check: modify grep pattern
+
+The cmd line, , can't
+match all expect config options.
+
+This is because that it is not always space after 'config'
+in kernel-source/*/.../Kconfig.
+e.g. "config  IP_VS_IPV6" in net/netfilter/ipvs/Kconfig
+
+So we should change the cmd to grep '^[  ]*\(menu\)*config\s'.
+
+Upstream-Status: Submitted 
[https://lists.yoctoproject.org/pipermail/yocto/2018-December/043564.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ tools/kconf_check | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/kconf_check b/tools/kconf_check
+index aa86180..20b49cd 100755
+--- a/tools/kconf_check
 b/tools/kconf_check
+@@ -241,7 +241,7 @@ find ${kernel_source} \
+ # known list of all Kconfig* files.  Again, must filter dups.
+ rm -f ${LOGDIR}/all.cfg
+ for i in `cat ${LOGDIR}/all.kcf` ; do
+-cat ${kernel_source}/$i | grep '^[]*\(menu\)*config ' | \
++cat ${kernel_source}/$i | grep '^[]*\(menu\)*config\s' | \
+   awk '{print "CONFIG_"$2}' >> ${LOGDIR}/all.cfg
+ done
+ mv -f ${LOGDIR}/all.cfg ${LOGDIR}/all.cfg~
+-- 
+2.8.1
+
diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb 
b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
index b353c21..682c726 100644
--- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
+++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
@@ -1,6 +1,6 @@
 SUMMARY = "Tools for managing Yocto Project style branched kernels"
 LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = 
"file://git/tools/kgit;beginline=5;endline=9;md5=a6c2fa8aef1bda400e2828845ba0d06c"
+LIC_FILES_CHKSUM = 
"file://tools/kgit;beginline=5;endline=9;md5=a6c2fa8aef1bda400e2828845ba0d06c"
 
 DEPENDS = "git-native"
 
@@ -10,8 +10,11 @@ PV = "0.2+git${SRCPV}"
 
 inherit native
 
-SRC_URI = "git://git.yoctoproject.org/yocto-kernel-tools.git"
-S = "${WORKDIR}"
+SRC_URI = "git://git.yoctoproject.org/yocto-kernel-tools.git \
+   file://0001-tool-kconf_check-modify-grep-pattern.patch \
+"
+
+S = "${WORKDIR}/git"
 UPSTREAM_CHECK_COMMITS = "1"
 
 do_compile() { 
@@ -19,6 +22,8 @@ do_compile() {
 }
 
 do_install() {
-   cd ${S}/git
+   cd ${S}
make DESTDIR=${D}${bindir} install
 }
+
+FILESEXTRAPATH = "${THISDIR}/files"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] kern-tools: modify grep pattern for tools/kconf_check

2018-12-12 Thread Hongzhi.Song
The cmd line, , can't
match all expect config options.

This is because that it is not always space after 'config'
in kernel-source/*/.../Kconfig.
e.g. "config  IP_VS_IPV6" in net/netfilter/ipvs/Kconfig
^^
These are not spaces.

So we should change the cmd to grep '^[  ]*\(menu\)*config\s'.

Signed-off-by: Hongzhi.Song 
---
 ...0001-tool-kconf_check-modify-grep-pattern.patch | 38 ++
 .../kern-tools/kern-tools-native_git.bb| 13 +---
 2 files changed, 47 insertions(+), 4 deletions(-)
 create mode 100644 
meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch

diff --git 
a/meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch
 
b/meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch
new file mode 100644
index 000..a2b110f
--- /dev/null
+++ 
b/meta/recipes-kernel/kern-tools/files/0001-tool-kconf_check-modify-grep-pattern.patch
@@ -0,0 +1,38 @@
+From 080a0662e235bb359ef06f6ba922f56a6040078f Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Tue, 11 Dec 2018 04:54:59 -0500
+Subject: [PATCH] tool/kconf_check: modify grep pattern
+
+The cmd line, , can't
+match all expect config options.
+
+This is because that it is not always space after 'config'
+in kernel-source/*/.../Kconfig.
+e.g. "config  IP_VS_IPV6" in net/netfilter/ipvs/Kconfig
+
+So we should change the cmd to grep '^[  ]*\(menu\)*config\s'.
+
+Upstream-Status: Submitted
+https://lists.yoctoproject.org/pipermail/yocto/2018-December/043564.html
+
+Signed-off-by: Hongzhi.Song 
+---
+ tools/kconf_check | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/kconf_check b/tools/kconf_check
+index aa86180..20b49cd 100755
+--- a/tools/kconf_check
 b/tools/kconf_check
+@@ -241,7 +241,7 @@ find ${kernel_source} \
+ # known list of all Kconfig* files.  Again, must filter dups.
+ rm -f ${LOGDIR}/all.cfg
+ for i in `cat ${LOGDIR}/all.kcf` ; do
+-cat ${kernel_source}/$i | grep '^[]*\(menu\)*config ' | \
++cat ${kernel_source}/$i | grep '^[]*\(menu\)*config\s' | \
+   awk '{print "CONFIG_"$2}' >> ${LOGDIR}/all.cfg
+ done
+ mv -f ${LOGDIR}/all.cfg ${LOGDIR}/all.cfg~
+-- 
+2.8.1
+
diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb 
b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
index b353c21..682c726 100644
--- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
+++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
@@ -1,6 +1,6 @@
 SUMMARY = "Tools for managing Yocto Project style branched kernels"
 LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = 
"file://git/tools/kgit;beginline=5;endline=9;md5=a6c2fa8aef1bda400e2828845ba0d06c"
+LIC_FILES_CHKSUM = 
"file://tools/kgit;beginline=5;endline=9;md5=a6c2fa8aef1bda400e2828845ba0d06c"
 
 DEPENDS = "git-native"
 
@@ -10,8 +10,11 @@ PV = "0.2+git${SRCPV}"
 
 inherit native
 
-SRC_URI = "git://git.yoctoproject.org/yocto-kernel-tools.git"
-S = "${WORKDIR}"
+SRC_URI = "git://git.yoctoproject.org/yocto-kernel-tools.git \
+   file://0001-tool-kconf_check-modify-grep-pattern.patch \
+"
+
+S = "${WORKDIR}/git"
 UPSTREAM_CHECK_COMMITS = "1"
 
 do_compile() { 
@@ -19,6 +22,8 @@ do_compile() {
 }
 
 do_install() {
-   cd ${S}/git
+   cd ${S}
make DESTDIR=${D}${bindir} install
 }
+
+FILESEXTRAPATH = "${THISDIR}/files"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [yocto-kernel-tools][PATCH] tools/kconf_check: modify grep pattern

2018-12-11 Thread Hongzhi.Song
The cmd line, , can't
match all expect config options.

This is because that it is not always space after 'config'
in kernel-source/*/.../Kconfig.
e.g. "config  IP_VS_IPV6" in net/netfilter/ipvs/Kconfig

So we should change the cmd to grep '^[  ]*\(menu\)*config\s'.

Signed-off-by: Hongzhi.Song 
---
 tools/kconf_check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kconf_check b/tools/kconf_check
index aa86180..20b49cd 100755
--- a/tools/kconf_check
+++ b/tools/kconf_check
@@ -241,7 +241,7 @@ find ${kernel_source} \
 # known list of all Kconfig* files.  Again, must filter dups.
 rm -f ${LOGDIR}/all.cfg
 for i in `cat ${LOGDIR}/all.kcf` ; do
-cat ${kernel_source}/$i | grep '^[ ]*\(menu\)*config ' | \
+cat ${kernel_source}/$i | grep '^[ ]*\(menu\)*config\s' | \
awk '{print "CONFIG_"$2}' >> ${LOGDIR}/all.cfg
 done
 mv -f ${LOGDIR}/all.cfg ${LOGDIR}/all.cfg~
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [V2 PATCH 1/1] ltp: Use a legal bad address for mips in setrlimit05.c

2018-11-20 Thread Hongzhi.Song
This testcase fails on mips32. The process is killed by SIGBUS which
is not as expect.

This is because:
((void *)-1) is not a legal bad address which causes the process
killed by SIGBUG on mips.

'tst_get_bad_addr()' returns an address that should works on mips
and other arches.

Signed-off-by: Hongzhi.Song 
---
 ...t05-Use-another-method-to-get-bad-address.patch | 61 ++
 meta/recipes-extended/ltp/ltp_20180926.bb  |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
 
b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
new file mode 100644
index 00..4bfe2767d8
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
@@ -0,0 +1,61 @@
+From c4d02b23d12b7136b5739b3075e817fc037e41d4 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Mon, 19 Nov 2018 23:07:01 -0800
+Subject: [PATCH] setrlimit05: Use another method to get bad address
+
+This testcase fails on mips32. The process is killed by SIGBUS which
+is not as expect.
+
+This is because:
+((void *)-1) is not a legal bad address which causes the process
+killed by SIGBUG on mips.
+
+'tst_get_bad_addr()' returns an address that should works on mips
+and other arches.
+
+Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0]
+
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c 
b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+index e7167229b4..004a149a65 100644
+--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
 b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+@@ -26,6 +26,8 @@
+ 
+ #include "tst_test.h"
+ 
++static void *bad_addr;
++
+ static void verify_setrlimit(void)
+ {
+   int status;
+@@ -33,7 +35,7 @@ static void verify_setrlimit(void)
+ 
+   pid = SAFE_FORK();
+   if (!pid) {
+-  TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
++  TEST(setrlimit(RLIMIT_NOFILE, bad_addr));
+   if (TST_RET != -1) {
+   tst_res(TFAIL, "setrlimit()  succeeded unexpectedly");
+   exit(0);
+@@ -67,7 +69,13 @@ static void verify_setrlimit(void)
+   tst_res(TBROK, "child %s", tst_strstatus(status));
+ }
+ 
++static void setup(void)
++{
++  bad_addr = tst_get_bad_addr(NULL);
++}
++
+ static struct tst_test test = {
+   .test_all = verify_setrlimit,
+   .forks_child = 1,
++  .setup = setup,
+ };
+-- 
+2.11.0
+
diff --git a/meta/recipes-extended/ltp/ltp_20180926.bb 
b/meta/recipes-extended/ltp/ltp_20180926.bb
index 622c1f42f7..00e2c05cb6 100644
--- a/meta/recipes-extended/ltp/ltp_20180926.bb
+++ b/meta/recipes-extended/ltp/ltp_20180926.bb
@@ -52,6 +52,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \

file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \

file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
file://0001-statx-fix-compile-errors.patch \
+  
file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \
"
 
 S = "${WORKDIR}/git"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [V2 PATCH 0/1] ltp-setrlimit05.c: use a legal bad address for mips

2018-11-20 Thread Hongzhi.Song
V2:
Remake the patch for ltp-20180926 which was ltp-20180505
at the time of the last commit.

Hongzhi.Song (1):
  ltp: Use a legal bad address for mips in setrlimit05.c

 ...t05-Use-another-method-to-get-bad-address.patch | 61 ++
 meta/recipes-extended/ltp/ltp_20180926.bb  |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: kernel/syscall/setrlimit05.c: use a legal bad address for mips

2018-11-07 Thread Hongzhi.Song
This testcase fails on mips32. The process is killed by SIGBUS which
is not as expect.

This is because:
((void *)-1) is not a legal bad address which causes the process
killed by SIGBUG on mips.

'tst_get_bad_addr()' returns an address that should works on mips
and other arches.

Signed-off-by: Hongzhi.Song 
---
 ...t05-Use-another-method-to-get-bad-address.patch | 61 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
 
b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
new file mode 100644
index 000..dd688e4
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
@@ -0,0 +1,61 @@
+From ff1678f02fdf08e8b7cfca4d0d5aa7815b30957c Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Thu, 8 Nov 2018 01:30:53 -0500
+Subject: [PATCH] setrlimit05: Use another method to get bad address
+
+This testcase fails on mips32. The process is killed by SIGBUS which
+is not as expect.
+
+This is because:
+((void *)-1) is not a legal bad address which causes the process
+killed by SIGBUG on mips.
+
+'tst_get_bad_addr()' returns an address that should works on mips
+and other arches.
+
+Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0]
+
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c 
b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+index 7ea7d62..61ac7c6 100644
+--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
 b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+@@ -26,6 +26,8 @@
+ 
+ #include "tst_test.h"
+ 
++static void *bad_addr;
++
+ static void verify_setrlimit(void)
+ {
+   int status;
+@@ -33,7 +35,7 @@ static void verify_setrlimit(void)
+ 
+   pid = SAFE_FORK();
+   if (!pid) {
+-  TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
++  TEST(setrlimit(RLIMIT_NOFILE, bad_addr));
+   if (TEST_RETURN != -1) {
+   tst_res(TFAIL, "setrlimit()  succeeded unexpectedly");
+   exit(0);
+@@ -67,7 +69,13 @@ static void verify_setrlimit(void)
+   tst_res(TBROK, "child %s", tst_strstatus(status));
+ }
+ 
++static void setup(void)
++{
++  bad_addr = tst_get_bad_addr(NULL);
++}
++
+ static struct tst_test test = {
+   .test_all = verify_setrlimit,
+   .forks_child = 1,
++  .setup = setup,
+ };
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index ff85be7..240222e 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -56,6 +56,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch 
\

file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \

file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
+  
file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \
"
 
 S = "${WORKDIR}/git"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH V2] ltp: modify mmap_24-2 testcase

2018-10-15 Thread Hongzhi.Song
v2:
make the patch based on the newest status.

Hongzhi.Song (1):
  ltp: modify mmap_24-2 testcase

 ..._testsuite-mmap24-2-Relax-condition-a-bit.patch | 68 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 69 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch

-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: modify mmap_24-2 testcase

2018-10-15 Thread Hongzhi.Song
Mips will return EINVAL instead of ENOMEM as expected
if the range [addr + len) exceeds TASK_SIZE.

Linux kernel code: arch/mips/mm/mmap.c
if (flags & MAP_FIXED) {
/* Even MAP_FIXED mappings must reside within TASK_SIZE */
if (TASK_SIZE - len < addr)
   return -EINVAL;

Relax the condition and accept both ENOMEM and EINVAL
as expected outcome.

Signed-off-by: Hongzhi.Song 
---
 ..._testsuite-mmap24-2-Relax-condition-a-bit.patch | 68 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 69 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
 
b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
new file mode 100644
index 000..4d771c0
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
@@ -0,0 +1,68 @@
+From 85c972f730e8efe891a06ea3a2dfb5cbbdfbfbf4 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Wed, 10 Oct 2018 22:07:05 -0400
+Subject: [PATCH] open_posix_testsuite/mmap24-2: Relax condition a bit
+
+Mips will return EINVAL instead of ENOMEM as expected
+if the range [addr + len) exceeds TASK_SIZE.
+
+Linux kernel code: arch/mips/mm/mmap.c
+if (flags & MAP_FIXED) {
+/* Even MAP_FIXED mappings must reside within TASK_SIZE */
+if (TASK_SIZE - len < addr)
+return -EINVAL;
+
+Relax the condition and accept both ENOMEM and EINVAL
+as expected outcome.
+
+Upstream-Status: Submitted 
[https://lists.linux.it/pipermail/ltp/2018-October/009624.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ .../open_posix_testsuite/conformance/interfaces/mmap/24-2.c| 10 +-
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c 
b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
+index de51d43..810e5c8 100644
+--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
 b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
+@@ -7,7 +7,7 @@
+  * source tree.
+  *
+  * The mmap() function shall fail if:
+- * [ENOMEM] MAP_FIXED was specified,
++ * [ENOMEM or EINVAL] MAP_FIXED was specified,
+  * and the range [addr,addr+len) exceeds that allowed
+  * for the address space of a process; or, if MAP_FIXED was not specified and
+  * there is insufficient room in the address space to effect the mapping.
+@@ -15,7 +15,7 @@
+  * Test Step:
+  * 1. Map a shared memory object, with size exceeding the value get from
+  *rlim_cur of resource RLIMIT_AS, setting MAP_FIXED;
+- * 3. Should get ENOMEM.
++ * 3. Should get ENOMEM or EINVAL.
+  */
+ 
+ #define _XOPEN_SOURCE 600
+@@ -93,8 +93,8 @@ int main(void)
+  (unsigned long)len);
+   pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd,
+ 0);
+-  if (pa == MAP_FAILED && errno == ENOMEM) {
+-  printf("Got ENOMEM: %s\nTest PASSED\n", strerror(errno));
++  if (pa == MAP_FAILED && (errno == ENOMEM || errno == EINVAL)) {
++  printf("Got ENOMEM or EINVAL: %s\nTest PASSED\n", 
strerror(errno));
+   exit(PTS_PASS);
+   }
+ 
+@@ -103,6 +103,6 @@ int main(void)
+   else
+   munmap(pa, len);
+   close(fd);
+-  printf("Test Fail: Did not get ENOMEM as expected\n");
++  printf("Test Failed: Did not get ENOMEM or EINVAL as expected\n");
+   return PTS_FAIL;
+ }
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index 643239f..ff85be7 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -55,6 +55,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \

file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch 
\

file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \
+   
file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
"
 
 S = "${WORKDIR}/git"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: modify mmap_24-2 testcase

2018-10-11 Thread Hongzhi.Song
Mips will return EINVAL instead of ENOMEM as expected
if the range [addr + len) exceeds TASK_SIZE.

Linux kernel code: arch/mips/mm/mmap.c
if (flags & MAP_FIXED) {
/* Even MAP_FIXED mappings must reside within TASK_SIZE */
if (TASK_SIZE - len < addr)
   return -EINVAL;

Relax the condition and accept both ENOMEM and EINVAL
as expected outcome.

Signed-off-by: Hongzhi.Song 
---
 ..._testsuite-mmap24-2-Relax-condition-a-bit.patch | 68 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 69 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
 
b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
new file mode 100644
index 00..4d771c0b9c
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
@@ -0,0 +1,68 @@
+From 85c972f730e8efe891a06ea3a2dfb5cbbdfbfbf4 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Wed, 10 Oct 2018 22:07:05 -0400
+Subject: [PATCH] open_posix_testsuite/mmap24-2: Relax condition a bit
+
+Mips will return EINVAL instead of ENOMEM as expected
+if the range [addr + len) exceeds TASK_SIZE.
+
+Linux kernel code: arch/mips/mm/mmap.c
+if (flags & MAP_FIXED) {
+/* Even MAP_FIXED mappings must reside within TASK_SIZE */
+if (TASK_SIZE - len < addr)
+return -EINVAL;
+
+Relax the condition and accept both ENOMEM and EINVAL
+as expected outcome.
+
+Upstream-Status: Submitted 
[https://lists.linux.it/pipermail/ltp/2018-October/009624.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ .../open_posix_testsuite/conformance/interfaces/mmap/24-2.c| 10 +-
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c 
b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
+index de51d43..810e5c8 100644
+--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
 b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
+@@ -7,7 +7,7 @@
+  * source tree.
+  *
+  * The mmap() function shall fail if:
+- * [ENOMEM] MAP_FIXED was specified,
++ * [ENOMEM or EINVAL] MAP_FIXED was specified,
+  * and the range [addr,addr+len) exceeds that allowed
+  * for the address space of a process; or, if MAP_FIXED was not specified and
+  * there is insufficient room in the address space to effect the mapping.
+@@ -15,7 +15,7 @@
+  * Test Step:
+  * 1. Map a shared memory object, with size exceeding the value get from
+  *rlim_cur of resource RLIMIT_AS, setting MAP_FIXED;
+- * 3. Should get ENOMEM.
++ * 3. Should get ENOMEM or EINVAL.
+  */
+ 
+ #define _XOPEN_SOURCE 600
+@@ -93,8 +93,8 @@ int main(void)
+  (unsigned long)len);
+   pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd,
+ 0);
+-  if (pa == MAP_FAILED && errno == ENOMEM) {
+-  printf("Got ENOMEM: %s\nTest PASSED\n", strerror(errno));
++  if (pa == MAP_FAILED && (errno == ENOMEM || errno == EINVAL)) {
++  printf("Got ENOMEM or EINVAL: %s\nTest PASSED\n", 
strerror(errno));
+   exit(PTS_PASS);
+   }
+ 
+@@ -103,6 +103,6 @@ int main(void)
+   else
+   munmap(pa, len);
+   close(fd);
+-  printf("Test Fail: Did not get ENOMEM as expected\n");
++  printf("Test Failed: Did not get ENOMEM or EINVAL as expected\n");
+   return PTS_FAIL;
+ }
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index ba0e6a60b4..1bd36c0495 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -54,6 +54,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \

file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \

file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch 
\
+   
file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
"
 
 S = "${WORKDIR}/git"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [v3 PATCH 0/1] ltp: recent glibc calls syscall directly

2018-10-07 Thread Hongzhi.Song
v3:
modify commit log with adding recipe name
v2:
modify the format of [Upstream-Status]

Hongzhi.Song (1):
  ltp: recent glibc calls syscall directly

 ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/1] ltp: recent glibc calls syscall directly

2018-10-07 Thread Hongzhi.Song
The case of sigwaitinfo related to sigwaitinfo API failed.

glibc commit
  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
  changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
  syscall directly.

So, an invalid pointer no longer crashes child process and test
reports failure. Fix it by accepting either crash or EFAULT.

Signed-off-by: Hongzhi.Song 
---
 ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
 
b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
new file mode 100644
index 00..c412c89e99
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
@@ -0,0 +1,75 @@
+From bb977ca0716ae98f10102c7122fe15bc0ddb5356 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Thu, 20 Sep 2018 21:49:02 -0400
+Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
+
+glibc commit
+  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
+changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
+syscall directly.
+
+So, an invalid pointer no longer crashes child process and test
+reports failure. Fix it by accepting either crash or EFAULT.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Submitted 
[https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c| 30 +++---
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c 
b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+index 95a9436a4..8fa8ac34b 100644
+--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
 b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
+   tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+   case 0:
+   signal(SIGSEGV, SIG_DFL);
++
++   /*
++* depending on glibc implementation we should
++* either crash or get EFAULT
++*/
+   TEST(sigwaitinfo((void *)1, NULL, NULL));
+ 
+-  _exit(0);
++   if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
++   _exit(0);
++
++   tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
++   TEST_RETURN, TEST_ERRNO);
++   _exit(1);
++
+   break;
+   default:
+   break;
+   }
+ 
+   SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, , 0);
+-  if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++
++   if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++   || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
+   tst_resm(TPASS, "Test passed");
+-  else
+-  tst_resm(TFAIL, "Unrecognised child exit code");
++   return;
++   }
++
++   if (WIFEXITED(status)) {
++   tst_resm(TFAIL, "Unrecognised child exit code: %d",
++   WEXITSTATUS(status));
++   }
++   if (WIFSIGNALED(status)) {
++   tst_resm(TFAIL, "Unrecognised child termsig: %d",
++   WTERMSIG(status));
++   }
+ }
+ 
+ void test_bad_address3(swi_func sigwaitinfo, int signo)
+-- 
+2.11.0
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index ce86f7f14b..ba0e6a60b4 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -53,6 +53,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \

file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \

file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \

file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
+   file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch 
\
"
 
 S = "${WORKDIR}/git"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 0/1 V2] sigwaitinfo01: recent glibc calls syscall directly

2018-09-21 Thread Hongzhi.Song
v2:
modify the format of [Upstream-Status]

Hongzhi.Song (1):
  sigwaitinfo01: recent glibc calls syscall directly

 ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/1] sigwaitinfo01: recent glibc calls syscall directly

2018-09-21 Thread Hongzhi.Song
The case of sigwaitinfo related to sigwaitinfo API failed.

glibc commit
  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
  changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
  syscall directly.

So, an invalid pointer no longer crashes child process and test
reports failure. Fix it by accepting either crash or EFAULT.

Signed-off-by: Hongzhi.Song 
---
 ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
 
b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
new file mode 100644
index 00..46e7fabd3d
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
@@ -0,0 +1,75 @@
+From 0932ca0a6f3ed9f7ae4487ed77ec07eb3610f4a7 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Thu, 20 Sep 2018 21:49:02 -0400
+Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
+
+glibc commit
+  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
+changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
+syscall directly.
+
+So, an invalid pointer no longer crashes child process and test
+reports failure. Fix it by accepting either crash or EFAULT.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Submitted 
[https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c| 30 +++---
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c 
b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+index 95a9436..8fa8ac3 100644
+--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
 b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
+   tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+   case 0:
+   signal(SIGSEGV, SIG_DFL);
++
++   /*
++* depending on glibc implementation we should
++* either crash or get EFAULT
++*/
+   TEST(sigwaitinfo((void *)1, NULL, NULL));
+ 
+-  _exit(0);
++   if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
++   _exit(0);
++
++   tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
++   TEST_RETURN, TEST_ERRNO);
++   _exit(1);
++
+   break;
+   default:
+   break;
+   }
+ 
+   SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, , 0);
+-  if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++
++   if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++   || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
+   tst_resm(TPASS, "Test passed");
+-  else
+-  tst_resm(TFAIL, "Unrecognised child exit code");
++   return;
++   }
++
++   if (WIFEXITED(status)) {
++   tst_resm(TFAIL, "Unrecognised child exit code: %d",
++   WEXITSTATUS(status));
++   }
++   if (WIFSIGNALED(status)) {
++   tst_resm(TFAIL, "Unrecognised child termsig: %d",
++   WTERMSIG(status));
++   }
+ }
+ 
+ void test_bad_address3(swi_func sigwaitinfo, int signo)
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index 9cd3489722..c99d5a2b00 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -52,6 +52,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \

file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \

file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \

file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \
+   file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch 
\
"
 
 S = "${WORKDIR}/git"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] sigwaitinfo01: recent glibc calls syscall directly

2018-09-20 Thread Hongzhi.Song
The case of sigwaitinfo related to sigwaitinfo API failed.

glibc commit
  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
  changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
  syscall directly.

So, an invalid pointer no longer crashes child process and test
reports failure. Fix it by accepting either crash or EFAULT.

Signed-off-by: Hongzhi.Song 
---
 ...nfo01-recent-glibc-calls-syscall-directly.patch | 78 ++
 meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
 
b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
new file mode 100644
index 00..5e40321ad9
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
@@ -0,0 +1,78 @@
+From 0932ca0a6f3ed9f7ae4487ed77ec07eb3610f4a7 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Thu, 20 Sep 2018 21:49:02 -0400
+Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
+
+glibc commit
+  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
+changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
+syscall directly.
+
+So, an invalid pointer no longer crashes child process and test
+reports failure. Fix it by accepting either crash or EFAULT.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Submitted
+[Jan Stancek jstan...@redhat.com]
+[Wed Sep 12 10:09:15 CEST 2018]
+[https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
+
+Signed-off-by: Hongzhi.Song 
+---
+ .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c| 30 +++---
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c 
b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+index 95a9436..8fa8ac3 100644
+--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
 b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
+   tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+   case 0:
+   signal(SIGSEGV, SIG_DFL);
++
++   /*
++* depending on glibc implementation we should
++* either crash or get EFAULT
++*/
+   TEST(sigwaitinfo((void *)1, NULL, NULL));
+ 
+-  _exit(0);
++   if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
++   _exit(0);
++
++   tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
++   TEST_RETURN, TEST_ERRNO);
++   _exit(1);
++
+   break;
+   default:
+   break;
+   }
+ 
+   SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, , 0);
+-  if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++
++   if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++   || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
+   tst_resm(TPASS, "Test passed");
+-  else
+-  tst_resm(TFAIL, "Unrecognised child exit code");
++   return;
++   }
++
++   if (WIFEXITED(status)) {
++   tst_resm(TFAIL, "Unrecognised child exit code: %d",
++   WEXITSTATUS(status));
++   }
++   if (WIFSIGNALED(status)) {
++   tst_resm(TFAIL, "Unrecognised child termsig: %d",
++   WTERMSIG(status));
++   }
+ }
+ 
+ void test_bad_address3(swi_func sigwaitinfo, int signo)
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index 9cd3489722..c99d5a2b00 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -52,6 +52,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \

file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \

file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \

file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \
+   file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch 
\
"
 
 S = "${WORKDIR}/git"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 0/3 v5] udev-extraconf/mount.sh: add systemd-mount command for systemd

2018-09-15 Thread Hongzhi.Song
v5:
perfect a few codes based on v4
v4:
fix the recursively dependency for the systemd-mount
v3:
perfect syntax

Hongzhi.Song (3):
  udev-extraconf/mount.sh: add support to systemd
  udev-extraconf/mount.sh: Fix the recursively dependency for the
systemd-mount
  udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the
systemd-moun

 meta/recipes-core/udev/udev-extraconf/mount.sh | 92 +-
 1 file changed, 74 insertions(+), 18 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 3/3] udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the systemd-moun

2018-09-15 Thread Hongzhi.Song
When using systemd, the systemd-fstab-generator would parse the
/etc/fstab and create the corresponding unit dynamically. So we don't
need to handle the ADD action for the partitions in /etc/fstab.

Signed-off-by: Kevin Hao 
Signed-off-by: Hongzhi.Song 
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 9 +
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 4cb5db3a9b..665ad3e54c 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -36,6 +36,15 @@ done
 automount_systemd() {
name="`basename "$DEVNAME"`"
 
+# Skip the partition which are already in /etc/fstab
+grep "^[[:space:]]*$DEVNAME" /etc/fstab && return
+for n in LABEL PARTLABEL UUID PARTUUID; do
+tmp="$(lsblk -o $n $DEVNAME | sed -e '1d')"
+test -z "$tmp" && continue
+tmp="$n=$tmp"
+grep "^[[:space:]]*$tmp" /etc/fstab && return
+done
+
 ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
 
 # If filesystem type is vfat, change the ownership group to 'disk', and
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/3] udev-extraconf/mount.sh: Fix the recursively dependency for the systemd-mount

2018-09-15 Thread Hongzhi.Song
If systemd is used, using the systemd-mount to mount the new added disk
partitions forgets to move the codes which tries to mount the partition
by using the configuration in /etc/fstab to the non-systemd function.

And it will cause the systemd-mount try to mount the partition
synchronously and trigger a recursively dependency like the following:
dev-sda1.device -> run-media-sda1.mount -> dev-sda1.device

Signed-off-by: Kevin Hao 
Signed-off-by: Hongzhi.Song 
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 27 +++---
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 5a877dd7ed..4cb5db3a9b 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -60,7 +60,17 @@ automount_systemd() {
 automount() {
name="`basename "$DEVNAME"`"
 
-   ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+if [ -x "$PMOUNT" ]; then
+$PMOUNT $DEVNAME 2> /dev/null
+elif [ -x $MOUNT ]; then
+$MOUNT $DEVNAME 2> /dev/null
+fi
+
+# If the device isn't mounted at this point, it isn't
+# configured in fstab
+grep -q "^$DEVNAME " /proc/mounts && return
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
# Silent util-linux's version of mounting auto
if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
then
@@ -102,19 +112,14 @@ rm_dir() {
 name="`basename "$DEVNAME"`"
 [ -e /sys/block/$name/device/media ] && media_type=`cat 
/sys/block/$name/device/media`
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o 
"$media_type" = "cdrom" ]; then
-   if [ -x "$PMOUNT" ]; then
-   $PMOUNT $DEVNAME 2> /dev/null
-   elif [ -x $MOUNT ]; then
-   $MOUNT $DEVNAME 2> /dev/null
-   fi
-   # If the device isn't mounted at this point, it isn't
-   # configured in fstab (note the root filesystem can show up as
-   # /dev/root in /proc/mounts, so check the device number too)
+
+# Note the root filesystem can show up as /dev/root in /proc/mounts,
+# so check the device number too
if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
if [ "`basename $MOUNT`" = "systemd-mount" ];then
-   grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+   automount_systemd
else
-   grep -q "^$DEVNAME " /proc/mounts || automount
+   automount
fi
fi
 fi
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/3] udev-extraconf/mount.sh: add support to systemd

2018-09-15 Thread Hongzhi.Song
Udev-extraconf works correctly with sysvinit in the aspect of
automounting block devices,but it has a serious problem in case
of systemd. Block devices automounted by udev are not accessible
to host namespace, i.e. udevd's private namespace. For example,
we cannot format the host namespace block devices.

e.g.
root@intel-x86-64:~# mkfs.ext4 /dev/sda1
(skip...)
/dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Other distributions have no such problem, because they use a series
of rules to manage block devices. Note that udev-extraconf has just
one file, automount.rules, which results in this problem.

As recommended by members of the systemd community, we can use the
'systemd-mount' command to resolve this problem since it's intended
purpose is to establish (and destroy) transient mount or auto-mount
points using the service manager job queue thereby eliminating
dependencies loops.

We add 'systemd-mount' command instead of replace 'mount' command
based on the original mount.sh.

[YOCTO #12644]
Simply steps of reproduce:
Using systemd as init and an ext3 filesystem image,
boot core-image-minimal using:
  runqemu qemux86 slirp nographic qemuparams="-hda b.img"
  Note that hda is not mounted yet it can't be formatted either.

Detail steps of reproduce:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12644

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 60 ++
 1 file changed, 51 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328a09..5a877dd7ed 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,26 @@
 #
 # Attempt to mount any added block devices and umount any removed devices
 
+BASE_INIT="`readlink -f "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ ! -x $MOUNT ] && [ ! -x $UMOUNT ];
+then
+logger "/sbin/init is systemd but /usr/bin/systemd-[u]mount 
not found."
+logger "Install systemd-[u]mount to be able to [un]mount all 
filesystems."
+exit 0
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
 
-MOUNT="/bin/mount"
 PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
 for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
 do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +33,31 @@ do
fi
 done
 
-automount() {  
+automount_systemd() {
+   name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+# If filesystem type is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+*)
+;;
+esac
+
+if ! $MOUNT -o silent --no-block -t auto $DEVNAME "/run/media/$name"
+then
+rm_dir "/run/media/$name"
+else
+logger "mount.sh: systemd-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {
name="`basename "$DEVNAME"`"
 
! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
@@ -26,7 +66,7 @@ automount() {
then
MOUNT="$MOUNT -o silent"
fi
-   
+
# If filesystem type is vfat, change the ownership group to 'disk', and
# grant it with  w/r/x permissions.
case $ID_FS_TYPE in
@@ -47,7 +87,7 @@ automount() {
touch "/tmp/.automount-$name"
fi
 }
-   
+
 rm_dir() {
# We do not want to rm -r populated directories
if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
@@ -61,19 +101,21 @@ rm_dir() {
 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"
 [ -e /sys/block/$name/device/media ] && media_type=`cat 
/sys/block/$name/device/media`
-
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o 
"$media_type" = "cdrom" ]; then
if [ -x "$PMOUNT" ]; then
$PMOUNT $DEVNAME

[OE-core] [oe-core][PATCH] ltp: add a patch for source code to fix issue about fcntl

2018-09-15 Thread Hongzhi.Song
The testcases of fcntl fail on 32-bit arch

To cope with glibc commit:
  06ab719d30b0 ("Fix Linux fcntl OFD locks for non-LFS architectures
  (BZ#20251)")
Make OFD command use fcntl64() syscall on 32-bit.

Signed-off-by: Hongzhi.Song 
---
 ...ntl-make-OFD-command-use-fcntl64-syscall-.patch | 184 +
 meta/recipes-extended/ltp/ltp_20180515.bb  |   1 +
 2 files changed, 185 insertions(+)
 create mode 100644 
meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
 
b/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
new file mode 100644
index 000..2755596
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
@@ -0,0 +1,184 @@
+From 8de03ea1200480b922d5ba05b69dc94db60496f5 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Sat, 15 Sep 2018 22:39:32 -0400
+Subject: [PATCH] syscalls/fcntl: make OFD command use fcntl64() syscall on
+ 32-bit
+
+To cope with glibc commit:
+  06ab719d30b0 ("Fix Linux fcntl OFD locks for non-LFS architectures
+(BZ#20251)")
+
+WIP: Still need to test this with new glibc.
+ Test with old glibc look OK so far.
+
+Signed-off-by: Jan Stancek 
+
+Upstream-Status: Backport
+Backported from upstream maillist
+https://lists.linux.it/pipermail/ltp/2018-September/009370.html
+
+Signed-off-by: Hongzhi Song 
+---
+ testcases/kernel/syscalls/fcntl/fcntl34.c  | 12 +++---
+ testcases/kernel/syscalls/fcntl/fcntl36.c  | 23 +-
+ testcases/kernel/syscalls/fcntl/fcntl_common.h | 32 ++
+ 3 files changed, 58 insertions(+), 9 deletions(-)
+ create mode 100644 testcases/kernel/syscalls/fcntl/fcntl_common.h
+
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl34.c 
b/testcases/kernel/syscalls/fcntl/fcntl34.c
+index aa29cf9..109f834 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl34.c
 b/testcases/kernel/syscalls/fcntl/fcntl34.c
+@@ -28,6 +28,7 @@
+ #include "lapi/fcntl.h"
+ #include "tst_safe_pthread.h"
+ #include "tst_test.h"
++#include "fcntl_common.h"
+ 
+ static int thread_cnt;
+ static const int max_thread_cnt = 32;
+@@ -68,7 +69,12 @@ void *thread_fn_01(void *arg)
+ 
+   memset(buf, (intptr_t)arg, write_size);
+ 
+-  struct flock64 lck = {
++/* see explanation in fcntl_common.h */
++#ifdef USE_STRUCT_FLOCK
++struct flock lck = {
++#else
++struct flock64 lck = {
++#endif
+   .l_whence = SEEK_SET,
+   .l_start  = 0,
+   .l_len= 1,
+@@ -76,13 +82,13 @@ void *thread_fn_01(void *arg)
+ 
+   for (i = 0; i < writes_num; ++i) {
+   lck.l_type = F_WRLCK;
+-  SAFE_FCNTL(fd, F_OFD_SETLKW, );
++my_fcntl(fd, F_OFD_SETLKW, );
+ 
+   SAFE_LSEEK(fd, 0, SEEK_END);
+   SAFE_WRITE(1, fd, buf, write_size);
+ 
+   lck.l_type = F_UNLCK;
+-  SAFE_FCNTL(fd, F_OFD_SETLKW, );
++my_fcntl(fd, F_OFD_SETLKW, );
+ 
+   sched_yield();
+   }
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c 
b/testcases/kernel/syscalls/fcntl/fcntl36.c
+index 3246d13..f263b6b 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl36.c
 b/testcases/kernel/syscalls/fcntl/fcntl36.c
+@@ -57,6 +57,7 @@
+ #include "lapi/fcntl.h"
+ #include "tst_safe_pthread.h"
+ #include "tst_test.h"
++#include "fcntl_common.h"
+ 
+ static int thread_cnt;
+ static int fail_flag = 0;
+@@ -87,7 +88,12 @@ static void *fn_ofd_w(void *arg)
+   int fd = SAFE_OPEN(fname, O_RDWR);
+   long wt = pa->cnt;
+ 
+-  struct flock64 lck = {
++/* see explanation in fcntl_common.h */
++#ifdef USE_STRUCT_FLOCK
++struct flock lck = {
++#else
++struct flock64 lck = {
++#endif
+   .l_whence = SEEK_SET,
+   .l_start  = pa->offset,
+   .l_len= pa->length,
+@@ -99,13 +105,13 @@ static void *fn_ofd_w(void *arg)
+   memset(buf, wt, pa->length);
+ 
+   lck.l_type = F_WRLCK;
+-  SAFE_FCNTL(fd, F_OFD_SETLKW, );
++my_fcntl(fd, F_OFD_SETLKW, );
+ 
+   SAFE_LSEEK(fd, pa->offset, SEEK_SET);
+   SAFE_WRITE(1, fd, buf, pa->length);
+ 
+   lck.l_type = F_UNLCK;
+-  SAFE_FCNTL(fd, F_OFD_SETLKW, );
++my_fcntl(fd, F_OFD_SETLKW, );
+ 
+   wt++;
+   if (wt >= 255)
+@@ -166,7 +172,12 @@ static void *fn_ofd_r(void *arg)
+   int i;
+   int fd = SAFE_OPEN(fname, O_RDWR);
+ 
+-  struct flock64 lck = {
++/* see explanation in fcntl_common.h */
++#ifdef USE_STRUCT_FLOCK
++struct flock lck = {
++#else
++st

[OE-core] [oe-core][PATCH] linux-yocto-rt: Add paravirt_kvm support for qemux86-64

2018-09-09 Thread Hongzhi.Song
This feature includes paravirtualized KVM guest support, including
KVMCLOCK for enhancing clock accuracy of guest OS.

Signed-off-by: He Zhe 
Signed-off-by: Hongzhi.Song 
---
 meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb | 2 +-
 meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb 
b/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb
index d9953c32be..ab088f4d18 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb
@@ -38,4 +38,4 @@ KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc 
features/taskstats/ta
 KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
 KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
 KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
-KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc"
+KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb 
b/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb
index 5b102069f1..de3b538b5d 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb
@@ -40,4 +40,4 @@ KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc 
features/taskstats/ta
 KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
 KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
 KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
-KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc"
+KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH] cryptodev-linux: Fixes a kernel crash observed with cipher-gcm test

2018-08-22 Thread Hongzhi.Song
The crypto API for AEAD ciphers changed in recent kernels, so that
associated data is now part of both source and destination scatter
gathers. The source, destination and associated data buffers need
to be stiched accordingly for the operations to succeed.

Signed-off-by: Hongzhi.Song 
---
 .../cryptodev/cryptodev-module_1.9.bb  |   3 +
 ...-split-big-function-to-simplify-maintaina.patch | 250 +
 ...g-relocate-code-to-simplify-later-patches.patch |  64 ++
 ...ert-to-new-AEAD-interface-in-kernels-v4.2.patch | 102 +
 4 files changed, 419 insertions(+)
 create mode 100644 
meta/recipes-kernel/cryptodev/files/0001-refactoring-split-big-function-to-simplify-maintaina.patch
 create mode 100644 
meta/recipes-kernel/cryptodev/files/0002-refactoring-relocate-code-to-simplify-later-patches.patch
 create mode 100644 
meta/recipes-kernel/cryptodev/files/0003-convert-to-new-AEAD-interface-in-kernels-v4.2.patch

diff --git a/meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb 
b/meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb
index 6052650c95..ed4327d40d 100644
--- a/meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb
+++ b/meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb
@@ -11,6 +11,9 @@ SRC_URI += " \
 file://0001-Disable-installing-header-file-provided-by-another-p.patch \
 file://0001-ioctl.c-Fix-build-with-linux-4.13.patch \
 file://0001-ioctl.c-Fix-build-with-linux-4.17.patch \
+file://0001-refactoring-split-big-function-to-simplify-maintaina.patch \
+file://0002-refactoring-relocate-code-to-simplify-later-patches.patch \
+file://0003-convert-to-new-AEAD-interface-in-kernels-v4.2.patch \
 "
 
 EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
diff --git 
a/meta/recipes-kernel/cryptodev/files/0001-refactoring-split-big-function-to-simplify-maintaina.patch
 
b/meta/recipes-kernel/cryptodev/files/0001-refactoring-split-big-function-to-simplify-maintaina.patch
new file mode 100644
index 00..ed5b7e44b3
--- /dev/null
+++ 
b/meta/recipes-kernel/cryptodev/files/0001-refactoring-split-big-function-to-simplify-maintaina.patch
@@ -0,0 +1,250 @@
+From 20dcf071bc3076ee7db9d603cfbe6a06e86c7d5f Mon Sep 17 00:00:00 2001
+From: Cristian Stoica 
+Date: Thu, 4 May 2017 15:06:20 +0300
+Subject: [PATCH 1/3] refactoring: split big function to simplify maintainance
+
+The setup of auth_buf in tls and aead is now duplicated but this
+is temporary and allows necessary corrections for the aead case
+with v4.2+ kernels.
+
+Signed-off-by: Cristian Stoica 
+
+Upstream-Status: Backported
+
+Commit ID: 20dcf071bc3076ee7db9d603c
+
+Signed-off-by: Hongzhi.Song 
+---
+ authenc.c | 197 --
+ 1 file changed, 126 insertions(+), 71 deletions(-)
+
+diff --git a/authenc.c b/authenc.c
+index 1bd7377..28eb0f9 100644
+--- a/authenc.c
 b/authenc.c
+@@ -609,96 +609,151 @@ auth_n_crypt(struct csession *ses_ptr, struct 
kernel_crypt_auth_op *kcaop,
+   return 0;
+ }
+ 
+-/* This is the main crypto function - zero-copy edition */
+-static int
+-__crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op 
*kcaop)
++static int crypto_auth_zc_srtp(struct csession *ses_ptr, struct 
kernel_crypt_auth_op *kcaop)
+ {
+-  struct scatterlist *dst_sg, *auth_sg, *src_sg;
++  struct scatterlist *dst_sg, *auth_sg;
+   struct crypt_auth_op *caop = >caop;
+-  int ret = 0;
++  int ret;
+ 
+-  if (caop->flags & COP_FLAG_AEAD_SRTP_TYPE) {
+-  if (unlikely(ses_ptr->cdata.init != 0 &&
+-   (ses_ptr->cdata.stream == 0 ||
+-ses_ptr->cdata.aead != 0))) {
+-  derr(0, "Only stream modes are allowed in SRTP mode 
(but not AEAD)");
+-  return -EINVAL;
+-  }
++  if (unlikely(ses_ptr->cdata.init != 0 &&
++  (ses_ptr->cdata.stream == 0 || ses_ptr->cdata.aead != 0))) {
++  derr(0, "Only stream modes are allowed in SRTP mode (but not 
AEAD)");
++  return -EINVAL;
++  }
+ 
+-  ret = get_userbuf_srtp(ses_ptr, kcaop, _sg, _sg);
+-  if (unlikely(ret)) {
+-  derr(1, "get_userbuf_srtp(): Error getting user 
pages.");
+-  return ret;
+-  }
++  ret = get_userbuf_srtp(ses_ptr, kcaop, _sg, _sg);
++  if (unlikely(ret)) {
++  derr(1, "get_userbuf_srtp(): Error getting user pages.");
++  return ret;
++  }
+ 
+-  ret = srtp_auth_n_crypt(ses_ptr, kcaop, auth_sg, caop->auth_len,
+- dst_sg, caop->len);
++  ret = srtp_auth_n_crypt(ses_ptr, kcaop, auth_sg, caop->auth_len,
++  dst_sg, caop->len);
+ 
+-  release_user_pages(ses_ptr);
+-  } else { /* TLS

[OE-core] [oe-core][PATCH v2] Runtime selftest: hw breakpoint drops arm64, corrects syntax

2018-08-21 Thread Hongzhi.Song
1. Improve syntax in skip test output.
2. Do not run the test for arm64 because commit 176e50fb177dc40e4
did exclude arm64.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index eb8713351a..0e00cdeeb6 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -166,9 +166,9 @@ class KSampleTest(KSample):
 def test_hw_breakpoint_example(self):
 # check arch
 status, output = self.target.run("uname -m")
-result = ("x86" in output) or ("aarch64" in output)
+result = "x86" in output
 if not result:
-self.skipTest("the arch doesn't support hw breakpoint" % output)
+self.skipTest("the arch %s doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH] runtime selftest: hw breakpoint case correct syntax

2018-08-21 Thread Hongzhi.Song
1. There is a wrong syntax.
2. Since last commit has exclude the arm64, so remove arm64.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index eb8713351a..0e00cdeeb6 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -166,9 +166,9 @@ class KSampleTest(KSample):
 def test_hw_breakpoint_example(self):
 # check arch
 status, output = self.target.run("uname -m")
-result = ("x86" in output) or ("aarch64" in output)
+result = "x86" in output
 if not result:
-self.skipTest("the arch doesn't support hw breakpoint" % output)
+self.skipTest("the arch %s doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v5 0/2] runtime selftest: limit kernel hw bp arches

2018-08-16 Thread Hongzhi.Song
v4 v5:
modify commit, test cases with kvm, test qemuarm64
v3:
specify arch for the case of hw breakpoint 
v2:
test_trace_events_sample of ksample.py


Hongzhi.Song (2):
  runtime selftest: test_trace_events_sample of ksample.py
  runtime selftest: limit kernel hw bp arches

 meta/lib/oeqa/runtime/cases/ksample.py | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/2] runtime selftest: limit kernel hw bp arches

2018-08-16 Thread Hongzhi.Song
1. So far, only qemux86[-64] support hw breakpoint, no matter whether or
not with kvm.

qemuppc: The oe-core configuration uses a PPC G4 system as the
default cpu but qemu doesn't simulate the hw breakpoint register for G4.

qemuarm: The arch more than v7 supports hw breakpoint, however arm use
v5 as default.

qemuarm64: We temporarily drop qemuarm64 for the moment. Normally it
will print debug info once, but endlessly when we trigger the break
point. Now it is hard to located the issue, but we will confirm it
later.

qemumips*: Kernel dosen't support hw bp for mips.

2. Syslog maybe not started, so we use dmesg to confirm.

3. Running 'ls' to trigger the hardware breakpoint test.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 26fbe9d8cb..eb8713351a 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -164,6 +164,11 @@ class KSampleTest(KSample):
 # hw breakpoint
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_hw_breakpoint_example(self):
+# check arch
+status, output = self.target.run("uname -m")
+result = ("x86" in output) or ("aarch64" in output)
+if not result:
+self.skipTest("the arch doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2] runtime selftest: test_trace_events_sample of ksample.py

2018-08-16 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3cfbd..26fbe9d8cb 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.assertTrue(False, "Time out when check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/2] runtime selftest: limit kernel hw bp arches

2018-08-16 Thread Hongzhi.Song
1. So far, only qemux86[-64] support hw breakpoint, no matter whether or
not with kvm.

qemuppc: The oe-core configuration uses a PPC G4 system as the
default cpu but qemu doesn't simulate the hw breakpoint register for G4.

qemuarm: The arch more than v7 supports hw breakpoint, however arm use
v5 as default.

qemuarm64: We temporarily drop qemuarm64 for the moment. Normally it
will print debug info once, but endlessly when we trigger the break
point. Now it is hard to located the issue, but we will confirm it
later.

qemumips*: Kernel dosen't support hw bp for mips.

2. Syslog maybe not started, so we use dmesg to confirm.

3. Running 'ls' to trigger the hardware breakpoint test.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 26fbe9d8cb..eb8713351a 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -164,6 +164,11 @@ class KSampleTest(KSample):
 # hw breakpoint
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_hw_breakpoint_example(self):
+# check arch
+status, output = self.target.run("uname -m")
+result = ("x86" in output) or ("aarch64" in output)
+if not result:
+self.skipTest("the arch doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2] runtime selftest: test_trace_events_sample of ksample.py

2018-08-16 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3cfbd..26fbe9d8cb 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.assertTrue(False, "Time out when check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v4 0/2] runtime selftest: limit kernel hw bp arches

2018-08-16 Thread Hongzhi.Song
v4:
modify commit, test cases with kvm, test qemuarm64
v3:
specify arch for the case of hw breakpoint 
v2:
test_trace_events_sample of ksample.py


Hongzhi.Song (2):
  runtime selftest: test_trace_events_sample of ksample.py
  runtime selftest: limit kernel hw bp arches

 meta/lib/oeqa/runtime/cases/ksample.py | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2] runtime selftest: test_trace_events_sample of ksample.py

2018-08-15 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3cfbd..26fbe9d8cb 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.assertTrue(False, "Time out when check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v4 0/2] runtime selftest: limit kernel hw bp arches

2018-08-15 Thread Hongzhi.Song
v4:
modify commit, test cases with kvm, test qemuarm64
v3:
specify arch for the case of hw breakpoint 
v2:
test_trace_events_sample of ksample.py

Hongzhi.Song (2):
  runtime selftest: test_trace_events_sample of ksample.py
  runtime selftest: limit kernel hw bp arches

 meta/lib/oeqa/runtime/cases/ksample.py | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/2] runtime selftest: limit kernel hw bp arches

2018-08-15 Thread Hongzhi.Song
1. So far, only qemux86[-64] support hw breakpoint, no matter whether or
not with kvm.

qemuppc: The oe-core configuration uses a PPC G4 system as the
default cpu but qemu doesn't simulate the hw breakpoint register for G4.

qemuarm: The arch more than v7 supports hw breakpoint, however arm use
v5 as default.

qemuarm64: It has some problem that haven't been located so far.

2. Syslog maybe not started, so we use dmesg to confirm.

3. Running 'ls' to trigger the hardware breakpoint test.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 26fbe9d8cb..eb8713351a 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -164,6 +164,11 @@ class KSampleTest(KSample):
 # hw breakpoint
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_hw_breakpoint_example(self):
+# check arch
+status, output = self.target.run("uname -m")
+result = ("x86" in output) or ("aarch64" in output)
+if not result:
+self.skipTest("the arch doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v3 2/2] runtime selftest: optimize the case of hw_breakpoint

2018-08-12 Thread Hongzhi.Song
1. So far, only qemux86 can support hw breakpoint
qemuppc: Runqemu uses G4 as the default cpu. But qemu doesn't simulate
the hw breakpoint register for G4, which belong to 74xx series.

qemuarm: The arch more than v7 supports hw breakpoint, however arm use
v5 as default.

2. Rsyslog maybe not started, so we use dmesg to confirm.

3. Adding the operation of 'ls' triggers hardware breakpoint.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 26fbe9d8cb..eb8713351a 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -164,6 +164,11 @@ class KSampleTest(KSample):
 # hw breakpoint
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_hw_breakpoint_example(self):
+# check arch
+status, output = self.target.run("uname -m")
+result = ("x86" in output) or ("aarch64" in output)
+if not result:
+self.skipTest("the arch doesn't support hw breakpoint" % output)
 # check config
 self.check_config("CONFIG_KALLSYMS_ALL")
 # make sure if module exists
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v2 1/2] runtime selftest: test_trace_events_sample of ksample.py

2018-08-12 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3cfbd..26fbe9d8cb 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.assertTrue(False, "Time out when check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][v2 v3 PATCH 0/2] modify runtime test cases

2018-08-12 Thread Hongzhi.Song
v3:
specify arch for the case of hw breakpoint 
v2:
test_trace_events_sample of ksample.py

Hongzhi.Song (2):
  runtime selftest: test_trace_events_sample of ksample.py
  runtime selftest: optimize the case of hw_breakpoint

 meta/lib/oeqa/runtime/cases/ksample.py | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v3 2/2] runtime selftest: remove the case of hw breakpoint

2018-08-03 Thread Hongzhi.Song
Hw breakpoint is based on hardware.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 16 
 1 file changed, 16 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 26fbe9d8cb..5e8699a2e2 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -161,22 +161,6 @@ class KSampleTest(KSample):
 # rmmod
 self.cmd_and_check("rmmod trace-printk")
 
-# hw breakpoint
-@OETestDepends(['ssh.SSHTest.test_ssh'])
-def test_hw_breakpoint_example(self):
-# check config
-self.check_config("CONFIG_KALLSYMS_ALL")
-# make sure if module exists
-self.check_module_exist("hw_breakpoint/", "data_breakpoint.ko")
-# modprobe
-self.cmd_and_check("modprobe data_breakpoint")
-# lsmod
-self.cmd_and_check("lsmod | grep data_breakpoint | cut -d\' \' -f1", 
"data_breakpoint")
-# check result
-self.cmd_and_check("cat /var/log/messages | grep sample_hbp_handler", 
"sample_hbp_handler")
-# rmmod
-self.cmd_and_check("rmmod data_breakpoint")
-
 @OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_configfs_sample(self):
 # check config
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v3 0/2] remove the case of hw breakpoint

2018-08-03 Thread Hongzhi.Song
v3:
remove the case of hw breakpoint
v2:
test_trace_events_sample of ksample.py

Hongzhi.Song (2):
  runtime selftest: test_trace_events_sample of ksample.py
  runtime selftest: remove the case of hw breakpoint

 meta/lib/oeqa/runtime/cases/ksample.py | 30 --
 1 file changed, 12 insertions(+), 18 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v2 1/2] runtime selftest: test_trace_events_sample of ksample.py

2018-08-03 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3cfbd..26fbe9d8cb 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.assertTrue(False, "Time out when check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH 2/3] udev-extraconf/mount.sh: Fix the recursively dependency for the systemd-mount

2018-08-01 Thread Hongzhi.Song
If systemd is used, using the systemd-mount to mount the new added disk
partitions forgets to move the codes which tries to mount the partition
by using the configuration in /etc/fstab to the non-systemd function.

And it will cause the systemd-mount try to mount the partition
synchronously and trigger a recursively dependency like the following:
dev-sda1.device -> run-media-sda1.mount -> dev-sda1.device

Signed-off-by: Kevin Hao 
Signed-off-by: Hongzhi.Song 
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 3a72c455e0..816d975e5e 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -63,6 +63,16 @@ automount_systemd() {
 automount() {  
name="`basename "$DEVNAME"`"
 
+   if [ -x "$PMOUNT" ]; then
+   $PMOUNT $DEVNAME 2> /dev/null
+   elif [ -x $MOUNT ]; then
+   $MOUNT $DEVNAME 2> /dev/null
+   fi
+
+   # If the device isn't mounted at this point, it isn't
+   # configured in fstab
+   grep -q "^$DEVNAME " /proc/mounts && return
+
! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
# Silent util-linux's version of mounting auto
if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
@@ -105,19 +115,13 @@ rm_dir() {
 name="`basename "$DEVNAME"`"
 [ -e /sys/block/$name/device/media ] && media_type=`cat 
/sys/block/$name/device/media`
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o 
"$media_type" = "cdrom" ]; then
-   if [ -x "$PMOUNT" ]; then
-   $PMOUNT $DEVNAME 2> /dev/null
-   elif [ -x $MOUNT ]; then
-   $MOUNT $DEVNAME 2> /dev/null
-   fi
-   # If the device isn't mounted at this point, it isn't
-   # configured in fstab (note the root filesystem can show up as
-   # /dev/root in /proc/mounts, so check the device number too)
+   # Note the root filesystem can show up as /dev/root in /proc/mounts,
+   # so check the device number too
if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
if [ "`basename $MOUNT`" = "systemd-mount" ];then
-   grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+   automount_systemd
else
-   grep -q "^$DEVNAME " /proc/mounts || automount
+   automount
fi
fi
 fi
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH 3/3] udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the systemd-mount

2018-08-01 Thread Hongzhi.Song
When using systemd, the systemd-fstab-generator would parse the
/etc/fstab and create the corresponding unit dynamically. So we don't
need to handle the ADD action for the partitions in /etc/fstab.

Signed-off-by: Kevin Hao 
Signed-off-by: Hongzhi.Song 
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 9 +
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 816d975e5e..9796cd7b90 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -36,6 +36,15 @@ done
 automount_systemd() {
name="`basename "$DEVNAME"`"
 
+   # Skip the partition which are already in /etc/fstab
+   grep "^[[:space:]]*$DEVNAME" /etc/fstab && return
+   for n in LABEL PARTLABEL UUID PARTUUID; do
+   tmp="$(lsblk -o $n $DEVNAME | sed -e '1d')"
+   test -z "$tmp" && continue
+   tmp="$n=$tmp"
+   grep "^[[:space:]]*$tmp" /etc/fstab && return
+   done
+
 ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
 # Silent util-linux's version of mounting auto
 MOUNT="$MOUNT -o silent"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v4 1/3] udev-extraconf/mount.sh: add support to systemd

2018-08-01 Thread Hongzhi.Song
Udev-extraconf works correctly with sysvinit in the aspect of automounting
block devices. But it has a serious problem in case of systemd. Block devices
automounted by udev is unaccessible to host space(out of udevd's private
namespace). For example, we cannot format those block devices.

e.g.
root@qemux86:~# mkfs.ext4 /dev/sda1
mke2fs 1.43.8
/dev/sda1 contains a ext4 file system
last mounted on Tue Apr
Proceed anyway? (y,N) y
/dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Other distributions has no such problem, because they use a series of rules to
manager block devices. Different types of block devices match different rules.
But udev-extraconf just use one rule, automount.rules, which results in this
problem.

The 'systemd-mount' command is recommended by the systemd community to solve 
such
problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 55 +++---
 1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328a09..3a72c455e0 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,26 @@
 #
 # Attempt to mount any added block devices and umount any removed devices
 
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
 
-MOUNT="/bin/mount"
 PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
 for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
 do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,6 +33,33 @@ do
fi
 done
 
+automount_systemd() {
+   name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+# Silent util-linux's version of mounting auto
+MOUNT="$MOUNT -o silent"
+
+# If filesystem type is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "systemd-mount of 
[/run/media/$name] successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
 automount() {  
name="`basename "$DEVNAME"`"
 
@@ -61,19 +104,21 @@ rm_dir() {
 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"
 [ -e /sys/block/$name/device/media ] && media_type=`cat 
/sys/block/$name/device/media`
-
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o 
"$media_type" = "cdrom" ]; then
if [ -x "$PMOUNT" ]; then
$PMOUNT $DEVNAME 2> /dev/null
elif [ -x $MOUNT ]; then
$MOUNT $DEVNAME 2> /dev/null
fi
-   
# If the device isn't mounted at this point, it isn't
# configured in fstab (note the root filesystem can show up as
# /dev/root in /proc/mounts, so check the device number too)
if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
-   grep -q "^$DEVNAME " /proc/mounts || automount
+   if [ "`basename $MOUNT`" = "systemd-mount" ];then
+   grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+   else
+   grep -q "^$DEVNAME " /proc/mounts || automount
+   fi
fi
 fi
 
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH v4 0/3] udev-extraconf/mount.sh: add support to systemd

2018-08-01 Thread Hongzhi.Song
v4:
Fix the recursively dependency for the systemd-mount
v3:
perfect syntax

Hongzhi.Song (3):
  udev-extraconf/mount.sh: add support to systemd
  udev-extraconf/mount.sh: Fix the recursively dependency for the
systemd-mount
  udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the
systemd-mount

 meta/recipes-core/udev/udev-extraconf/mount.sh | 84 ++
 1 file changed, 71 insertions(+), 13 deletions(-)

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH] poky-lsb: security_flags.inc

2018-07-31 Thread Hongzhi.Song
To fix the following error, we append '-O' to the defination of _FORTIFY_SOURCE

recipe-sysroot/usr/include/features.h:381:4: error: #warning _FORTIFY_SOURCE 
requires compiling with optimization (-O) [-Werror=cpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
 ^~~

Signed-off-by: Hongzhi.Song 
---
 meta/conf/distro/include/security_flags.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/distro/include/security_flags.inc 
b/meta/conf/distro/include/security_flags.inc
index 6245e89ada..1c32fd3165 100644
--- a/meta/conf/distro/include/security_flags.inc
+++ b/meta/conf/distro/include/security_flags.inc
@@ -10,7 +10,7 @@ GCCPIE ?= "--enable-default-pie"
 
 # _FORTIFY_SOURCE requires -O1 or higher, so disable in debug builds as they 
use
 # -O0 which then results in a compiler warning.
-lcl_maybe_fortify = 
"${@oe.utils.conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE=2',d)}"
+lcl_maybe_fortify = 
"${@oe.utils.conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE=2 -O',d)}"
 
 # Error on use of format strings that represent possible security problems
 SECURITY_STRINGFORMAT ?= "-Wformat -Wformat-security -Werror=format-security"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 1/1] snappy: add a new recipe

2018-07-26 Thread Hongzhi.Song
Snappy is a compression/decompression library. It does not aim for
maximum compression, or compatibility with any other compression
library; instead, it aims for very high speeds and reasonable compression.

Signed-off-by: Hongzhi.Song 
---
 meta-oe/recipes-extended/snappy/snappy_1.1.7.bb | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 meta-oe/recipes-extended/snappy/snappy_1.1.7.bb

diff --git a/meta-oe/recipes-extended/snappy/snappy_1.1.7.bb 
b/meta-oe/recipes-extended/snappy/snappy_1.1.7.bb
new file mode 100644
index 0..6f1978a07
--- /dev/null
+++ b/meta-oe/recipes-extended/snappy/snappy_1.1.7.bb
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2014 Wind River Systems, Inc.
+# Released under the BSD-3-Clause license (see COPYING.BSD-3 for the terms)
+#
+SUMMARY = "A compression/decompression library"
+DESCRIPTION = "Snappy is a fast data compression and decompression library \
+It was designed to be very fast and stable, but not to achieve a high \
+compression ratio."
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://COPYING;md5=f62f3080324a97b3159a7a7e61812d0c"
+
+SRC_URI = 
"https://src.fedoraproject.org/repo/pkgs/snappy/snappy-1.1.7.tar.gz/sha512/32046f532606ba545a4e4825c0c66a19be449f2ca2ff760a6fa170a3603731479a7deadb683546e5f8b5033414c50f4a9a29f6d23b7a41f047e566e69eca7caf/snappy-1.1.7.tar.gz;
+
+SRC_URI[md5sum] = "ee9086291c9ae8deb4dac5e0b85bf54a"
+SRC_URI[sha256sum] = 
"3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4"
+
+inherit cmake pkgconfig
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[lzo] = "-DHAVE_LIBLZO2=1,-DHAVE_LIBLZO2=0,lzo,"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta-oe][PATCH v3 0/1] snappy: add a new recipe

2018-07-26 Thread Hongzhi.Song
v3:
modify license BSD-3

Hongzhi.Song (1):
  snappy: add a new recipe

 meta-oe/recipes-extended/snappy/snappy_1.1.7.bb | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 meta-oe/recipes-extended/snappy/snappy_1.1.7.bb

-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH] runtime selftest: test_trace_events_sample of ksample.py

2018-07-20 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3c..26fbe9d 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.assertTrue(False, "Time out when check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH v2] fix the failure test_trace_events of ksample.py

2018-07-20 Thread Hongzhi.Song
v2:
assert failure when timeout

Hongzhi.Song (1):
  runtime selftest: test_trace_events_sample of ksample.py

 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH] runtime selftest: test_trace_events_sample of ksample.py

2018-07-20 Thread Hongzhi.Song
The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3c..3e9cfc6 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
 else:
 # check result
 result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
 self.assertEqual(status, 0, cmd)
 
 def check_config(self, config_opt=''):
@@ -126,7 +127,16 @@ class KSampleTest(KSample):
 self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.skipTest("Time out for check result")
 # disable trace
 self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
 # clean up trace
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3] kernel-selftest: Add a recipe on kernel selftest

2018-07-06 Thread Hongzhi.Song
The recipe builds the framework for kernel-selftest. Now, it just
contains two sets of testcase, bpf and vm. We are appending others
to the recipe.

It needs some features which will be written into relevant recipe.
But now, you should add them to conf/local.conf manually.
KERNEL_FEATURES_append += "features/bpf/bpf.scc"

Signed-off-by: Dengke Du 
Signed-off-by: Hongzhi.Song 
---
 .../kernel-selftest/kernel-selftest.bb | 94 ++
 1 file changed, 94 insertions(+)
 create mode 100644 meta/recipes-kernel/kernel-selftest/kernel-selftest.bb

diff --git a/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb 
b/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
new file mode 100644
index 000..28fd178
--- /dev/null
+++ b/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -0,0 +1,94 @@
+SUMMARY = "Kernel selftest for Linux"
+DESCRIPTION = "Kernel selftest for Linux"
+LICENSE = "GPLv2"
+
+# for bpf and vm
+DEPENDS = " \
+elfutils \
+libcap \
+libcap-ng \
+fuse \
+util-linux \
+rsync-native \
+"
+# for vm
+RDEPENDS_${PN} += "libgcc \
+   bash \
+"
+
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+inherit linux-kernel-base kernel-arch
+
+do_populate_lic[depends] += "virtual/kernel:do_patch"
+
+S = "${WORKDIR}/${BP}"
+
+# now we just test bpf and vm
+# we will append other kernel selftest in the future
+TEST_LIST = "bpf \
+ vm \
+"
+
+EXTRA_OEMAKE = '\
+CROSS_COMPILE=${TARGET_PREFIX} \
+ARCH=${ARCH} \
+CC="${CC}" \
+AR="${AR}" \
+LD="${LD}" \
+'
+
+EXTRA_OEMAKE += "\
+'DESTDIR=${D}' \
+"
+
+KERNEL_SELFTEST_SRC ?= "Makefile \
+include \
+tools \
+scripts \
+arch \
+"
+
+do_compile() {
+for i in ${TEST_LIST}
+do
+oe_runmake -C ${S}/tools/testing/selftests/${i}
+done
+}
+
+do_install() {
+for i in ${TEST_LIST}
+do
+oe_runmake -C ${S}/tools/testing/selftests/${i} 
INSTALL_PATH=${D}/opt/kselftest/${i} install
+done
+
+chown root:root  -R ${D}/opt/kselftest
+}
+
+do_configure() {
+:
+}
+
+do_configure[prefuncs] += "copy_perf_source_from_kernel remove_clang_related"
+python copy_perf_source_from_kernel() {
+sources = (d.getVar("KERNEL_SELFTEST_SRC") or "").split()
+src_dir = d.getVar("STAGING_KERNEL_DIR")
+dest_dir = d.getVar("S")
+bb.utils.mkdirhier(dest_dir)
+for s in sources:
+src = oe.path.join(src_dir, s)
+dest = oe.path.join(dest_dir, s)
+if os.path.isdir(src):
+oe.path.copytree(src, dest)
+else:
+bb.utils.copyfile(src, dest)
+}
+
+remove_clang_related() {
+   sed -i -e '/test_pkt_access/d' -e '/test_pkt_md_access/d' 
${S}/tools/testing/selftests/bpf/Makefile
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT="1"
+FILES_${PN} += "/opt/kselftest/"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH V2 1/2] kernel-selftest: add it

2018-07-06 Thread Hongzhi.Song
From: Dengke Du 

The framework for kernel-selftest, this framework contains many aspect,
such as bpf, we should enable bpf kernel feature, this enable bpf syscall.

How to test?
On target, enter directory: /opt/kselftest/bpf/, run "./test_align 0 11"
this command test all the bpf align testcases.

Results:
Test   0: mov ... PASS
Test   1: shift ... PASS
Test   2: addsub ... PASS
Test   3: mul ... PASS
Test   4: unknown shift ... PASS
Test   5: unknown mul ... PASS
Test   6: packet const offset ... PASS
Test   7: packet variable offset ... PASS
Test   8: packet variable offset 2 ... PASS
Test   9: dubious pointer arithmetic ... PASS
Test  10: variable subtraction ... PASS
Test  11: pointer variable subtraction ... PASS
Results: 12 pass 0 fail

Signed-off-by: Dengke Du 
---
 .../kernel-selftest/kernel-selftest.bb | 94 ++
 meta/recipes-kernel/linux/linux-yocto.inc  |  1 +
 2 files changed, 95 insertions(+)
 create mode 100644 meta/recipes-kernel/kernel-selftest/kernel-selftest.bb

diff --git a/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb 
b/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
new file mode 100644
index 000..c976e7b
--- /dev/null
+++ b/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -0,0 +1,94 @@
+SUMMARY = "Kernel selftest for Linux"
+DESCRIPTION = "Kernel selftest for Linux"
+LICENSE = "GPLv2"
+
+DEPENDS = " \
+elfutils \
+libcap \
+libcap-ng \
+fuse \
+util-linux \
+rsync-native \
+"
+
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+inherit linux-kernel-base kernel-arch
+
+do_populate_lic[depends] += "virtual/kernel:do_patch"
+
+inherit kernelsrc
+
+S = "${WORKDIR}/${BP}"
+
+# The LDFLAGS is required or some old kernels fails due missing
+# symbols and this is preferred than requiring patches to every old
+# supported kernel.
+LDFLAGS="-ldl -lutil"
+
+EXTRA_OEMAKE = '\
+CROSS_COMPILE=${TARGET_PREFIX} \
+ARCH=${ARCH} \
+CC="${CC}" \
+AR="${AR}" \
+LD="${LD}" \
+EXTRA_CFLAGS="-ldw" \
+${PACKAGECONFIG_CONFARGS} \
+'
+
+EXTRA_OEMAKE += "\
+'DESTDIR=${D}' \
+'prefix=${prefix}' \
+'bindir=${bindir}' \
+'sharedir=${datadir}' \
+'sysconfdir=${sysconfdir}' \
+'sharedir=${@os.path.relpath(datadir, prefix)}' \
+'mandir=${@os.path.relpath(mandir, prefix)}' \
+'infodir=${@os.path.relpath(infodir, prefix)}' \
+"
+
+KERNEL_SELFTEST_SRC ?= "Makefile \
+ include \
+ tools \
+"
+
+# Add bpf selftest now, other can be added later.
+do_compile () {
+   # Linux kernel build system is expected to do the right thing
+   unset CFLAGS
+   oe_runmake -C ${S}/tools/testing/selftests/bpf
+}
+
+# On target, enter /opt/kselftest/bpf directory, run "./test_align 0 11"
+# The test_align testcase test the bpf instruction set, the testcase defined 
here:
+# 
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/tree/tools/testing/selftests/bpf/test_align.c#n47
+do_install () {
+   # Linux kernel build system is expected to do the right thing
+   unset CFLAGS
+   mkdir -p ${D}/opt/kselftest/bpf
+   install -m 0755 ${B}/tools/testing/selftests/bpf/test_align 
${D}/opt/kselftest/bpf/
+}
+
+do_configure[prefuncs] += "copy_perf_source_from_kernel remove_clang_related"
+python copy_perf_source_from_kernel() {
+sources = (d.getVar("KERNEL_SELFTEST_SRC") or "").split()
+src_dir = d.getVar("STAGING_KERNEL_DIR")
+dest_dir = d.getVar("S")
+bb.utils.mkdirhier(dest_dir)
+for s in sources:
+src = oe.path.join(src_dir, s)
+dest = oe.path.join(dest_dir, s)
+if os.path.isdir(src):
+oe.path.copytree(src, dest)
+else:
+bb.utils.copyfile(src, dest)
+}
+
+remove_clang_related() {
+   sed -i -e '/test_pkt_access/d' -e '/test_pkt_md_access/d' 
${S}/tools/testing/selftests/bpf/Makefile
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT="1"
+FILES_${PN} += "/opt/kselftest/bpf/*"
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc 
b/meta/recipes-kernel/linux/linux-yocto.inc
index 1ebfb60..362d6d8 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -72,3 +72,4 @@ addtask kernel_configcheck after do_configure before 
do_compile
 
 # enable kernel-sample for oeqa/runtime/cases's ksample.py test
 KERNEL_FEATURES_append_qemuall=" features/kernel-sample/kernel-sample.scc"
+KERNEL_FEATURES_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 
'features/bpf/bpf.scc', '', d)}"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH V2 0/2] kernel-selftest: add it

2018-07-06 Thread Hongzhi.Song
The following changes since commit 611013a23a0082faa4fda2cd2529668965586a76:

  mesa: add lost Upstream-Status tag (2018-07-05 00:22:08 +0100)

are available in the git repository at:

  https://github.com/csqshz/openembedded-core.git hong/kself
  https://github.com//tree/hong/kself

Dengke Du (1):
  kernel-selftest: add it

Hongzhi.Song (1):
  kernel-selftest: add vm testcase to recipe

 .../kernel-selftest/kernel-selftest.bb | 94 ++
 meta/recipes-kernel/linux/linux-yocto.inc  |  1 +
 2 files changed, 95 insertions(+)
 create mode 100644 meta/recipes-kernel/kernel-selftest/kernel-selftest.bb

-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH V2 2/2] kernel-selftest: add vm testcase to recipe

2018-07-06 Thread Hongzhi.Song
Add vm testcase to recipe, and sightly modify organization of code

Signed-off-by: Hongzhi.Song 
---
 .../kernel-selftest/kernel-selftest.bb | 62 +++---
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb 
b/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
index c976e7b..28fd178 100644
--- a/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
+++ b/meta/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -2,6 +2,7 @@ SUMMARY = "Kernel selftest for Linux"
 DESCRIPTION = "Kernel selftest for Linux"
 LICENSE = "GPLv2"
 
+# for bpf and vm
 DEPENDS = " \
 elfutils \
 libcap \
@@ -10,6 +11,10 @@ DEPENDS = " \
 util-linux \
 rsync-native \
 "
+# for vm
+RDEPENDS_${PN} += "libgcc \
+   bash \
+"
 
 do_configure[depends] += "virtual/kernel:do_shared_workdir"
 
@@ -17,14 +22,13 @@ inherit linux-kernel-base kernel-arch
 
 do_populate_lic[depends] += "virtual/kernel:do_patch"
 
-inherit kernelsrc
-
 S = "${WORKDIR}/${BP}"
 
-# The LDFLAGS is required or some old kernels fails due missing
-# symbols and this is preferred than requiring patches to every old
-# supported kernel.
-LDFLAGS="-ldl -lutil"
+# now we just test bpf and vm
+# we will append other kernel selftest in the future
+TEST_LIST = "bpf \
+ vm \
+"
 
 EXTRA_OEMAKE = '\
 CROSS_COMPILE=${TARGET_PREFIX} \
@@ -32,41 +36,37 @@ EXTRA_OEMAKE = '\
 CC="${CC}" \
 AR="${AR}" \
 LD="${LD}" \
-EXTRA_CFLAGS="-ldw" \
-${PACKAGECONFIG_CONFARGS} \
 '
 
 EXTRA_OEMAKE += "\
 'DESTDIR=${D}' \
-'prefix=${prefix}' \
-'bindir=${bindir}' \
-'sharedir=${datadir}' \
-'sysconfdir=${sysconfdir}' \
-'sharedir=${@os.path.relpath(datadir, prefix)}' \
-'mandir=${@os.path.relpath(mandir, prefix)}' \
-'infodir=${@os.path.relpath(infodir, prefix)}' \
 "
 
 KERNEL_SELFTEST_SRC ?= "Makefile \
- include \
- tools \
+include \
+tools \
+scripts \
+arch \
 "
 
-# Add bpf selftest now, other can be added later.
-do_compile () {
-   # Linux kernel build system is expected to do the right thing
-   unset CFLAGS
-   oe_runmake -C ${S}/tools/testing/selftests/bpf
+do_compile() {
+for i in ${TEST_LIST}
+do
+oe_runmake -C ${S}/tools/testing/selftests/${i}
+done
+}
+
+do_install() {
+for i in ${TEST_LIST}
+do
+oe_runmake -C ${S}/tools/testing/selftests/${i} 
INSTALL_PATH=${D}/opt/kselftest/${i} install
+done
+
+chown root:root  -R ${D}/opt/kselftest
 }
 
-# On target, enter /opt/kselftest/bpf directory, run "./test_align 0 11"
-# The test_align testcase test the bpf instruction set, the testcase defined 
here:
-# 
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/tree/tools/testing/selftests/bpf/test_align.c#n47
-do_install () {
-   # Linux kernel build system is expected to do the right thing
-   unset CFLAGS
-   mkdir -p ${D}/opt/kselftest/bpf
-   install -m 0755 ${B}/tools/testing/selftests/bpf/test_align 
${D}/opt/kselftest/bpf/
+do_configure() {
+:
 }
 
 do_configure[prefuncs] += "copy_perf_source_from_kernel remove_clang_related"
@@ -91,4 +91,4 @@ remove_clang_related() {
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 INHIBIT_PACKAGE_DEBUG_SPLIT="1"
-FILES_${PN} += "/opt/kselftest/bpf/*"
+FILES_${PN} += "/opt/kselftest/"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH v5 0/2] Add kernel-sample tests for runtime test

2018-06-29 Thread Hongzhi.Song
V5:
* remove a part of ksample.py code on 'OETestID'
V4:
* add support for qemu by default
V3:
* remove duplicated code
V2:
* use shared function to replace similar code

Hongzhi.Song (2):
  meta runtime testcases: enable kernel-sample features for runtime
tests
  Meta runtime cases: add testcases for kernel sample

 meta/lib/oeqa/runtime/cases/ksample.py| 206 ++
 meta/recipes-kernel/linux/linux-yocto.inc |   3 +
 2 files changed, 209 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH 2/2] Meta runtime cases: add testcases for kernel sample

2018-06-29 Thread Hongzhi.Song
We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " features/kernel-sample/kernel-sample.scc" in
local.conf.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 206 +
 1 file changed, 206 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 000..260bc3c
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,206 @@
+import os
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+# need some kernel fragments
+# echo "KERNEL_FEATURES_append += \" 
features\/kernel\-sample\/kernel\-sample.scc\"" >> local.conf
+class KSample(OERuntimeTestCase):
+def cmd_and_check(self, cmd='', match_string=''):
+status, output = self.target.run(cmd)
+if not match_string:
+# send cmd
+msg = '%s failed, %s' % (cmd, output)
+self.assertEqual(status, 0, msg=msg)
+else:
+# check result
+result = ("%s" % match_string) in output
+self.assertTrue(result)
+self.assertEqual(status, 0, cmd)
+
+def check_config(self, config_opt=''):
+cmd = "zcat /proc/config.gz | grep %s" % config_opt
+status, output = self.target.run(cmd)
+result = ("%s=y" % config_opt) in output
+if not result:
+self.skipTest("%s is not set" % config_opt)
+
+def check_module_exist(self, path='', module_name=''):
+status, output = self.target.run("uname -r")
+cmd = "ls " + "/lib/modules/" + output + "/kernel/samples/" + path + 
module_name
+status, output = self.target.run(cmd)
+if status != 0:
+error_info = module_name + "doesn't exist"
+self.skipTest(error_info)
+
+def kfifo_func(self, name=''):
+module_prename = name + "-example"
+module_name = name + "-example.ko"
+sysmbol_name = name + "_example"
+
+# make sure if module exists
+self.check_module_exist("kfifo/", module_name)
+# modprobe
+self.cmd_and_check("modprobe %s" % module_prename)
+# lsmod
+self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, 
sysmbol_name)
+# check result
+self.cmd_and_check("dmesg | grep \"test passed\" ", "test passed")
+# rmmod
+self.cmd_and_check("rmmod %s" %  module_prename)
+
+def kprobe_func(self, name=''):
+# check config
+self.check_config("CONFIG_KPROBES")
+
+module_prename = name + "_example"
+module_name = name + "_example.ko"
+sysmbol_name = module_prename
+
+# make sure if module exists
+self.check_module_exist("kprobes/", module_name)
+# modprobe
+self.cmd_and_check("modprobe %s" % module_prename)
+# lsmod
+self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, 
sysmbol_name)
+# check result
+self.cmd_and_check("dmesg | grep Planted | head -n10", "Planted")
+# rmmod
+self.cmd_and_check("rmmod %s" % module_prename)
+
+def kobject_func(self, name=''):
+module_prename = name + "_example"
+module_name = name + "-example.ko"
+sysmbol_name = module_prename
+
+# make sure if module exists
+self.check_module_exist("kobject/", module_name)
+# modprobe
+self.cmd_and_check("modprobe %s" % module_prename)
+# lsmod
+self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, 
sysmbol_name)
+# check result
+self.cmd_and_check("ls /sys/kernel/%s/" % sysmbol_name, "bar")
+# rmmod
+self.cmd_and_check("rmmod %s" % module_prename)
+
+class KSampleTest(KSample):
+# kfifo
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_kfifo_test(self):
+index = ["dma", "bytestream", "inttype", "record"]
+for i in index:
+self.kfifo_func(i)
+
+# kprobe
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+d

[OE-core] [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests

2018-06-29 Thread Hongzhi.Song
Enable kernel-sample features by default with the machine of qemu.

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-yocto.inc 
b/meta/recipes-kernel/linux/linux-yocto.inc
index 3bb872a..b7511e5 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -67,3 +67,6 @@ do_install_append(){
 addtask kernel_version_sanity_check after do_kernel_metadata 
do_kernel_checkout before do_compile
 addtask validate_branches before do_patch after do_kernel_checkout
 addtask kernel_configcheck after do_configure before do_compile
+
+# enable kernel-sample for oeqa/runtime/cases's ksample.py test
+KERNEL_FEATURES_append_qemuall=" features/kernel-sample/kernel-sample.scc"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH 0/2] Add kernel-sample tests for runtime test

2018-06-04 Thread Hongzhi.Song
V4:
 * add support for qemu by default

V3:
 * remove duplicated code

V2:
 * use shared function to replace similar code

Hongzhi.Song (2):
  meta runtime testcases: enable kernel-sample features for runtime
tests
  Meta runtime cases: add testcases for kernel sample

 meta/lib/oeqa/runtime/cases/ksample.py| 213 ++
 meta/recipes-kernel/linux/linux-yocto.inc |   3 +
 2 files changed, 216 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH 1/2] meta runtime testcases: enable kernel-sample features for runtime tests

2018-06-04 Thread Hongzhi.Song
Enable kernel-sample features by default with the machine of qemu.

Signed-off-by: Hongzhi.Song 
---
 meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-yocto.inc 
b/meta/recipes-kernel/linux/linux-yocto.inc
index 3bb872a..b7511e5 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -67,3 +67,6 @@ do_install_append(){
 addtask kernel_version_sanity_check after do_kernel_metadata 
do_kernel_checkout before do_compile
 addtask validate_branches before do_patch after do_kernel_checkout
 addtask kernel_configcheck after do_configure before do_compile
+
+# enable kernel-sample for oeqa/runtime/cases's ksample.py test
+KERNEL_FEATURES_append_qemuall=" features/kernel-sample/kernel-sample.scc"
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta][PATCH 2/2 v4] Meta runtime cases: add testcases for kernel sample

2018-06-04 Thread Hongzhi.Song
We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " features/kernel-sample/kernel-sample.scc" in
local.conf.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 213 +
 1 file changed, 213 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 000..74f06e0
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,213 @@
+import os
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class KSample(OERuntimeTestCase):
+def cmd_and_check(self, cmd='', match_string=''):
+if not match_string:
+# send cmd
+status, output = self.target.run(cmd)
+msg = '%s failed, %s' % (cmd, output)
+self.assertEqual(status, 0, msg=msg)
+else:
+# check result
+status, output = self.target.run(cmd)
+result = ("%s" % match_string) in output
+self.assertTrue(result)
+self.assertEqual(status, 0, cmd)
+
+def check_config(self, config_opt=''):
+cmd = "zcat /proc/config.gz | grep %s" % config_opt
+status, output = self.target.run(cmd)
+result = ("%s=y" % config_opt) in output
+if not result:
+self.skipTest("%s is not set" % config_opt)
+
+def check_module_exist(self, path='', module_name=''):
+status, output = self.target.run("uname -r")
+cmd = "ls " + "/lib/modules/" + output + "/kernel/samples/" + path + 
module_name
+status, output = self.target.run(cmd)
+if status != 0:
+error_info = module_name + "doesn't exist"
+self.skipTest(error_info)
+
+def kfifo_func(self, name=''):
+module_prename = name + "-example"
+module_name = name + "-example.ko"
+sysmbol_name = name + "_example"
+
+# make sure if module exists
+self.check_module_exist("kfifo/", module_name)
+# modprobe
+self.cmd_and_check("modprobe %s" % module_prename)
+# lsmod
+self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, 
sysmbol_name)
+# check result
+self.cmd_and_check("dmesg | grep \"test passed\" ", "test passed")
+# rmmod
+self.cmd_and_check("rmmod %s" %  module_prename)
+
+def kprobe_func(self, name=''):
+# check config
+self.check_config("CONFIG_KPROBES")
+
+module_prename = name + "_example"
+module_name = name + "_example.ko"
+sysmbol_name = module_prename
+
+# make sure if module exists
+self.check_module_exist("kprobes/", module_name)
+# modprobe
+self.cmd_and_check("modprobe %s" % module_prename)
+# lsmod
+self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, 
sysmbol_name)
+# check result
+self.cmd_and_check("dmesg | grep Planted | head -n10", "Planted")
+# rmmod
+self.cmd_and_check("rmmod %s" % module_prename)
+
+def kobject_func(self, name=''):
+module_prename = name + "_example"
+module_name = name + "-example.ko"
+sysmbol_name = module_prename
+
+# make sure if module exists
+self.check_module_exist("kobject/", module_name)
+# modprobe
+self.cmd_and_check("modprobe %s" % module_prename)
+# lsmod
+self.cmd_and_check("lsmod | grep %s | cut -d\' \' -f1" % sysmbol_name, 
sysmbol_name)
+# check result
+self.cmd_and_check("ls /sys/kernel/%s/" % sysmbol_name, "bar")
+# rmmod
+self.cmd_and_check("rmmod %s" % module_prename)
+
+class KSampleTest(KSample):
+# kfifo
+@OETestID(33)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_kfifo_test(self):
+index = ["dma", "bytestream", "inttype", "record"]
+for i in index:
+self.kfifo_func(i)
+
+# kprobe
+@OETestID(43)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_kprobe_test(self):
+index = ["kprobe",

[OE-core] [meta][lib/oeqa][PATCH v3] Meta runtime cases: add testcases for kernel sample

2018-06-02 Thread Hongzhi.Song
We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " kernel-sample/kernel-sample.scc" in
local.conf.

kernel-sample feature has been merged into master branch.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 272 +
 1 file changed, 272 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 000..719f1a0
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,272 @@
+import os
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class KSample(OERuntimeTestCase):
+def send_cmd(self, cmd='', content=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+msg = '%s failed, %s' % (comd, ret)
+self.assertEqual(status, 0, msg=msg)
+
+def check_config(self, config_opt=''):
+cmd = "zcat /proc/config.gz | grep %s" % config_opt
+status, ret = self.target.run(cmd)
+result = ("%s=y" % config_opt) in ret
+if not result:
+self.skipTest("CONFIG error")
+
+def check_module_exist(self, path='', module_name=''):
+status, ret = self.target.run("uname -r")
+cmd = "ls " + "/lib/modules/" + ret + "/kernel/samples/" + path + 
module_name
+status, output = self.target.run(cmd)
+if status != 0:
+error_info = module_name + "doesn't exist"
+self.skipTest(error_info)
+
+def send_check(self, cmd='', content='', comp=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+self.assertEqual(ret, comp, comd)
+
+def send_check_in(self, cmd='', content='', comp=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+result = ("%s" % comp) in ret
+self.assertTrue(result)
+self.assertEqual(status, 0, comd)
+
+class KSampleTest(KSample):
+#trace
+@OETestID(33)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_events(self):
+# check config
+self.check_config("CONFIG_TRACING_SUPPORT")
+# make sure if module exists
+self.check_module_exist("trace_events/", "trace-events-sample.ko")
+# modprobe
+self.send_cmd("modprobe", "trace-events-sample")
+# lsmod
+self.send_check("lsmod", "| grep trace_events_sample | cut -d\' \' 
-f1", "trace_events_sample")
+# check dir
+self.send_check("ls", "/sys/kernel/debug/tracing/events/ | grep 
sample-trace", "sample-trace")
+# enable trace
+self.send_cmd("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
+self.send_cmd("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
+# check result
+self.send_check("cat", "/sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+# disable trace
+self.send_cmd('echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+# clean up trace
+self.send_cmd('echo > /sys/kernel/debug/tracing/trace')
+# rmmod
+self.send_cmd('rmmod trace-events-sample')
+
+@OETestID(34)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_printk(self):
+# check config
+self.check_config("CONFIG_TRACING_SUPPORT")
+# make sure if module exists
+self.check_module_exist("trace_printk/", "trace-printk.ko")
+# modprobe
+self.send_cmd('modprobe', 'trace-printk')
+# lsmod
+self.send_check("lsmod", "| grep trace_printk | cut -d\' \' -f1", 
"trace_printk")
+# check result
+self.send_check("cat", "/sys/kernel/debug/tracing/trace | grep 
trace_printk_irq_work | head -n1 | cut -d\':\' -f2", " trace_printk_irq_work")
+# clean up trace
+self.send_cmd('echo > /sys/kernel/debug/tracing/trace')
+# rmmod
+self.send_cmd('rmmod trace-printk')
+# kprobe
+@OETestID(43)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_kprobe_examp

[OE-core] [meta][lib/oeqa][PATCH v2] Meta runtime cases: add testcases for kernel sample

2018-06-01 Thread Hongzhi.Song
We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " kernel-sample/kernel-sample.scc" in
local.conf.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 272 +
 meta/lib/oeqa/runtime/cases/ksample_abs.py | 272 +
 2 files changed, 544 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample_abs.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 000..719f1a0
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,272 @@
+import os
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class KSample(OERuntimeTestCase):
+def send_cmd(self, cmd='', content=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+msg = '%s failed, %s' % (comd, ret)
+self.assertEqual(status, 0, msg=msg)
+
+def check_config(self, config_opt=''):
+cmd = "zcat /proc/config.gz | grep %s" % config_opt
+status, ret = self.target.run(cmd)
+result = ("%s=y" % config_opt) in ret
+if not result:
+self.skipTest("CONFIG error")
+
+def check_module_exist(self, path='', module_name=''):
+status, ret = self.target.run("uname -r")
+cmd = "ls " + "/lib/modules/" + ret + "/kernel/samples/" + path + 
module_name
+status, output = self.target.run(cmd)
+if status != 0:
+error_info = module_name + "doesn't exist"
+self.skipTest(error_info)
+
+def send_check(self, cmd='', content='', comp=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+self.assertEqual(ret, comp, comd)
+
+def send_check_in(self, cmd='', content='', comp=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+result = ("%s" % comp) in ret
+self.assertTrue(result)
+self.assertEqual(status, 0, comd)
+
+class KSampleTest(KSample):
+#trace
+@OETestID(33)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_events(self):
+# check config
+self.check_config("CONFIG_TRACING_SUPPORT")
+# make sure if module exists
+self.check_module_exist("trace_events/", "trace-events-sample.ko")
+# modprobe
+self.send_cmd("modprobe", "trace-events-sample")
+# lsmod
+self.send_check("lsmod", "| grep trace_events_sample | cut -d\' \' 
-f1", "trace_events_sample")
+# check dir
+self.send_check("ls", "/sys/kernel/debug/tracing/events/ | grep 
sample-trace", "sample-trace")
+# enable trace
+self.send_cmd("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
+self.send_cmd("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
+# check result
+self.send_check("cat", "/sys/kernel/debug/tracing/trace | grep hello | 
head -n1 | cut -d\':\' -f2", " foo_bar")
+# disable trace
+self.send_cmd('echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+# clean up trace
+self.send_cmd('echo > /sys/kernel/debug/tracing/trace')
+# rmmod
+self.send_cmd('rmmod trace-events-sample')
+
+@OETestID(34)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_printk(self):
+# check config
+self.check_config("CONFIG_TRACING_SUPPORT")
+# make sure if module exists
+self.check_module_exist("trace_printk/", "trace-printk.ko")
+# modprobe
+self.send_cmd('modprobe', 'trace-printk')
+# lsmod
+self.send_check("lsmod", "| grep trace_printk | cut -d\' \' -f1", 
"trace_printk")
+# check result
+self.send_check("cat", "/sys/kernel/debug/tracing/trace | grep 
trace_printk_irq_work | head -n1 | cut -d\':\' -f2", " trace_printk_irq_work")
+# clean up trace
+self.send_cmd('echo > /sys/kernel/debug/tracing/trace')
+# rmmod
+self.send_cmd('rmmod trace-printk')
+# kprobe
+@OETestID(43)
+@OET

[OE-core] [PATCH] Meta runtime cases: add testcases for kernel sample

2018-06-01 Thread Hongzhi.Song
We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " kernel-sample/kernel-sample.scc" in
local.conf.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample.py | 440 +
 1 file changed, 440 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 000..8a9d136
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,440 @@
+import os
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class KSampleTest(OERuntimeTestCase):
+
+@OETestID(33)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_events(self):
+# check config
+status, ret = self.target.run('zcat /proc/config.gz | grep 
CONFIG_TRACING_SUPPORT')
+result = "CONFIG_TRACING_SUPPORT=y" in ret
+if not result:
+self.skipTest("CONFIG error")
+# make sure if module exists
+status, ret = self.target.run('uname -r')
+cmd = "ls " + "/lib/modules/" + ret + 
"/kernel/samples/trace_events/trace-events-sample.ko"
+status, output = self.target.run(cmd)
+if status != 0:
+self.skipTest("trace-events-sample.ko doesn't exist")
+
+# modprobe
+status, output = self.target.run('modprobe trace-events-sample')
+msg = 'modprobe trace-events failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# lsmod
+status, output = self.target.run('lsmod | grep trace_events_sample | 
cut -d\' \' -f1')
+self.assertEqual(output, "trace_events_sample", 'lsmod 
trace_events_sample failed')
+msg = 'lsmod trace-events failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# check dir
+status, output = self.target.run('ls /sys/kernel/debug/tracing/events/ 
| grep sample-trace')
+self.assertEqual(output, "sample-trace", 'no dir of sample-trace')
+msg = 'if create dir of sample-tree, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# enable trace
+status, output = self.target.run('echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+self.assertEqual(output, "1", 'failed to enable')
+msg = 'cat enable, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# check result
+status, output = self.target.run('cat /sys/kernel/debug/tracing/trace 
| grep hello | head -n1 | cut -d\':\' -f2')
+self.assertEqual(output, " foo_bar", 'failed')
+msg = 'cat trace-events, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# enable trace
+status, output = self.target.run('echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+msg = 'disable, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# clean up trace
+status, output = self.target.run('echo > 
/sys/kernel/debug/tracing/trace')
+msg = 'clearup trace, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# rmmod
+status, output = self.target.run('rmmod trace-events-sample')
+msg = 'rmmod, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+
+@OETestID(34)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_printk(self):
+# check config
+status, ret = self.target.run('zcat /proc/config.gz | grep 
CONFIG_TRACING_SUPPORT')
+result = "CONFIG_TRACING_SUPPORT=y" in ret
+if not result:
+self.skipTest("CONFIG error")
+# make sure if module exists
+status, ret = self.target.run('uname -r')
+cmd = "ls " + "/lib/modules/" + ret + 
"/kernel/samples/trace_printk/trace-printk.ko"
+status, output = self.target.run(cmd)
+if status != 0:
+self.skipTest("trace-printk.ko doesn't exist")
+
+# modprobe
+status, output = self.target.run('modprobe trace-printk')
+msg = 'modprobe trace-printk failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# lsmod
+status, output = self.target.run('lsmod | gr

[OE-core] [PATCH] oe-selftest: add kernel sample of trace-events to oe-selftest

2018-05-29 Thread Hongzhi.Song
We are going to let oe-selftest support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just one of kernel samples which contains about 13 tests
enabled by kernel-sample.scc. So it needs KERNEL_FEATURES_append =
" kernel-sample/kernel-sample.scc" in local.conf.

kernel-sample.scc has been accepted by kernel-cache with master branch.

Signed-off-by: Hongzhi.Song 
---
 meta/lib/oeqa/runtime/cases/ksample_trace.py | 76 
 1 file changed, 76 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ksample_trace.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample_trace.py 
b/meta/lib/oeqa/runtime/cases/ksample_trace.py
new file mode 100644
index 00..102c1b8aaf
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample_trace.py
@@ -0,0 +1,76 @@
+import os
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class KSampleTraceTest(OERuntimeTestCase):
+
+
+@OETestID(33)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_events(self):
+# modprobe
+status, output = self.target.run('modprobe trace-events-sample')
+msg = 'modprobe trace-events failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# lsmod
+status, output = self.target.run('lsmod | grep trace_events_sample | 
cut -d\' \' -f1')
+self.assertEqual(output, "trace_events_sample", 'lsmod 
trace_events_sample failed')
+msg = 'lsmod trace-events failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# check dir
+status, output = self.target.run('ls /sys/kernel/debug/tracing/events/ 
| grep sample-trace')
+self.assertEqual(output, "sample-trace", 'no dir of sample-trace')
+msg = 'if create dir of sample-tree, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# enable trace
+status, output = self.target.run('echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+self.assertEqual(output, "1", 'failed to enable')
+msg = 'cat enable, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# check result
+status, output = self.target.run('cat /sys/kernel/debug/tracing/trace 
| grep hello | head -n1 | cut -d\':\' -f2')
+self.assertEqual(output, " foo_bar", 'failed')
+msg = 'cat trace-events, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# enable trace
+status, output = self.target.run('echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+msg = 'disable, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# clean up trace
+status, output = self.target.run('echo > 
/sys/kernel/debug/tracing/trace')
+msg = 'clearup trace, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# rmmod
+status, output = self.target.run('rmmod trace-events-sample')
+msg = 'rmmod, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+
+@OETestID(34)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_printk(self):
+# modprobe
+status, output = self.target.run('modprobe trace-printk')
+msg = 'modprobe trace-printk failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg) 
+# lsmod
+status, output = self.target.run('lsmod | grep trace_printk | cut -d\' 
\' -f1')
+self.assertEqual(output, "trace_printk", 'lsmod trace_printk failed')
+msg = 'lsmod trace-printk failed, output: %s' % output
+self.assertEqual(status, 0, msg=msg) 
+# check result 
+status, output = self.target.run('cat /sys/kernel/debug/tracing/trace 
| grep trace_printk | head -n1 | cut -d\':\' -f2')
+self.assertEqual(output, " trace_printk_irq_work", 'failed')
+msg = 'cat  trace-printk, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# clean up trace 
+status, output = self.target.run('echo > 
/sys/kernel/debug/tracing/trace')
+msg = 'clean up trace, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
+# rmmod
+status, output = self.target.run('rmmod trace-printk')
+msg = 'rmmod, output: %s' % output
+self.assertEqual(status, 0, msg=msg)
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [meta-oe][PATCH] Turbostat: add a necessary recipe to meta-oe

2018-05-21 Thread Hongzhi.Song
This is an efficient tool to reflect the status of processors.
Turbostat reports processor topology, frequency, idle power-state
statistics, temperature and power on processors.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 meta-oe/recipes-kernel/turbostat/turbostat.bb | 53 +++
 1 file changed, 53 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/turbostat/turbostat.bb

diff --git a/meta-oe/recipes-kernel/turbostat/turbostat.bb 
b/meta-oe/recipes-kernel/turbostat/turbostat.bb
new file mode 100644
index 0..f4614b406
--- /dev/null
+++ b/meta-oe/recipes-kernel/turbostat/turbostat.bb
@@ -0,0 +1,53 @@
+SUMMARY = "Report processor frequency and idle statistics"
+DESCRIPTION = "turbostat  reports processor topology, frequency, idle \
+power-state statistics, temperature and power on modern X86 processors. \
+Either command is forked and statistics are printed upon its completion, \
+or statistics are printed periodically."
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
+
+inherit kernelsrc
+PROVIDES = "virtual/turbostat"
+
+do_populate_lic[depends] += "virtual/kernel:do_patch"
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+B = "${WORKDIR}/${BPN}-${PV}"
+
+EXTRA_OEMAKE = '\
+-C ${S}/tools/power/x86/turbostat \
+O=${B} \
+CROSS_COMPILE=${TARGET_PREFIX} \
+ARCH=${ARCH} \
+CC="${CC}" \
+AR="${AR}" \
+'
+
+EXTRA_OEMAKE += "\
+'prefix=${prefix}' \
+'bindir=${bindir}' \
+'sharedir=${datadir}' \
+'sysconfdir=${sysconfdir}' \
+'sharedir=${@os.path.relpath(datadir, prefix)}' \
+'mandir=${@os.path.relpath(mandir, prefix)}' \
+'infodir=${@os.path.relpath(infodir, prefix)}' \
+"
+
+do_compile() {
+   # Linux kernel build system is expected to do the right thing
+   unset CFLAGS
+   oe_runmake turbostat
+}
+
+do_install() {
+   # Linux kernel build system is expected to do the right thing
+   unset CFLAGS
+   oe_runmake DESTDIR=${D} install
+}
+
+python do_package_prepend() {
+d.setVar('PKGV', d.getVar("KERNEL_VERSION", True).split("-")[0])
+}
+
+TARGET_CC_ARCH += "${LDFLAGS}"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-04-17 Thread Hongzhi.Song
Udev-extraconf works correctly with sysvinit in the aspect of automounting
block devices. But it has a serious problem in case of systemd. Block devices
automounted by udev is unaccessible to host space(out of udevd's private
namespace). For example, we cannot format those block devices.

e.g.
root@qemux86:~# mkfs.ext4 /dev/sda1
mke2fs 1.43.8 (1-Jan-2018)
/dev/sda1 contains a ext4 file system
last mounted on Tue Apr  3 06:22:41 2018
Proceed anyway? (y,N) y
/dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Other distributions has no such problem, because they use a series of rules to
manager block devices. Different types of block devices match different rules.
But udev-extraconf just use one rule, automount.rules, which results in this
problem.

The 'systemd-mount' command is recommended by the systemd community to solve 
such
problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 83 --
 meta/recipes-core/udev/udev-extraconf_1.1.bb   |  3 +
 2 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328..067d4e2 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
 #
 # Attempt to mount any added block devices and umount any removed devices
 
+BASE_INIT="`readlink "@base_sbindir@/init"`"
+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+# systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install systemd-mount 
to finish mount"
+exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
 
-MOUNT="/bin/mount"
 PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
 for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
 do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
fi
 done
 
-automount() {  
+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+[ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {
name="`basename "$DEVNAME"`"
 
! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
@@ -26,7 +72,7 @@ automount() {
then
MOUNT="$MOUNT -o silent"
fi
-   
+
# If filesystem type is vfat, change the ownership group to 'disk', and
# grant it with  w/r/x permissions.
case $ID_FS_TYPE in
@@ -68,23 +114,26 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n 
"$ID_FS_TYPE" -o "$media_t
elif [ -x $MOUNT ]; then
$MOUNT $DEVNAME 2> /dev/null
fi
-   
+
# If the device isn't mounted at this point, it isn't
# configured in fstab (note the root filesystem can show up as
# /dev/root in /proc/mounts, so check the device number too)
-   if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
-   grep -q "^$DEVNAME " /proc/mounts || automount
-   fi
+if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
+if [ "`basename $MOUNT`" = "systemd-mount" ];then
+grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+else
+grep -q "^$DEVNAME " /proc/mounts || automount
+fi
+fi
 fi
 
-
 if [ "$ACTION" = "remove

[OE-core] [PATCH v2] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-04-11 Thread Hongzhi.Song
This patch fixs the problem that block devices unable to be formatted when
systemd and udev-extraconf recipes added to rootfs.

If we add systemd and udev-extraconf recipes to rootfs:
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
KERNEL_FEATURES_append = " cfg/systemd.scc"
IMAGE_INSTALL_append = " udev-extraconf"
IMAGE_FSTYPES += "tar.bz2 ext4"
IMAGE_INSTALL_append = " e2fsprogs-mke2fs"
then systemd-udevd.service will invoke udev rules to automount block devices
any probed under udevd's private namespace, this behavior results in host space
can't format those devices. And host space can't find where the device is used.

Such as:
root@qemux86:~# mkfs.ext4 /dev/sda1
mke2fs 1.43.8 (1-Jan-2018)
/dev/sda1 contains a ext4 file system
last mounted on Tue Apr  3 06:22:41 2018
Proceed anyway? (y,N) y
/dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Command 'systemd-mount' recommended by systemd maintainer instead of command
'mount' will fix the problem brought with private namespace. Systemd-mount
request the mount operation to be executed by PID 1, and hence host space can
access the block devices.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 71 ++
 1 file changed, 60 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328a09..4ba9f1dd99 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
 #
 # Attempt to mount any added block devices and umount any removed devices
 
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+   # systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install systemd-mount 
to finish mount"
+exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
 
-MOUNT="/bin/mount"
 PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
 for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
 do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
fi
 done
 
-automount() {  
+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {
name="`basename "$DEVNAME"`"
 
! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
@@ -26,7 +72,7 @@ automount() {
then
MOUNT="$MOUNT -o silent"
fi
-   
+
# If filesystem type is vfat, change the ownership group to 'disk', and
# grant it with  w/r/x permissions.
case $ID_FS_TYPE in
@@ -46,7 +92,7 @@ automount() {
logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
touch "/tmp/.automount-$name"
fi
-}
+

 rm_dir() {
# We do not want to rm -r populated directories
@@ -68,22 +114,25 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n 
"$ID_FS_TYPE" -o "$media_t
elif [ -x $MOUNT ]; then
$MOUNT $DEVNAME 2> /dev/null
fi
-   
+
# If the device isn't mounted at this point, it isn't
# configured in fstab (note the root filesystem can show u

[OE-core] [PATCH] udev-extraconf: Add systemd-mount to mount.sh

2018-04-09 Thread Hongzhi.Song
This patch fixs the problem that block devices unable to be formatted when
systemd and udev-extraconf recipes added into rootfs.

If we add systemd and udev-extraconf recipes into rootfs:
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
KERNEL_FEATURES_append = " cfg/systemd.scc"
IMAGE_INSTALL_append = " udev-extraconf"
IMAGE_FSTYPES += "tar.bz2 ext4"
IMAGE_INSTALL_append = " e2fsprogs-mke2fs"
then systemd-udevd.service will invoke udev rules to automount block devices
any probed under itself private namespace, this behavior results in host space
can't format those devices. And host space can't find where the device is used.
Such as:
root@qemux86:~# mkfs.ext4 /dev/sda1
mke2fs 1.43.8 (1-Jan-2018)
/dev/sda1 contains a ext4 file system
last mounted on Tue Apr  3 06:22:41 2018
Proceed anyway? (y,N) y
/dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Command systemd-mount recommended by systemd maintainer instead of command mount
will fix the problem brought with private namespace. Systemd-mount request the
mount operation to be executed by PID 1, and hence host space can access the 
block
devices.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 meta/recipes-core/udev/mount.sh | 141 
 1 file changed, 141 insertions(+)
 create mode 100644 meta/recipes-core/udev/mount.sh

diff --git a/meta/recipes-core/udev/mount.sh b/meta/recipes-core/udev/mount.sh
new file mode 100644
index 000..2fa2925
--- /dev/null
+++ b/meta/recipes-core/udev/mount.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+#
+# Called from udev
+#
+# Attempt to mount any added block devices and umount any removed devices
+
+
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+   # systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"
+   exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
+
+PMOUNT="/usr/bin/pmount"
+
+for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
+do
+   if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
+   then
+   logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring"
+   exit 0
+   fi
+done
+
+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {  
+   name="`basename "$DEVNAME"`"
+
+   ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+   # Silent util-linux's version of mounting auto
+   if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
+   then
+   MOUNT="$MOUNT -o silent"
+   fi
+   
+   # If filesystem type is vfat, change the ownership group to 'disk', and
+   # grant it with  w/r/x permissions.
+   case $ID_FS_TYPE in
+   vfat|fat)
+   MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+   ;;
+   # TODO
+   *)
+   ;;
+   esac
+
+   if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
+   then
+   #logger "mount.sh/automount" "$MOUNT -t aut

[OE-core] [PATCH] systemd-udev: Add systemd-mount to mount.sh

2018-03-06 Thread Hongzhi.Song
Issue: mkfs.ext4  fails, prompting that the device
is in use by the system. But there is no mounted infomation in /proc/mounts.

Reproduce: Be sure that there is storage device connected to you machine.

Boot the machine.
root@intel-x86-64:~# mkfs.ext4 /dev/mmcblk0p1
mke2fs 1.43.5 (04-Aug-2017)
/dev/mmcblk0p1 contains a ext2 file system
last mounted on / on Tue Jan 9 05:24:36 2018
Proceed anyway? (y,N) y
/dev/mmcblk0p1 is apparently in use by the system; will not make a 
filesystem here!

root@intel-x86-64:~# fdisk -l
...
Disk /dev/mmcblk0: 58.2 GiB, 62537072640 bytes, 122142720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe62c8fcc

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 122142719 122140672 58.2G 83 Linux
...

root@intel-x86-64:~#cat /proc/mounts
...
cgroup /sys/fs/cgroup/blkio cgroup 
rw,nosuid,nodev,noexec,relatime,blkio 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
tmpfs /var/volatile tmpfs rw,relatime 0 0
tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=688048k,mode=700 
0 0

Description:
If linux uses systemd as init, systemd-udevd.service sets 
MountFlags=slave,
which is essentially a sandboxing setting: it detaches mount() 
operations
done within the service from the rest of the system. This means that,
outside of namespace of systemd-udev, we can not access device mounted 
by
udev and some operation will be failed.(e.g. mkfs.ext4 /dev/sda1).

Current automount.rules and mount.sh created for sysvinit is unable to 
solve
above problems.

This patch adds systemd-mount in /etc/udev/script/mount.sh. The tool
recommended by systemd upstream generally is the best way in particular 
in
embedded applications to deal with hotpluggable media. Systemd-mount 
request
the mount operation to be executed by PID 1, and hence outside of the 
mount
context of udev.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 61 +++---
 1 file changed, 56 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328..2fa2925 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -5,9 +5,28 @@
 # Attempt to mount any added block devices and umount any removed devices
 
 
-MOUNT="/bin/mount"
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+   # systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"
+   exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
+
 PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
 for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
 do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,6 +36,34 @@ do
fi
 done
 
+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successfu

[OE-core] [PATCH] systemd-udev: Add systemd-mount to mount.sh

2018-03-05 Thread Hongzhi.Song
If linux uses systemd as init, systemd-udevd.service sets MountFlags=slave,
which is essentially a sandboxing setting: it detaches mount() operations
done within the service from the rest of the system. This means that,
outside of namespace of systemd-udev, we can not access device mounted by
udev and some operation may not be possible (e.g. mkfs.ext4 /dev/sda1).

This patch adds systemd-mount in /etc/udev/script/mount.sh. The tool
recommended by systemd upstream generally is the best way in particular in
embedded applications to deal with hotpluggable media. Systemd-mount request
the mount operation to be executed by PID 1, and hence outside of the mount
context of udev.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 61 +++---
 1 file changed, 56 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328..2fa2925 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -5,9 +5,28 @@
 # Attempt to mount any added block devices and umount any removed devices
 
 
-MOUNT="/bin/mount"
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+   # systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"
+   exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
+
 PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
 for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
 do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,6 +36,34 @@ do
fi
 done
 
+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
 automount() {  
name="`basename "$DEVNAME"`"
 
@@ -72,9 +119,13 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n 
"$ID_FS_TYPE" -o "$media_t
# If the device isn't mounted at this point, it isn't
# configured in fstab (note the root filesystem can show up as
# /dev/root in /proc/mounts, so check the device number too)
-   if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
-   grep -q "^$DEVNAME " /proc/mounts || automount
-   fi
+if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
+if [ "`basename $MOUNT`" = "systemd-mount" ];then
+grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+else
+grep -q "^$DEVNAME " /proc/mounts || automount
+fi
+fi
 fi
 
 
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3] systemd: re-enable mount propagation for udevd

2018-02-22 Thread Hongzhi.Song
MountFlags's default value is shared in systemd-udevd.service. But upstream
sets MountFlags with slave just for keeping mounts done by udev private to
udevd, which causes block device mounted by udev unvisable but being busy for
host. So we revert it to shared to be propagated to host.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 ...evd-re-enable-mount-propagation-for-udevd.patch | 33 ++
 meta/recipes-core/systemd/systemd_234.bb   |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 
meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch

diff --git 
a/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
new file mode 100644
index 00..fce7bdd796
--- /dev/null
+++ 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
@@ -0,0 +1,33 @@
+From 11a3312d36109f5e5a7697ddb05c533c51e2cd75 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.s...@windriver.com>
+Date: Mon, 19 Feb 2018 20:43:02 -0500
+Subject: [PATCH] systemd-udevd: re-enable mount propagation for udevd
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Change the mount propagation flag from MountFlags=slave to MountFlags=shared
+(default). Use shared to ensure that mounts and unmounts are propagated from 
+systemd's namespace to the service's namespace and vice versa, while use slave 
+to run processes so that none of their mounts and unmounts will propagate to 
+the host.
+
+Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
+---
+ units/systemd-udevd.service.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
+index fc037b5..841d7a8 100644
+--- a/units/systemd-udevd.service.in
 b/units/systemd-udevd.service.in
+@@ -24,7 +24,6 @@ ExecStart=@rootlibexecdir@/systemd-udevd
+ KillMode=mixed
+ WatchdogSec=3min
+ TasksMax=infinity
+-MountFlags=slave
+ MemoryDenyWriteExecute=yes
+ RestrictRealtime=yes
+ RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
+-- 
+2.8.1
+
diff --git a/meta/recipes-core/systemd/systemd_234.bb 
b/meta/recipes-core/systemd/systemd_234.bb
index babc351cc8..42f4f1ec76 100644
--- a/meta/recipes-core/systemd/systemd_234.bb
+++ b/meta/recipes-core/systemd/systemd_234.bb
@@ -32,6 +32,7 @@ SRC_URI += " \

file://0001-main-skip-many-initialization-steps-when-running-in-.patch \
file://CVE-2017-18078.patch \

file://0001-resolved-fix-loop-on-packets-with-pseudo-dns-types.patch \
+  file://systemd-udevd-re-enable-mount-propagation-for-udevd.patch \
"
 SRC_URI_append_qemuall = " 
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
-- 
2.13.3

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v2] systemd: re-enable mount propagation for udevd

2018-02-22 Thread Hongzhi.Song
With MountFlags=slave, those mounts then become private to the systemd-udevd
namespace and are no longer accessible from outside the namespace, which is
not expected.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 ...evd-re-enable-mount-propagation-for-udevd.patch | 33 ++
 meta/recipes-core/systemd/systemd_234.bb   |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 
meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch

diff --git 
a/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
new file mode 100644
index 000..fce7bdd
--- /dev/null
+++ 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
@@ -0,0 +1,33 @@
+From 11a3312d36109f5e5a7697ddb05c533c51e2cd75 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.s...@windriver.com>
+Date: Mon, 19 Feb 2018 20:43:02 -0500
+Subject: [PATCH] systemd-udevd: re-enable mount propagation for udevd
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Change the mount propagation flag from MountFlags=slave to MountFlags=shared
+(default). Use shared to ensure that mounts and unmounts are propagated from 
+systemd's namespace to the service's namespace and vice versa, while use slave 
+to run processes so that none of their mounts and unmounts will propagate to 
+the host.
+
+Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
+---
+ units/systemd-udevd.service.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
+index fc037b5..841d7a8 100644
+--- a/units/systemd-udevd.service.in
 b/units/systemd-udevd.service.in
+@@ -24,7 +24,6 @@ ExecStart=@rootlibexecdir@/systemd-udevd
+ KillMode=mixed
+ WatchdogSec=3min
+ TasksMax=infinity
+-MountFlags=slave
+ MemoryDenyWriteExecute=yes
+ RestrictRealtime=yes
+ RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
+-- 
+2.8.1
+
diff --git a/meta/recipes-core/systemd/systemd_234.bb 
b/meta/recipes-core/systemd/systemd_234.bb
index d12e94f..6aceafb 100644
--- a/meta/recipes-core/systemd/systemd_234.bb
+++ b/meta/recipes-core/systemd/systemd_234.bb
@@ -51,6 +51,7 @@ SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \
file://0001-meson-update-header-file-to-detect-memfd_create.patch \

file://0002-configure.ac-Check-if-memfd_create-is-already-define.patch \
file://0003-fileio-include-sys-mman.h.patch \
+  file://systemd-udevd-re-enable-mount-propagation-for-udevd.patch \
"
 SRC_URI_append_qemuall = " 
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
-- 
2.8.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] systemd: re-enable mount propagation for udevd

2018-02-21 Thread Hongzhi.Song
With MountFlags=slave, those mounts then become private to the systemd-udevd
namespace and are no longer accessible from outside the namespace, which is
not expected.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 ...evd-re-enable-mount-propagation-for-udevd.patch | 33 ++
 meta/recipes-core/systemd/systemd_234.bb   |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 
meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch

diff --git 
a/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
new file mode 100644
index 00..fce7bdd796
--- /dev/null
+++ 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
@@ -0,0 +1,33 @@
+From 11a3312d36109f5e5a7697ddb05c533c51e2cd75 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.s...@windriver.com>
+Date: Mon, 19 Feb 2018 20:43:02 -0500
+Subject: [PATCH] systemd-udevd: re-enable mount propagation for udevd
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Change the mount propagation flag from MountFlags=slave to MountFlags=shared
+(default). Use shared to ensure that mounts and unmounts are propagated from 
+systemd's namespace to the service's namespace and vice versa, while use slave 
+to run processes so that none of their mounts and unmounts will propagate to 
+the host.
+
+Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
+---
+ units/systemd-udevd.service.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
+index fc037b5..841d7a8 100644
+--- a/units/systemd-udevd.service.in
 b/units/systemd-udevd.service.in
+@@ -24,7 +24,6 @@ ExecStart=@rootlibexecdir@/systemd-udevd
+ KillMode=mixed
+ WatchdogSec=3min
+ TasksMax=infinity
+-MountFlags=slave
+ MemoryDenyWriteExecute=yes
+ RestrictRealtime=yes
+ RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
+-- 
+2.8.1
+
diff --git a/meta/recipes-core/systemd/systemd_234.bb 
b/meta/recipes-core/systemd/systemd_234.bb
index babc351cc8..42f4f1ec76 100644
--- a/meta/recipes-core/systemd/systemd_234.bb
+++ b/meta/recipes-core/systemd/systemd_234.bb
@@ -32,6 +32,7 @@ SRC_URI += " \

file://0001-main-skip-many-initialization-steps-when-running-in-.patch \
file://CVE-2017-18078.patch \

file://0001-resolved-fix-loop-on-packets-with-pseudo-dns-types.patch \
+  file://systemd-udevd-re-enable-mount-propagation-for-udevd.patch \
"
 SRC_URI_append_qemuall = " 
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
-- 
2.13.3

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] systemd: re-enable mount propagation for udevd

2018-02-21 Thread Hongzhi.Song
With MountFlags=slave, those mounts then become private to the systemd-udevd
namespace and are no longer accessible from outside the namespace, which is
not expected.

Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
---
 ...evd-re-enable-mount-propagation-for-udevd.patch | 33 ++
 1 file changed, 33 insertions(+)
 create mode 100644 
meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch

diff --git 
a/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
new file mode 100644
index 00..5349ecedf7
--- /dev/null
+++ 
b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
@@ -0,0 +1,33 @@
+From 11a3312d36109f5e5a7697ddb05c533c51e2cd75 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.s...@windriver.com>
+Date: Mon, 19 Feb 2018 20:43:02 -0500
+Subject: [PATCH] systemd-udevd: re-enable mount propagation for udevd
+
+Upstream-Status: Pending
+
+Change the mount propagation flag from MountFlags=slave to MountFlags=shared
+(default). Use shared to ensure that mounts and unmounts are propagated from 
+systemd's namespace to the service's namespace and vice versa, while use slave 
+to run processes so that none of their mounts and unmounts will propagate to 
+the host.
+
+Signed-off-by: Hongzhi.Song <hongzhi.s...@windriver.com>
+---
+ units/systemd-udevd.service.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
+index fc037b5..841d7a8 100644
+--- a/units/systemd-udevd.service.in
 b/units/systemd-udevd.service.in
+@@ -24,7 +24,6 @@ ExecStart=@rootlibexecdir@/systemd-udevd
+ KillMode=mixed
+ WatchdogSec=3min
+ TasksMax=infinity
+-MountFlags=slave
+ MemoryDenyWriteExecute=yes
+ RestrictRealtime=yes
+ RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
+-- 
+2.8.1
+
-- 
2.13.3

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core