arm
Subsystems (2)
I have my iPaQ booting a SE Linux kernel and loading policy. I haven't labelled the file systems so it doesn't do anything useful yet, but progress is going well.
I've attached a patch that applies on top of 2.4.19 with the latest ARM patches and the 2.4.20 kernel patch back-ported to 2.4.19.
On http://www.coker.com.au/selinux/kern/ I have a file arm.bz2 which is a combination of all the 2.4.19 ARM patches I am using, and a file arm-lsm.diff.bz2 which applies on top of that for all LSM functionality plus the attached patch.
Most of the attached patch should be good for merging into the LSM patch tree. There are a couple of bits that break non-SE compilation, but they are easily fixed.
Also I have not actually called a SE Linux sys-call yet. So there may be some horrible bug in that regard. Hopefully tomorrow I'll get a labeled file system on my iPaQ and a modified login and I'll test these things out properly.
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
arch/arm/config.in +1 -0
@@ -818,4 +818,5 @@ dep_bool ' Kernel low-level debugging messages via UART2' CONFIG_DEBUG_CLPS711X_UART2 $CONFIG_DEBUG_LL $CONFIG_ARCH_CLPS711X endmenu +source security/Config.in source lib/Config.in
arch/arm/kernel/calls.S +1 -1
@@ -237,7 +237,7 @@ /* 220 */ .long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_fcntl64) .long SYMBOL_NAME(sys_ni_syscall) /* TUX */ - .long SYMBOL_NAME(sys_ni_syscall) /* Security */ + .long SYMBOL_NAME(sys_security_selinux_wrapper) /* Security */ .long SYMBOL_NAME(sys_gettid) /* 225 */ .long SYMBOL_NAME(sys_readahead) __syscall_end:
arch/arm/kernel/entry-common.S +4 -0
@@ -216,6 +216,10 @@ add r3, sp, #S_OFF b SYMBOL_NAME(sys_execve) +sys_security_selinux_wrapper: + add r3, sp, #S_OFF + b SYMBOL_NAME(sys_security_selinux_worker) + sys_clone_wapper: add r2, sp, #S_OFF b SYMBOL_NAME(sys_clone)
security/selinux/arch/arm/Makefile +8 -0
@@ -0,0 +1,8 @@ +O_TARGET := security.o + +obj-y := wrapper.o + +EXTRA_CFLAGS += -I../../include + +include $(TOPDIR)/Rules.make +
security/selinux/arch/arm/wrapper.c +30 -0
@@ -0,0 +1,30 @@ +#include <linux/kernel.h> +#include <linux/ptrace.h> +#include <linux/slab.h> +#include "../../selinux_plug.h" + +long sys_execve_secure (const char *path, +char **argv, +char **envp, +security_id_t sid, +struct pt_regs *regp) +{ +int error; +char * filename; +struct task_security_struct *tsec; + + tsec = current->security; + + filename =getname (path); + error =PTR_ERR (filename); +if (IS_ERR (filename)) + goto out; + tsec->in_sid[0 ] = sid; + error =do_execve (filename, argv, envp, regp); + tsec->in_sid[0 ] =0 ; +if (error ==0 ) + current->ptrace &= ~PT_DTRACE ; +putname (filename); +out: +return error; +}
security/selinux/include/asm-arm/flask/syscallaccess.h +25 -0
@@ -0,0 +1,25 @@ +/* -*- linux-c -*- */ + +#ifndef _ASM_FLASK_SYSCALLACCESS_H_ +#define _ASM_FLASK_SYSCALLACCESS_H_ + +extern void *sys_call_table[]; + +#define SELINUX_SYSCALL_GET (x) sys_call_table[x] +#define SELINUX_SYSCALL_SET (x, y) + +#define SECURITY_SELINUX_OR_WORKER \ +asmlinkage int sys_security_selinux_worker(unsigned int magic, \ + unsigned int call, \ + unsigned long* args, \ + struct pt_regs* regp) + +#define SECURITY_EXECVE_SECURE sys_execve_secure((char *)a0, (char**)a1, \ + (char**)a[2], a[3], regp) + +extern long sys_execve_secure (const char *path, +char **argv, +char **envp, +security_id_t sid, +struct pt_regs *regp); +#endif