procps 3.1.12 patch for new SE Linux
I have attached a patch to make procps 3.1.12 work on the new SE Linux. It's a little rough and may have some bugs tracking memory (if you can trigger a double-free or a memory leak I wouldn't be surprised). But it basically works.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
debian/changelog renamed from procps-3.1.12/debian/changelog +6 -0
@@ -1,3 +1,9 @@ +procps (1:3.1.12-1.new.se1) unstable; urgency=low + + * Compiled with SE Linux support. + + -- Russell Coker <[email protected]> Sun, 19 Oct 2003 02:20:00 +1000 + procps (1:3.1.12-1) unstable; urgency=low * New upstream release
debian/control renamed from procps-3.1.12/debian/control +1 -1
@@ -2,7 +2,7 @@ Section: base Priority: required Maintainer: Craig Small <[email protected]> -Build-Depends: debhelper (>> 4.1.1), libncurses5-dev, make (>= 3.78.1-8) +Build-Depends: debhelper (>> 4.1.1), libncurses5-dev, make (>= 3.78.1-8), libselinux1-dev Standards-Version: 3.5.9 Package: procps
debian/rules renamed from procps-3.1.12/debian/rules +2 -1
@@ -21,7 +21,8 @@ SHARED=0 $(MAKE) proc/libproc.a mv proc/libproc.a static $(MAKE) clean - $(MAKE) W_SHOWFROM=\-DW_SHOWFROM + $(MAKE) W_SHOWFROM=\-DW_SHOWFROM LDFLAGS=-lselinux CFLAGS="-O2 -g3 -I/usr/include/selinux -DWITH_SELINUX" + touch build-stamp
proc/readproc.c renamed from procps-3.1.12/proc/readproc.c +51 -21
142 lines not on this page · raw message
proc/readproc.h renamed from procps-3.1.12/proc/readproc.h +6 -6
@@ -14,8 +14,8 @@#define SIGNAL_STRING -#ifdef FLASK_LINUX -#include <fs_secure.h> +#ifdef WITH_SELINUX +#include <selinux/selinux.h> #endif EXTERN_C_BEGIN
@@ -136,8 +136,8 @@ tgid,/* thread group ID */ exit_signal,/* might not be SIGCHLD */ processor;/* current (or most recent?) CPU */ -#ifdef FLASK_LINUX -security_id_t secsid; +#ifdef WITH_SELINUX +security_context_t scontext;#endif } proc_t;
@@ -154,8 +154,8 @@pid_t * pids;/* pids of the procs */ uid_t * uids;/* uids of procs */ int nuid;/* cannot really sentinel-terminate unsigned short[] */ -#ifdef FLASK_LINUX -security_id_t * sids;/* SIDs of the procs */ +#ifdef WITH_SELINUX +security_context_t * scontexts;/* security contexts of the procs */ #endif }PROCTAB ;
ps/common.h renamed from procps-3.1.12/ps/common.h +0 -1
@@ -103,7 +103,6 @@#define FF_LX 0x0100/* X */ #define FF_Lm 0x0200/* m */ /* overloaded: threads, sort, format */ #define FF_Fc 0x0400/* --context */ /* Flask security context format */ -#define FF_Fs 0x0800/* --SID */ /* Flask SID format */ /* predefined format modifier flags such as: -l -f l u s -j */ #define FM_c 0x0001/* -c */
ps/output.c renamed from procps-3.1.12/ps/output.c +19 -123
191 lines not on this page · raw message
ps/parser.c renamed from procps-3.1.12/ps/parser.c +10 -6
@@ -314,8 +314,18 @@display_version ();exit (0 );case 'Z' :/* full Mandatory Access Control level info */ +#ifdef WITH_SELINUX +if (is_selinux_enabled ()) { +trace ("-Z shows full MAC info\n" ); + format_flags |= FF_Fc; + }else { +fprintf (stderr, +"Warning: -Z ignored. Requires a SELinux enabled kernel\n" ); + } +#else trace ("-Z shows full MAC info\n" );return "Don't understand MAC on Linux." ; +#endif break ;case 'a' :trace ("-a select all with a tty, but omit session leaders.\n" );
@@ -727,7 +737,6 @@gnu_table_struct *found;static const gnu_table_struct gnu_table[] = { {"Group" , &&case_Group},/* rgid */ - {"SID" , &&case_secsid}, {"User" , &&case_User},/* ruid */ {"cols" , &&case_cols}, {"columns" , &&case_columns},
@@ -755,7 +764,6 @@ {"pid", &&case_pid}, {"ppid", &&case_ppid}, {"rows", &&case_rows}, - {"secsid", &&case_secsid}, {"sid", &&case_sid}, {"sort", &&case_sort}, {"tty", &&case_tty},
@@ -944,10 +952,6 @@trace ("--context\n" ); format_flags |= FF_Fc;return NULL ; - case_secsid: -trace ("--secsid\n" ); - format_flags |= FF_Fs; -return NULL ; }/*************** process trailing PIDs **********************/
ps/ps.1 renamed from procps-3.1.12/ps/ps.1 +1 -3
@@ -106,8 +106,7 @@ u display user-oriented format v display virtual memory format --format user-defined format ---context (SELinux only) Display security context format; implies --secsid ---secsid (SELinux only) Display Security ID +--context (SELinux only) Display security context format; .TE .SH "OUTPUT MODIFIERS" .TS
@@ -432,7 +431,6 @@ ruid RUID ruser RUSER s S -secsid SECSID sess SESS session SESS sgi_p P
ps/sortformat.c renamed from procps-3.1.12/ps/sortformat.c +0 -1
@@ -832,7 +832,6 @@/* These are FLASK security options. */ case FF_Fc: spec="FLASK_context" ;break ; -case FF_Fs: spec="FLASK_sid" ;break ; }/* end switch(format_flags) */