* [LTP] [PATCH] pkeys: Fix uclibc build caused by conflicting signature
@ 2019-10-01 18:47 Petr Vorel
2019-10-02 8:03 ` Jan Stancek
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2019-10-01 18:47 UTC (permalink / raw
To: ltp
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
it does not implement them, our implementation signature conflicts, as
it uses static.
Fixed build error:
In file included from pkey01.c:32:0:
pkey.h:18:19: error: static declaration of ?pkey_mprotect? follows non-static declaration
static inline int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
^
In file included from /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/mman-linux.h:115:0,
from /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/mman.h:40,
from /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/mman.h:41,
from pkey01.c:29:
/opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/mman-shared.h:73:5: note: previous declaration of ?pkey_mprotect? was here
int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey) __THROW;
^
In file included from pkey01.c:32:0:
Found with test-pkg tool from Buildroot distribution.
Fixes: 90c2dc89f ("pkey: add test for memory protection keys")
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
testcases/kernel/syscalls/pkeys/pkey.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/pkeys/pkey.h b/testcases/kernel/syscalls/pkeys/pkey.h
index d623244eb..19c8447eb 100644
--- a/testcases/kernel/syscalls/pkeys/pkey.h
+++ b/testcases/kernel/syscalls/pkeys/pkey.h
@@ -15,17 +15,17 @@
#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)
{
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)
{
return tst_syscall(__NR_pkey_alloc, flags, access_rights);
}
-static inline int pkey_free(int pkey)
+inline int pkey_free(int pkey)
{
return tst_syscall(__NR_pkey_free, pkey);
}
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] pkeys: Fix uclibc build caused by conflicting signature
2019-10-01 18:47 [LTP] [PATCH] pkeys: Fix uclibc build caused by conflicting signature Petr Vorel
@ 2019-10-02 8:03 ` Jan Stancek
2019-10-02 10:36 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2019-10-02 8:03 UTC (permalink / raw
To: ltp
----- Original Message -----
> Removing static fixes the problem.
I'd prefer we rename test functions:
#ifndef HAVE_PKEY_MPROTECT
static inline int my_pkey_alloc()
#else
#define my_pkey_alloc pkey_alloc
#endif
my_pkey_alloc()
>
> uClibc defines pkey_{alloc,free,mprotect} signatures in
> <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.
>
> Fixed build error:
> In file included from pkey01.c:32:0:
> pkey.h:18:19: error: static declaration of ?pkey_mprotect? follows non-static
> declaration
> static inline int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
> ^
> In file included from
> /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/mman-linux.h:115:0,
> from
> /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/mman.h:40,
> from
> /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/mman.h:41,
> from pkey01.c:29:
> /opt/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/mman-shared.h:73:5:
> note: previous declaration of ?pkey_mprotect? was here
> int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey)
> __THROW;
> ^
> In file included from pkey01.c:32:0:
>
> Found with test-pkg tool from Buildroot distribution.
>
> Fixes: 90c2dc89f ("pkey: add test for memory protection keys")
>
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> testcases/kernel/syscalls/pkeys/pkey.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/pkeys/pkey.h
> b/testcases/kernel/syscalls/pkeys/pkey.h
> index d623244eb..19c8447eb 100644
> --- a/testcases/kernel/syscalls/pkeys/pkey.h
> +++ b/testcases/kernel/syscalls/pkeys/pkey.h
> @@ -15,17 +15,17 @@
> #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)
> {
> 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)
> {
> return tst_syscall(__NR_pkey_alloc, flags, access_rights);
> }
>
> -static inline int pkey_free(int pkey)
> +inline int pkey_free(int pkey)
> {
> return tst_syscall(__NR_pkey_free, pkey);
> }
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] pkeys: Fix uclibc build caused by conflicting signature
2019-10-02 8:03 ` Jan Stancek
@ 2019-10-02 10:36 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2019-10-02 10:36 UTC (permalink / raw
To: ltp
Hi Jan,
> ----- Original Message -----
> > Removing static fixes the problem.
> I'd prefer we rename test functions:
> #ifndef HAVE_PKEY_MPROTECT
> static inline int my_pkey_alloc()
> #else
> #define my_pkey_alloc pkey_alloc
> #endif
> my_pkey_alloc()
Good idea, thanks. I'd a detail, I'd prefer to use 'ltp_' prefix (ltp_pkey_alloc()).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-02 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-01 18:47 [LTP] [PATCH] pkeys: Fix uclibc build caused by conflicting signature Petr Vorel
2019-10-02 8:03 ` Jan Stancek
2019-10-02 10:36 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.