Basic LSM and SE Linux support for Strace
Subsystems (2)
I've attached a patch for strace that makes it understand the security() system call for i386 and the SE Linux system calls. I've added full support for all the common SE Linux calls (every one for which I could find a program to strace) and partial support for the rest.
People who want to add support for other LSM based systems shouldn't find it too difficult with this as an example.
For the Debian people, I'd like to see something derived from this be in the standard Debian package of strace in the near future. I know that I have portability issues to fix first (any suggestions on where to start will be welcome).
Signature · 3 lines
I do not get viruses because I do not use MS software. If you use Outlook then please do not put my email address in your address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line
From field.
Makefile.in +2 -1
@@ -54,7 +54,7 @@ OBJ = strace.o version.o syscall.o util.o desc.o file.o ipc.o \ io.o ioctl.o mem.o net.o process.o bjm.o \ resource.o signal.o sock.o system.o term.o time.o \ - proc.o stream.o + proc.o stream.o security.o all: strace
@@ -108,3 +108,4 @@ system.o: system.c defs.h config.h time.o: time.c defs.h config.h util.o: util.c defs.h config.h +security.o: security.c defs.h config.h
defs.h +1 -0
@@ -343,6 +343,7 @@#define TRACE_NETWORK 004/* Trace network-related syscalls. */ #define TRACE_PROCESS 010/* Trace process-related syscalls. */ #define TRACE_SIGNAL 020/* Trace signal-related syscalls. */ +#define TRACE_SECURITY 040/* Trace security-related syscalls. */ extern struct tcb tcbtab[];extern int qual_flags[];
file.c +76 -0
100 lines not on this page · raw message
linux/syscall.h +65 -0
77 lines not on this page · raw message
linux/syscallent.h +55 -1
67 lines not on this page · raw message
process.c +15 -0
@@ -938,6 +938,21 @@#endif /* LINUX || FREEBSD */ +#ifdef LINUX +int +sys_security (tcp) +struct tcb *tcp; +{ +if (entering (tcp)) { +tprintf ("id %d, call %u, args %X" , + (int ) tcp->u_arg[0 ], + (unsigned ) tcp->u_arg[1 ], + (unsigned ) tcp->u_arg[2 ]); + } +return 0 ; +} +#endif + int sys_setgroups(tcp) struct tcb *tcp;
security.c +128 -0
128 lines not on this page · raw message
syscall.c +13 -0
@@ -109,6 +109,7 @@#define TN TRACE_NETWORK#define TP TRACE_PROCESS#define TS TRACE_SIGNAL +#define TSEC TRACE_SECURITYstruct sysent sysent0[] = { #include "syscallent.h"
@@ -1616,6 +1619,18 @@case SYS_ipc:decode_subcall (tcp, SYS_ipc_subcall, SYS_ipc_nsubcalls, shift_style); +break ; +case SYS_security: +switch (tcp->u_arg[0 ]) + { +case 0xf97cff8c :/* SELINUX */ + { + tcp->scno = SYS_selinux + tcp->u_arg[1 ]; + tcp->u_nargs = sysent[tcp->scno].nargs; +umoven (tcp, (long )tcp->u_arg[2 ], tcp->u_nargs *sizeof (unsigned long ), (char *)&tcp->u_arg[0 ]); + } +break ; + }break ;#endif /* !ALPHA && !IA64 && !MIPS && !SPARC */ #ifdef SPARC