Skip to contentSkip to conversation

package/ltp-testsuite: Backport 3 more musl related patches

PATCH New Petr Vorel 2 participants 4 messages Nov 20, 2019

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/2 package/ltp-testsuite: Backport 3 more musl related patches

0009-nfsv4-acl-Remove-unneeded-malloc-sizeof-FILE.patch is fixing following reports (other 2 has not been reported due previous)

Fixes:
http://autobuild.buildroot.net/results/a38a5d8deaa365f73db427911df68dd10c6930a6
http://autobuild.buildroot.net/results/dfa173caea08876ab69dd959da146b75750cdd28
http://autobuild.buildroot.net/results/1e602f1574e9134a44d5d66838e7851b38e8069a
http://autobuild.buildroot.net/results/f1b4b129ec94795b2144b4501b4301fb20892e71

---
 ...compat_16-Always-include-sys-fsuid.h.patch |  52 +++
 ...l-Remove-unneeded-malloc-sizeof-FILE.patch |  37 ++
 .../0010-Replace-bzero-with-memset.patch      | 351 ++++++++++++++++++
 3 files changed, 440 insertions(+)
 create mode 100644 package/ltp-testsuite/0008-utils-compat_16-Always-include-sys-fsuid.h.patch
 create mode 100644 package/ltp-testsuite/0009-nfsv4-acl-Remove-unneeded-malloc-sizeof-FILE.patch
 create mode 100644 package/ltp-testsuite/0010-Replace-bzero-with-memset.patch
package/ltp-testsuite/0008-utils-compat_16-Always-include-sys-fsuid.h.patch new file +52 -0
new file mode 100644
index 0000000000..04d47709e9
@@ -0,0 +1,52 @@
+From 7b614a0c352fdaae883b0409a94c68bf06bfe914 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <[email protected]>
+Date: Sun, 17 Nov 2019 11:40:26 +0100
+Subject: [PATCH] utils/compat_16: Always include <sys/fsuid.h>
+
+All major implementations have setfsuid() declaration in <sys/fsuid.h>.
+This fixes build on musl and (probably) on uclibc).
+
+NOTE: maybe we should guard presence of <sys/fsuid.h> with autotools,
+but we're not doing that for other it's uses.
+
+Fixes: 0e7a99b53 ("setfsgid, setfsuid: clean up and 16-bit version
+fixes")
+
+Signed-off-by: Petr Vorel <[email protected]>
+[Upstream status: 7b614a0c352fdaae883b0409a94c68bf06bfe914]
+---
+ testcases/kernel/syscalls/utils/compat_16.h     | 2 --
+ testcases/kernel/syscalls/utils/compat_tst_16.h | 2 --
+ 2 files changed, 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/utils/compat_16.h b/testcases/kernel/syscalls/utils/compat_16.h
+index 5b0338d38..75d5d2d28 100644
+--- a/testcases/kernel/syscalls/utils/compat_16.h
++++ b/testcases/kernel/syscalls/utils/compat_16.h
+@@ -24,9 +24,7 @@
+ 
+ #include <errno.h>
+ #include <grp.h>
+-#if defined(__GLIBC__) || defined(__ANDROID__)
+ #include <sys/fsuid.h>
+-#endif
+ #include <sys/types.h>
+ #include <unistd.h>
+ 
+diff --git a/testcases/kernel/syscalls/utils/compat_tst_16.h b/testcases/kernel/syscalls/utils/compat_tst_16.h
+index 3b86ef3e3..09fa8b0d8 100644
+--- a/testcases/kernel/syscalls/utils/compat_tst_16.h
++++ b/testcases/kernel/syscalls/utils/compat_tst_16.h
+@@ -21,9 +21,7 @@
+ 
+ #include <errno.h>
+ #include <grp.h>
+-#if defined(__GLIBC__) || defined(__ANDROID__)
+ #include <sys/fsuid.h>
+-#endif
+ #include <sys/types.h>
+ #include <unistd.h>
+ 
+-- 
+2.23.0
+
package/ltp-testsuite/0009-nfsv4-acl-Remove-unneeded-malloc-sizeof-FILE.patch new file +37 -0
new file mode 100644
index 0000000000..045fb814c8
@@ -0,0 +1,37 @@
+From 7eae073fda17a94a36893337b5a5d639024d571c Mon Sep 17 00:00:00 2001
+From: Petr Vorel <[email protected]>
+Date: Sun, 17 Nov 2019 12:53:22 +0100
+Subject: [PATCH] nfsv4/acl: Remove unneeded malloc(sizeof(FILE))
+
+FILE incomplete type under musl (comply C11 [1]).
+malloc(sizeof(FILE)) is not needed anyway, thus remove.
+
+This fixes build on musl (at least):
+acl1.c:51:23: error: invalid application of 'sizeof' to incomplete type 'FILE' {aka 'struct _IO_FILE'}
+  fptr = malloc(sizeof(FILE));
+
+Fixes: 618fd23eb ("Initial add of acl testsuite from Bull")
+
+[1] https://www.openwall.com/lists/musl/2019/01/16/1
+
+Signed-off-by: Petr Vorel <[email protected]>
+[Upstream status: 7eae073fda17a94a36893337b5a5d639024d571c]
+---
+ testcases/network/nfsv4/acl/acl1.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/testcases/network/nfsv4/acl/acl1.c b/testcases/network/nfsv4/acl/acl1.c
+index bdf0180da..aae9484e5 100644
+--- a/testcases/network/nfsv4/acl/acl1.c
++++ b/testcases/network/nfsv4/acl/acl1.c
+@@ -48,7 +48,6 @@ int do_file_op(char *filename)
+ 	result = 0;
+ 	FILE *fptr;
+ 	char str[256] = "./";
+-	fptr = malloc(sizeof(FILE));
+ 
+ 	uid = geteuid();
+ 	strcat(str, filename);
+-- 
+2.23.0
+
package/ltp-testsuite/0010-Replace-bzero-with-memset.patch new file +351 -0

351 lines not on this page · raw message

Signature · 1 line
2.24.0
author
#1 lore raw

PATCH 1/2 package/ltp-testsuite: Backport 3 more musl related patches

Hi,

Quoted 8 lines

0009-nfsv4-acl-Remove-unneeded-malloc-sizeof-FILE.patch is fixing following reports (other 2 has not been reported due previous)

Fixes:
http://autobuild.buildroot.net/results/a38a5d8deaa365f73db427911df68dd10c6930a6
http://autobuild.buildroot.net/results/dfa173caea08876ab69dd959da146b75750cdd28
http://autobuild.buildroot.net/results/1e602f1574e9134a44d5d66838e7851b38e8069a
http://autobuild.buildroot.net/results/f1b4b129ec94795b2144b4501b4301fb20892e71

Tested with following patch:

build pc_x86_64_bios_defconfig changed to musl

$ ./utils/test-pkg -p ltp-testsuite -a
                             andes-nds32 [ 1/44]: OK
                             arm-aarch64 [ 2/44]: OK
                        br-aarch64-glibc [ 3/44]: OK
                           br-arcle-hs38 [ 4/44]: OK
                            br-arm-basic [ 5/44]: OK
                  br-arm-cortex-a9-glibc [ 6/44]: OK
                   br-arm-cortex-a9-musl [ 7/44]: OK
                   br-arm-cortex-m4-full [ 8/44]: SKIPPED
                             br-arm-full [ 9/44]: OK
                    br-arm-full-nothread [10/44]: SKIPPED
                      br-arm-full-static [11/44]: OK
                br-i386-pentium-mmx-musl [12/44]: OK
                   br-i386-pentium4-full [13/44]: OK
                    br-microblazeel-full [14/44]: OK
                      br-mipsel-o32-full [15/44]: OK
                 br-mips32r6-el-hf-glibc [16/44]: OK
                      br-mips64-n64-full [17/44]: OK
                 br-mips64r6-el-hf-glibc [18/44]: OK
                       br-m68k-5208-full [19/44]: SKIPPED
                      br-m68k-68040-full [20/44]: SKIPPED
                          br-nios2-glibc [21/44]: SKIPPED
                      br-openrisc-uclibc [22/44]: OK
                  br-powerpc-e500mc-full [23/44]: OK
               br-powerpc-603e-basic-cpp [24/44]: OK
             br-powerpc64le-power8-glibc [25/44]: OK
               br-powerpc64-power7-glibc [26/44]: OK
                              br-riscv32 [27/44]: OK
                              br-riscv64 [28/44]: OK
                             br-sh4-full [29/44]: OK
                         br-sparc-uclibc [30/44]: SKIPPED
                        br-sparc64-glibc [31/44]: OK
                          br-xtensa-full [32/44]: OK
                    br-x86-64-core2-full [33/44]: OK
                          br-x86-64-musl [34/44]: OK
                       linaro-aarch64-be [35/44]: OK
                          linaro-aarch64 [36/44]: OK
                              linaro-arm [37/44]: OK
                     sourcery-arm-armv4t [38/44]: OK
                            sourcery-arm [39/44]: OK
                     sourcery-arm-thumb2 [40/44]: OK
                           sourcery-mips [41/44]: OK
                         sourcery-mips64 [42/44]: OK
                          sourcery-nios2 [43/44]: SKIPPED
                         sourcery-x86-64 [44/44]: OK
44 builds, 7 skipped, 0 build failed, 0 legal-info failed

Kind regards,
Petr

author
#2 lore raw

PATCH 2/2 package/ltp-testsuite: Rename older patches

In reply to Petr Vorel

* add upstream commit hash
* renumber patches

---
 ...7-fanotify-Fix-FSID_VAL_MEMBER-usage.patch | 55 +++++++++++++++++++
 .../0007-fanotify-Fix-for-musl.patch          | 31 -----------
 ...11-Fix-static-linking-with-musl-fts.patch} |  2 +-
 3 files changed, 56 insertions(+), 32 deletions(-)
 create mode 100644 package/ltp-testsuite/0007-fanotify-Fix-FSID_VAL_MEMBER-usage.patch
 delete mode 100644 package/ltp-testsuite/0007-fanotify-Fix-for-musl.patch
 rename package/ltp-testsuite/{0005-Fix-static-linking-with-musl-fts.patch => 0011-Fix-static-linking-with-musl-fts.patch} (96%)
package/ltp-testsuite/0007-fanotify-Fix-FSID_VAL_MEMBER-usage.patch new file +55 -0
new file mode 100644
index 0000000000..2e80c5820f
@@ -0,0 +1,55 @@
+From f37704d6cf69c9616dfd2aee5647b7941aa2bbaa Mon Sep 17 00:00:00 2001
+From: Petr Vorel <[email protected]>
+Date: Sat, 16 Nov 2019 00:14:42 +0100
+Subject: [PATCH] fanotify: Fix FSID_VAL_MEMBER() usage
+
+This basically reverts part of 0498fc0a8.
+
+FSID_VAL_MEMBER() wrapper was meant to be only for struct
+fanotify_event_info_fid, it was used also for struct event_t
+(which has also __kernel_fsid_t fsid, but shouldn't be redefined).
+
+This caused error on recent musl v1.1.23 (with f67b3c17),
+which has struct fanotify_event_info_fid.
+
+Fixes: 0498fc0a8 ("fanotify: Detect val vs. __val
+fanotify_event_info_fid.fsid member")
+
+Acked-by: Jan Stancek <[email protected]>
+Signed-off-by: Petr Vorel <[email protected]>
+[Upstream status: f37704d6cf69c9616dfd2aee5647b7941aa2bbaa]
+---
+ testcases/kernel/syscalls/fanotify/fanotify.h   | 1 +
+ testcases/kernel/syscalls/fanotify/fanotify13.c | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
+index 5370e30bb..9c98aaa1d 100644
+--- a/testcases/kernel/syscalls/fanotify/fanotify.h
++++ b/testcases/kernel/syscalls/fanotify/fanotify.h
+@@ -143,6 +143,7 @@ struct fanotify_event_info_fid {
+ };
+ #endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */
+ 
++/* NOTE: only for struct fanotify_event_info_fid */
+ #ifdef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL
+ # define FSID_VAL_MEMBER(fsid, i) (fsid.__val[i])
+ #else
+diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c
+index 26212ab62..3d8de6009 100644
+--- a/testcases/kernel/syscalls/fanotify/fanotify13.c
++++ b/testcases/kernel/syscalls/fanotify/fanotify13.c
+@@ -130,8 +130,8 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc)
+ 					"kernel");
+ 				return 1;
+ 			} else if (errno == ENODEV &&
+-					!FSID_VAL_MEMBER(event_set[i].fsid, 0) &&
+-					!FSID_VAL_MEMBER(event_set[i].fsid, 1)) {
++					!event_set[i].fsid.val[0] &&
++					!event_set[i].fsid.val[1]) {
+ 				tst_res(TCONF,
+ 					"FAN_REPORT_FID not supported on "
+ 					"filesystem type %s",
+-- 
+2.23.0
+
package/ltp-testsuite/0007-fanotify-Fix-for-musl.patch deleted +0 -31
deleted file mode 100644
index d1d0fc08ad..0000000000
@@ -1,31 +0,0 @@
-From 087e13ecb9eea6cbd920708e64eab18e7ab8a90c Mon Sep 17 00:00:00 2001
-From: Petr Vorel <[email protected]>
-Date: Sat, 16 Nov 2019 00:14:42 +0100
-Subject: [PATCH] fanotify: Fix for musl
-
-Fixes: 0498fc0a8 ("fanotify: Detect val vs. __val fanotify_event_info_fid.fsid member")
-
-[upstream status: https://patchwork.ozlabs.org/patch/1195915/]
-Signed-off-by: Petr Vorel <[email protected]>
----
- testcases/kernel/syscalls/fanotify/fanotify13.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c
-index 26212ab62..3d8de6009 100644
---- a/testcases/kernel/syscalls/fanotify/fanotify13.c
-+++ b/testcases/kernel/syscalls/fanotify/fanotify13.c
-@@ -130,8 +130,8 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc)
- 					"kernel");
- 				return 1;
- 			} else if (errno == ENODEV &&
--					!FSID_VAL_MEMBER(event_set[i].fsid, 0) &&
--					!FSID_VAL_MEMBER(event_set[i].fsid, 1)) {
-+					!event_set[i].fsid.val[0] &&
-+					!event_set[i].fsid.val[1]) {
- 				tst_res(TCONF,
- 					"FAN_REPORT_FID not supported on "
- 					"filesystem type %s",
--- 
-2.24.0
-
package/ltp-testsuite/0011-Fix-static-linking-with-musl-fts.patch renamed from package/ltp-testsuite/0005-Fix-static-linking-with-musl-fts.patch +1 -1
similarity index 96%
rename from package/ltp-testsuite/0005-Fix-static-linking-with-musl-fts.patch
rename to package/ltp-testsuite/0011-Fix-static-linking-with-musl-fts.patch
index 9fa888d47e..161a65ecb0 100644
@@ -13,7 +13,7 @@ Fixes:
  - http://autobuild.buildroot.org/results/9155326e1ff7c2bb2218122c453872c2fc76f65e
 
 Signed-off-by: Fabrice Fontaine <[email protected]>
-[Upstream status: https://github.com/linux-test-project/ltp/pull/616]
+[Upstream status: 22f510de8072c5cacce5b2a4ca2ff97d1a6fa3ca]
 ---
  testcases/kernel/controllers/cpuset/Makefile.inc        | 2 +-
  testcases/kernel/controllers/cpuset/cpuset_lib/Makefile | 2 +-
Signature · 1 line
2.24.0
#3 lore raw

PATCH 1/2 package/ltp-testsuite: Backport 3 more musl related patches

In reply to Petr Vorel
Quoted 10 lines · On Wed, 20 Nov 2019 18:14:00 +0100 Petr Vorel <[email protected]> wrote:

0009-nfsv4-acl-Remove-unneeded-malloc-sizeof-FILE.patch is fixing following reports (other 2 has not been reported due previous)

Fixes:
http://autobuild.buildroot.net/results/a38a5d8deaa365f73db427911df68dd10c6930a6
http://autobuild.buildroot.net/results/dfa173caea08876ab69dd959da146b75750cdd28
http://autobuild.buildroot.net/results/1e602f1574e9134a44d5d66838e7851b38e8069a
http://autobuild.buildroot.net/results/f1b4b129ec94795b2144b4501b4301fb20892e71

Quoted 8 lines
---
 ...compat_16-Always-include-sys-fsuid.h.patch |  52 +++
 ...l-Remove-unneeded-malloc-sizeof-FILE.patch |  37 ++
 .../0010-Replace-bzero-with-memset.patch      | 351 ++++++++++++++++++
 3 files changed, 440 insertions(+)
 create mode 100644 package/ltp-testsuite/0008-utils-compat_16-Always-include-sys-fsuid.h.patch
 create mode 100644 package/ltp-testsuite/0009-nfsv4-acl-Remove-unneeded-malloc-sizeof-FILE.patch
 create mode 100644 package/ltp-testsuite/0010-Replace-bzero-with-memset.patch

Both applied to master. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com