2015-12-17 20:56:48 +03:00
/*
* Copyright ( c ) 1994 - 1996 Rick Sladkey < jrs @ world . std . com >
* Copyright ( c ) 1996 - 2000 Wichert Akkerman < wichert @ cistron . nl >
* Copyright ( c ) 2005 - 2007 Roland McGrath < roland @ redhat . com >
* Copyright ( c ) 2008 - 2015 Dmitry V . Levin < ldv @ altlinux . org >
2018-04-05 04:40:00 +03:00
* Copyright ( c ) 2014 - 2018 The strace developers .
2015-12-17 20:56:48 +03:00
* All rights reserved .
*
2018-12-10 03:00:00 +03:00
* SPDX - License - Identifier : LGPL - 2.1 - or - later
2015-12-17 20:56:48 +03:00
*/
2014-12-11 22:25:02 +03:00
# include "defs.h"
2016-11-20 05:00:35 +03:00
# include <linux/prctl.h>
2014-12-11 22:25:02 +03:00
2018-02-21 22:57:16 +03:00
# include "xstring.h"
2014-12-11 22:25:02 +03:00
# include "xlat/prctl_options.h"
2015-12-06 18:33:53 +03:00
# include "xlat/pr_cap_ambient.h"
2016-12-06 22:14:48 +03:00
# include "xlat/pr_dumpable.h"
2016-11-19 23:10:01 +03:00
# include "xlat/pr_fp_mode.h"
2015-02-14 04:51:03 +03:00
# include "xlat/pr_mce_kill.h"
# include "xlat/pr_mce_kill_policy.h"
# include "xlat/pr_set_mm.h"
2018-05-22 20:13:30 +03:00
# include "xlat/pr_spec_cmds.h"
# include "xlat/pr_spec_get_store_bypass_flags.h"
# include "xlat/pr_spec_set_store_bypass_flags.h"
2018-02-21 22:57:16 +03:00
# include "xlat/pr_sve_vl_flags.h"
2015-02-14 04:51:03 +03:00
# include "xlat/pr_tsc.h"
2015-12-06 18:33:53 +03:00
# include "xlat/pr_unalign_flags.h"
2014-12-11 22:25:02 +03:00
2015-02-14 04:51:03 +03:00
# ifndef TASK_COMM_LEN
# define TASK_COMM_LEN 16
2014-12-11 22:25:02 +03:00
# endif
2015-02-05 02:50:50 +03:00
# ifdef HAVE_LINUX_SECCOMP_H
# include <linux / seccomp.h>
# endif
# include "xlat/seccomp_mode.h"
2015-02-14 04:51:03 +03:00
# ifdef HAVE_LINUX_SECUREBITS_H
# include <linux / securebits.h>
# endif
# include "xlat/secbits.h"
/* these constants are the same as in <linux/capability.h> */
enum {
# include "caps0.h"
# include "caps1.h"
} ;
# include "xlat/cap.h"
2018-02-21 22:57:16 +03:00
# ifndef PR_SVE_VL_LEN_MASK
# define PR_SVE_VL_LEN_MASK 0xffff
# endif
2015-07-25 12:43:01 +03:00
static void
print_prctl_args ( struct tcb * tcp , const unsigned int first )
{
unsigned int i ;
for ( i = first ; i < tcp - > s_ent - > nargs ; + + i )
2016-12-26 05:28:04 +03:00
tprintf ( " , %# " PRI_klx , tcp - > u_arg [ i ] ) ;
2015-07-25 12:43:01 +03:00
}
2018-02-21 22:57:16 +03:00
static char *
sprint_sve_val ( kernel_ulong_t arg )
{
static char out [ sizeof ( " PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|0x " ) +
sizeof ( kernel_ulong_t ) * 2 ] ;
kernel_ulong_t vl = arg & PR_SVE_VL_LEN_MASK ;
kernel_ulong_t flags = arg & ~ PR_SVE_VL_LEN_MASK ;
const char * flags_str = sprintflags ( " " , pr_sve_vl_flags , flags ) ;
xsprintf ( out , " %s%s%# " PRI_klx ,
flags_str ? : " " , flags_str ? " | " : " " , vl ) ;
return out ;
}
2015-07-18 00:49:17 +03:00
SYS_FUNC ( prctl )
2014-12-11 22:25:02 +03:00
{
2016-05-17 01:19:31 +03:00
const unsigned int option = tcp - > u_arg [ 0 ] ;
2016-12-26 05:28:04 +03:00
const kernel_ulong_t arg2 = tcp - > u_arg [ 1 ] ;
const kernel_ulong_t arg3 = tcp - > u_arg [ 2 ] ;
2016-11-18 20:25:13 +03:00
/*
* PR_SET_VMA is the only command which actually uses these arguments
* currently , and it is available only on Android for now .
*/
# ifdef __ANDROID__
2016-12-26 05:28:04 +03:00
const kernel_ulong_t arg4 = tcp - > u_arg [ 3 ] ;
const kernel_ulong_t arg5 = tcp - > u_arg [ 4 ] ;
2016-11-18 20:25:13 +03:00
# endif
2014-12-11 22:25:02 +03:00
unsigned int i ;
2015-07-18 00:49:17 +03:00
if ( entering ( tcp ) )
2016-05-17 01:19:31 +03:00
printxval ( prctl_options , option , " PR_??? " ) ;
2015-02-14 04:51:03 +03:00
2016-05-17 01:19:31 +03:00
switch ( option ) {
2015-07-18 00:49:17 +03:00
case PR_GET_KEEPCAPS :
case PR_GET_SECCOMP :
case PR_GET_TIMERSLACK :
case PR_GET_TIMING :
2015-12-06 18:29:04 +03:00
return RVAL_DECODED ;
2015-07-18 00:49:17 +03:00
case PR_GET_CHILD_SUBREAPER :
2015-02-14 04:51:03 +03:00
case PR_GET_ENDIAN :
case PR_GET_FPEMU :
case PR_GET_FPEXC :
2015-07-18 00:49:17 +03:00
if ( entering ( tcp ) )
tprints ( " , " ) ;
else
2016-11-18 20:25:13 +03:00
printnum_int ( tcp , arg2 , " %u " ) ;
2015-07-18 00:49:17 +03:00
break ;
2016-12-06 22:14:48 +03:00
case PR_GET_DUMPABLE :
if ( entering ( tcp ) )
break ;
if ( syserror ( tcp ) )
return 0 ;
2016-12-26 13:26:03 +03:00
tcp - > auxstr = xlookup ( pr_dumpable , ( kernel_ulong_t ) tcp - > u_rval ) ;
2016-12-06 22:14:48 +03:00
return RVAL_STR ;
2015-02-14 04:51:03 +03:00
case PR_GET_NAME :
2016-11-18 21:00:02 +03:00
if ( entering ( tcp ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " , " ) ;
2016-11-18 21:00:02 +03:00
} else {
2015-07-18 00:49:17 +03:00
if ( syserror ( tcp ) )
2016-11-18 20:25:13 +03:00
printaddr ( arg2 ) ;
2015-07-18 00:49:17 +03:00
else
2016-11-18 20:25:13 +03:00
printstr_ex ( tcp , arg2 , TASK_COMM_LEN ,
2016-11-20 03:38:34 +03:00
QUOTE_0_TERMINATED ) ;
2015-07-18 00:49:17 +03:00
}
break ;
2015-02-14 04:51:03 +03:00
case PR_GET_PDEATHSIG :
2016-11-18 21:00:02 +03:00
if ( entering ( tcp ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " , " ) ;
2016-11-18 21:00:02 +03:00
} else if ( ! umove_or_printaddr ( tcp , arg2 , & i ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " [ " ) ;
2018-10-07 06:12:42 +03:00
printsignal ( i ) ;
2015-07-18 00:49:17 +03:00
tprints ( " ] " ) ;
}
break ;
2015-02-14 04:51:03 +03:00
case PR_GET_SECUREBITS :
2015-07-18 00:49:17 +03:00
if ( entering ( tcp ) )
break ;
if ( syserror ( tcp ) | | tcp - > u_rval = = 0 )
return 0 ;
2016-05-15 17:23:06 +03:00
tcp - > auxstr = sprintflags ( " " , secbits ,
2016-12-26 13:26:03 +03:00
( kernel_ulong_t ) tcp - > u_rval ) ;
2015-07-18 00:49:17 +03:00
return RVAL_STR ;
2015-02-14 04:51:03 +03:00
case PR_GET_TID_ADDRESS :
2015-07-18 00:49:17 +03:00
if ( entering ( tcp ) )
tprints ( " , " ) ;
else
2016-12-12 00:12:27 +03:00
printnum_kptr ( tcp , arg2 ) ;
2015-07-18 00:49:17 +03:00
break ;
2015-02-14 04:51:03 +03:00
case PR_GET_TSC :
2016-11-18 21:00:02 +03:00
if ( entering ( tcp ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " , " ) ;
2016-11-18 21:00:02 +03:00
} else if ( ! umove_or_printaddr ( tcp , arg2 , & i ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " [ " ) ;
printxval ( pr_tsc , i , " PR_TSC_??? " ) ;
tprints ( " ] " ) ;
}
break ;
2015-02-14 04:51:03 +03:00
case PR_GET_UNALIGN :
2016-11-18 21:00:02 +03:00
if ( entering ( tcp ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " , " ) ;
2016-11-18 21:00:02 +03:00
} else if ( ! umove_or_printaddr ( tcp , arg2 , & i ) ) {
2015-07-18 00:49:17 +03:00
tprints ( " [ " ) ;
printflags ( pr_unalign_flags , i , " PR_UNALIGN_??? " ) ;
tprints ( " ] " ) ;
}
break ;
2016-11-19 23:10:01 +03:00
case PR_GET_FP_MODE :
if ( entering ( tcp ) )
break ;
if ( syserror ( tcp ) | | tcp - > u_rval = = 0 )
return 0 ;
tcp - > auxstr = sprintflags ( " " , pr_fp_mode ,
2016-12-26 13:26:03 +03:00
( kernel_ulong_t ) tcp - > u_rval ) ;
2016-11-19 23:10:01 +03:00
return RVAL_STR ;
2018-02-21 22:57:16 +03:00
case PR_SVE_SET_VL :
if ( entering ( tcp ) ) {
tprintf ( " , %s " , sprint_sve_val ( arg2 ) ) ;
return 0 ;
}
ATTRIBUTE_FALLTHROUGH ;
case PR_SVE_GET_VL :
if ( entering ( tcp ) )
break ;
if ( syserror ( tcp ) | | tcp - > u_rval = = 0 )
return 0 ;
tcp - > auxstr = sprint_sve_val ( tcp - > u_rval ) ;
return RVAL_STR ;
2018-05-22 20:13:30 +03:00
case PR_GET_SPECULATION_CTRL :
if ( entering ( tcp ) ) {
tprints ( " , " ) ;
printxval64 ( pr_spec_cmds , arg2 , " PR_SPEC_??? " ) ;
break ;
}
if ( syserror ( tcp ) )
return 0 ;
switch ( arg2 ) {
case PR_SPEC_STORE_BYPASS :
2018-12-14 19:25:24 +03:00
case PR_SPEC_INDIRECT_BRANCH :
2018-05-22 20:13:30 +03:00
tcp - > auxstr = sprintflags ( " " ,
pr_spec_get_store_bypass_flags ,
( kernel_ulong_t ) tcp - > u_rval ) ;
break ;
}
return RVAL_STR ;
2015-07-18 00:49:17 +03:00
/* PR_TASK_PERF_EVENTS_* take no arguments. */
2015-02-14 04:51:03 +03:00
case PR_TASK_PERF_EVENTS_DISABLE :
case PR_TASK_PERF_EVENTS_ENABLE :
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-05 02:50:50 +03:00
2015-02-14 04:51:03 +03:00
case PR_SET_CHILD_SUBREAPER :
case PR_SET_ENDIAN :
case PR_SET_FPEMU :
case PR_SET_FPEXC :
case PR_SET_KEEPCAPS :
case PR_SET_TIMING :
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " , % " PRI_klu , arg2 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
2016-12-06 22:14:48 +03:00
case PR_SET_DUMPABLE :
tprints ( " , " ) ;
printxval64 ( pr_dumpable , arg2 , " SUID_DUMP_??? " ) ;
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_CAPBSET_DROP :
2015-12-06 18:29:04 +03:00
case PR_CAPBSET_READ :
2015-02-14 04:51:03 +03:00
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval64 ( cap , arg2 , " CAP_??? " ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-12-06 18:33:53 +03:00
case PR_CAP_AMBIENT :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval64 ( pr_cap_ambient , arg2 ,
2016-05-17 02:22:11 +03:00
" PR_CAP_AMBIENT_??? " ) ;
2016-11-18 20:25:13 +03:00
switch ( arg2 ) {
2015-12-06 18:33:53 +03:00
case PR_CAP_AMBIENT_RAISE :
case PR_CAP_AMBIENT_LOWER :
case PR_CAP_AMBIENT_IS_SET :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval64 ( cap , arg3 , " CAP_??? " ) ;
2015-12-06 18:33:53 +03:00
print_prctl_args ( tcp , 3 ) ;
break ;
default :
print_prctl_args ( tcp , 2 ) ;
break ;
}
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_MCE_KILL :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval64 ( pr_mce_kill , arg2 , " PR_MCE_KILL_??? " ) ;
2015-02-14 04:51:03 +03:00
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
if ( PR_MCE_KILL_SET = = arg2 )
printxval64 ( pr_mce_kill_policy , arg3 ,
" PR_MCE_KILL_??? " ) ;
2015-02-14 04:51:03 +03:00
else
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " %# " PRI_klx , arg3 ) ;
2015-07-25 12:43:01 +03:00
print_prctl_args ( tcp , 3 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_NAME :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printstr_ex ( tcp , arg2 , TASK_COMM_LEN - 1 ,
2016-11-20 03:38:34 +03:00
QUOTE_0_TERMINATED ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
2015-07-30 01:49:38 +03:00
# ifdef __ANDROID__
# ifndef PR_SET_VMA_ANON_NAME
# define PR_SET_VMA_ANON_NAME 0
# endif
case PR_SET_VMA :
2016-11-18 20:25:13 +03:00
if ( arg2 = = PR_SET_VMA_ANON_NAME ) {
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " , PR_SET_VMA_ANON_NAME, %# " PRI_klx , arg3 ) ;
tprintf ( " , % " PRI_klu " , " , arg4 ) ;
2016-12-20 19:43:26 +03:00
printstr ( tcp , arg5 ) ;
2015-07-30 01:49:38 +03:00
} else {
/* There are no other sub-options now, but there
* might be in future . . . */
print_prctl_args ( tcp , 1 ) ;
}
return RVAL_DECODED ;
# endif
2015-02-14 04:51:03 +03:00
case PR_SET_MM :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval ( pr_set_mm , arg2 , " PR_SET_MM_??? " ) ;
2015-07-25 12:43:01 +03:00
print_prctl_args ( tcp , 2 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_PDEATHSIG :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
if ( arg2 > 128 )
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " % " PRI_klu , arg2 ) ;
2015-02-14 04:51:03 +03:00
else
2018-10-07 06:12:42 +03:00
printsignal ( arg2 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_PTRACER :
tprints ( " , " ) ;
2018-03-10 08:29:41 +03:00
if ( ( int ) arg2 = = - 1 ) {
print_xlat_ex ( arg2 , " PR_SET_PTRACER_ANY " ,
XLAT_STYLE_DEFAULT ) ;
} else {
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " % " PRI_klu , arg2 ) ;
2018-03-10 08:29:41 +03:00
}
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_SECCOMP :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval64 ( seccomp_mode , arg2 ,
" SECCOMP_MODE_??? " ) ;
if ( SECCOMP_MODE_STRICT = = arg2 )
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2016-11-18 20:25:13 +03:00
if ( SECCOMP_MODE_FILTER = = arg2 ) {
2015-02-05 02:50:50 +03:00
tprints ( " , " ) ;
Generalize seccomp filter parser
Linux socket filter uses almost the same classic BPF as seccomp filter,
The only difference noticeable from strace PoV is the meaning of generic
multiuse field.
Transform the parser of seccomp filters to a more generic parser
of classic BPF, parametrized with a method of parsing the generic
multiuse field in BPF_STMT.
* bpf_filter.c: New file.
* bpf_filter.h: Likewise.
* bpf_fprog.h: Likewise.
* bpf_seccomp_filter.c: Likewise.
* fetch_bpf_fprog.c: Likewise.
* fetch_seccomp_fprog.c: Remove.
* seccomp_fprog.h: Likewise.
* Makefile.am (strace_SOURCES): Add bpf_filter.c, bpf_filter.h,
bpf_fprog.h, bpf_seccomp_filter.c, and fetch_bpf_fprog.c.
Remove fetch_seccomp_fprog.c and seccomp_fprog.h.
* seccomp.c: Do not include linux/filter.h and xlat header files.
Do not define SECCOMP_RET_ACTION.
(bpf_filter, decode_bpf_code, decode_bpf_stmt, decode_bpf_jump,
print_bpf_filter, print_seccomp_fprog, print_seccomp_filter): Remove.
* defs.h (print_seccomp_filter): Rename to decode_seccomp_fprog.
(SYS_FUNC(seccomp)): Replace print_seccomp_filter
with decode_seccomp_fprog.
* prctl.c (SYS_FUNC(prctl)): Likewise.
2017-07-08 04:49:00 +03:00
decode_seccomp_fprog ( tcp , arg3 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
}
2015-07-25 12:43:01 +03:00
print_prctl_args ( tcp , 2 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-05 02:50:50 +03:00
2015-02-14 04:51:03 +03:00
case PR_SET_SECUREBITS :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printflags64 ( secbits , arg2 , " SECBIT_??? " ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_TIMERSLACK :
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " , % " PRI_kld , arg2 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_TSC :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printxval ( pr_tsc , arg2 , " PR_TSC_??? " ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_UNALIGN :
tprints ( " , " ) ;
2016-11-18 20:25:13 +03:00
printflags ( pr_unalign_flags , arg2 , " PR_UNALIGN_??? " ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_SET_NO_NEW_PRIVS :
case PR_SET_THP_DISABLE :
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " , % " PRI_klu , arg2 ) ;
2015-07-25 12:43:01 +03:00
print_prctl_args ( tcp , 2 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2015-02-14 04:51:03 +03:00
case PR_MCE_KILL_GET :
2015-07-25 12:43:01 +03:00
if ( entering ( tcp ) ) {
print_prctl_args ( tcp , 1 ) ;
return 0 ;
}
2015-02-14 04:51:03 +03:00
if ( syserror ( tcp ) )
return 0 ;
2016-05-15 00:46:05 +03:00
tcp - > auxstr = xlookup ( pr_mce_kill_policy ,
2016-12-26 13:26:03 +03:00
( kernel_ulong_t ) tcp - > u_rval ) ;
2018-03-29 19:00:18 +03:00
return RVAL_STR ;
2015-02-14 04:51:03 +03:00
2016-11-19 23:10:01 +03:00
case PR_SET_FP_MODE :
tprints ( " , " ) ;
printflags ( pr_fp_mode , arg2 , " PR_FP_MODE_??? " ) ;
return RVAL_DECODED ;
2018-05-22 20:13:30 +03:00
case PR_SET_SPECULATION_CTRL :
tprints ( " , " ) ;
printxval64 ( pr_spec_cmds , arg2 , " PR_SPEC_??? " ) ;
tprints ( " , " ) ;
switch ( arg2 ) {
case PR_SPEC_STORE_BYPASS :
2018-12-14 19:25:24 +03:00
case PR_SPEC_INDIRECT_BRANCH :
2018-05-22 20:13:30 +03:00
printxval64 ( pr_spec_set_store_bypass_flags , arg3 ,
" PR_SPEC_??? " ) ;
break ;
default :
tprintf ( " %# " PRI_klx , arg3 ) ;
}
return RVAL_DECODED ;
2015-12-06 18:29:04 +03:00
case PR_GET_NO_NEW_PRIVS :
case PR_GET_THP_DISABLE :
2015-07-18 00:49:17 +03:00
case PR_MPX_DISABLE_MANAGEMENT :
case PR_MPX_ENABLE_MANAGEMENT :
2015-02-14 04:51:03 +03:00
default :
2015-07-25 12:43:01 +03:00
print_prctl_args ( tcp , 1 ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2014-12-11 22:25:02 +03:00
}
return 0 ;
}
2017-07-21 04:30:26 +03:00
# if defined X86_64 || defined X32 || defined I386
2014-12-11 22:25:02 +03:00
# include "xlat / archvals.h"
2015-04-07 04:36:50 +03:00
SYS_FUNC ( arch_prctl )
2014-12-11 22:25:02 +03:00
{
2016-05-17 01:19:31 +03:00
const unsigned int option = tcp - > u_arg [ 0 ] ;
2016-12-26 05:28:04 +03:00
const kernel_ulong_t addr = tcp - > u_arg [ 1 ] ;
2016-05-17 01:19:31 +03:00
2015-02-14 04:51:03 +03:00
if ( entering ( tcp ) )
2016-05-17 01:19:31 +03:00
printxval ( archvals , option , " ARCH_??? " ) ;
2015-02-14 04:51:03 +03:00
2016-05-17 01:19:31 +03:00
switch ( option ) {
2015-02-14 04:51:03 +03:00
case ARCH_GET_GS :
case ARCH_GET_FS :
2015-07-18 00:49:17 +03:00
if ( entering ( tcp ) )
2015-02-14 04:51:03 +03:00
tprints ( " , " ) ;
2015-07-18 00:49:17 +03:00
else
2016-11-18 20:25:13 +03:00
printnum_ptr ( tcp , addr ) ;
2015-02-14 04:51:03 +03:00
return 0 ;
2014-12-11 22:25:02 +03:00
}
2015-02-14 04:51:03 +03:00
Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t. All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t. All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:56:45 +03:00
tprintf ( " , %# " PRI_klx , addr ) ;
2015-07-18 00:49:17 +03:00
return RVAL_DECODED ;
2014-12-11 22:25:02 +03:00
}
2017-07-21 04:30:26 +03:00
# endif /* X86_64 || X32 || I386 */