diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2016-11-12 20:54:56 +0300 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2016-11-13 21:41:58 +0000 |
commit | 98a93b46fd29c7ffa160112e0471592b32431e1b (patch) | |
tree | 5e19e0552247270e13e2b4fb60f14150a9622e50 /mem.c | |
parent | 13c467bf694bffcec4660a0dced41ca06ffb2512 (diff) | |
download | strace-98a93b46fd29c7ffa160112e0471592b32431e1b.tar.gz |
Add support for pkey_mprotect, pkey_alloc, pkey_free syscalls
* linux/32/syscallent.h: Add syscall entries for pkey_* calls.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* mem.c (do_mprotect): New function, common handler for mprotect and
pkey_mprotect.
(SYS_FUNC(mprotect)): Convert to wrapper around do_mprotect.
(SYS_FUNC(pkey_mprotect)): New function.
* xlat/pkey_access.in: New file.
* pkeys.c: New file containing implementation of pkey_alloc and
pkey_free.
* Makefile.am: Add it.
* NEWS: Mention this enhancement.
* tests/.gitignore: Add pkey_alloc, pkey_free, and pkey_mprotect.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pkey_alloc.test, pkey_free.test, and
pkey_mprotect.test.
* tests/pkey_alloc.c: New file.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/pkey_alloc.test: New test.
* tests/pkey_free.test: Likewise.
* tests/pkey_mprotect.test: Likewise.
Diffstat (limited to 'mem.c')
-rw-r--r-- | mem.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -182,15 +182,29 @@ SYS_FUNC(munmap) return RVAL_DECODED; } -SYS_FUNC(mprotect) +static int +do_mprotect(struct tcb *tcp, bool has_pkey) { printaddr(tcp->u_arg[0]); tprintf(", %lu, ", tcp->u_arg[1]); printflags_long(mmap_prot, tcp->u_arg[2], "PROT_???"); + if (has_pkey) + tprintf(", %d", (int) tcp->u_arg[3]); + return RVAL_DECODED; } +SYS_FUNC(mprotect) +{ + return do_mprotect(tcp, false); +} + +SYS_FUNC(pkey_mprotect) +{ + return do_mprotect(tcp, true); +} + #include "xlat/mremap_flags.h" SYS_FUNC(mremap) |