[Buildroot] [git commit] package/ltp-testsuite: update patch

Arnout Vandecappelle (Essensium/Mind) arnout at mind.be
Sun Oct 13 20:45:09 UTC 2019


commit: https://git.buildroot.net/buildroot/commit/?id=fb4588d05661a6c5cbae711f6044da92741bff7a
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

0002-pkeys-Fix-uclibc-build-caused-by-conflicting-signatu.patch
(patch was accepted in a slightly different form)

Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
---
 ...clibc-build-caused-by-conflicting-signatu.patch | 98 ++++++++++++++++++----
 1 file changed, 83 insertions(+), 15 deletions(-)

diff --git a/package/ltp-testsuite/0002-pkeys-Fix-uclibc-build-caused-by-conflicting-signatu.patch b/package/ltp-testsuite/0002-pkeys-Fix-uclibc-build-caused-by-conflicting-signatu.patch
index 730be1e871..39c7c5ac5d 100644
--- a/package/ltp-testsuite/0002-pkeys-Fix-uclibc-build-caused-by-conflicting-signatu.patch
+++ b/package/ltp-testsuite/0002-pkeys-Fix-uclibc-build-caused-by-conflicting-signatu.patch
@@ -1,17 +1,15 @@
-From 69341008e0a34b81a498ce02ab1cba4679096bb1 Mon Sep 17 00:00:00 2001
-From: Petr Vorel <petr.vorel at gmail.com>
+From 5c3f08d31a4619454ef4db3501dbf2679867ba7f Mon Sep 17 00:00:00 2001
+From: Petr Vorel <pvorel at suse.cz>
 Date: Tue, 1 Oct 2019 14:46:22 +0200
 Subject: [PATCH] pkeys: Fix uclibc build caused by conflicting signature
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 
-Removing static fixes the problem.
-
 uClibc defines pkey_{alloc,free,mprotect} signatures in
-<bits/mman-shared.h>, which is included by <bits/mman-linux.h>.  Because
+<bits/mman-shared.h>, which is included by <bits/mman-linux.h>. Because
 it does not implement them, our implementation signature conflicts, as
-it uses static.
+it uses static. Add 'ltp_' prefix to our helper functions (suggested by Jan).
 
 Fixed build error:
 In file included from pkey01.c:32:0:
@@ -31,37 +29,107 @@ Found with test-pkg tool from Buildroot distribution.
 
 Fixes: 90c2dc89f ("pkey: add test for memory protection keys")
 
-Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
-[Upstream status: https://patchwork.ozlabs.org/patch/1170133/]
+Reported-by: Petr Vorel <petr.vorel at gmail.com>
+Suggested-by: Jan Stancek <jstancek at redhat.com>
+Signed-off-by: Petr Vorel <pvorel at suse.cz>
+[Upstream status: 5c3f08d31a4619454ef4db3501dbf2679867ba7f]
 ---
- testcases/kernel/syscalls/pkeys/pkey.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
+ testcases/kernel/syscalls/pkeys/pkey.h   | 15 ++++++++++-----
+ testcases/kernel/syscalls/pkeys/pkey01.c |  8 ++++----
+ 2 files changed, 14 insertions(+), 9 deletions(-)
 
 diff --git a/testcases/kernel/syscalls/pkeys/pkey.h b/testcases/kernel/syscalls/pkeys/pkey.h
-index d623244eb..19c8447eb 100644
+index d623244eb..3c1204978 100644
 --- a/testcases/kernel/syscalls/pkeys/pkey.h
 +++ b/testcases/kernel/syscalls/pkeys/pkey.h
-@@ -15,17 +15,17 @@
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: GPL-2.0-or-later
+ /*
+  * Copyright (c) 2019 Red Hat, Inc.
++ * Copyright (c) Linux Test Project, 2019
+  */
+ 
+ #ifndef PKEYS_H
+@@ -15,25 +16,29 @@
  #endif
  
  #ifndef HAVE_PKEY_MPROTECT
 -static inline int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
-+inline int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
++inline int ltp_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
  {
  	return tst_syscall(__NR_pkey_mprotect, addr, len, prot, pkey);
  }
  
 -static inline int pkey_alloc(unsigned int flags, unsigned int access_rights)
-+inline int pkey_alloc(unsigned int flags, unsigned int access_rights)
++inline int ltp_pkey_alloc(unsigned int flags, unsigned int access_rights)
  {
  	return tst_syscall(__NR_pkey_alloc, flags, access_rights);
  }
  
 -static inline int pkey_free(int pkey)
-+inline int pkey_free(int pkey)
++inline int ltp_pkey_free(int pkey)
  {
  	return tst_syscall(__NR_pkey_free, pkey);
  }
++#else
++#define ltp_pkey_alloc pkey_alloc
++#define ltp_pkey_free pkey_free
++#define ltp_pkey_mprotect pkey_mprotect
+ #endif /* HAVE_PKEY_MPROTECT */
+ 
+ static inline void check_pkey_support(void)
+ {
+-	int pkey = pkey_alloc(0, 0);
++	int pkey = ltp_pkey_alloc(0, 0);
+ 
+ 	if (pkey == -1) {
+ 		if (errno == ENOSYS)
+@@ -44,7 +49,7 @@ static inline void check_pkey_support(void)
+ 			tst_brk(TCONF, "pkeys are not available for test");
+ 	}
+ 
+-	pkey_free(pkey);
++	ltp_pkey_free(pkey);
+ }
+ 
+ #endif /* PKEYS_H */
+diff --git a/testcases/kernel/syscalls/pkeys/pkey01.c b/testcases/kernel/syscalls/pkeys/pkey01.c
+index b6b7e5cba..fa84e71f3 100644
+--- a/testcases/kernel/syscalls/pkeys/pkey01.c
++++ b/testcases/kernel/syscalls/pkeys/pkey01.c
+@@ -157,12 +157,12 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
+ 
+ 	buffer = SAFE_MMAP(NULL, size, mpa->prot, mpa->flags, fd, 0);
+ 
+-	pkey = pkey_alloc(tc->flags, tc->access_rights);
++	pkey = ltp_pkey_alloc(tc->flags, tc->access_rights);
+ 	if (pkey == -1)
+ 		tst_brk(TBROK | TERRNO, "pkey_alloc failed");
+ 
+ 	tst_res(TINFO, "Set %s on (%s) buffer", tc->name, flag_to_str(mpa->flags));
+-	if (pkey_mprotect(buffer, size, mpa->prot, pkey) == -1)
++	if (ltp_pkey_mprotect(buffer, size, mpa->prot, pkey) == -1)
+ 		tst_brk(TBROK | TERRNO, "pkey_mprotect failed");
+ 
+ 	pid = SAFE_FORK();
+@@ -189,7 +189,7 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
+                 tst_res(TFAIL, "Child: %s", tst_strstatus(status));
+ 
+ 	tst_res(TINFO, "Remove %s from the buffer", tc->name);
+-	if (pkey_mprotect(buffer, size, mpa->prot, 0x0) == -1)
++	if (ltp_pkey_mprotect(buffer, size, mpa->prot, 0x0) == -1)
+ 		tst_brk(TBROK | TERRNO, "pkey_mprotect failed");
+ 
+ 	switch (mpa->prot) {
+@@ -211,7 +211,7 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
+ 
+ 	SAFE_MUNMAP(buffer, size);
+ 
+-	if (pkey_free(pkey) == -1)
++	if (ltp_pkey_free(pkey) == -1)
+ 		tst_brk(TBROK | TERRNO, "pkey_free failed");
+ }
+ 
 -- 
 2.23.0
 


More information about the buildroot mailing list