diff options
author | jonathan <jonathan@FreeBSD.org> | 2011-06-30 10:56:02 +0000 |
---|---|---|
committer | jonathan <jonathan@FreeBSD.org> | 2011-06-30 10:56:02 +0000 |
commit | 8c932faae446ada0bed49a41fbb164c821227122 (patch) | |
tree | 4124774c8a367f5606513084c5f950e1a12d2ac0 /sys/kern/imgact_elf.c | |
parent | ced9bcf26f7e7107339e61b56b9ba7ceba6049ac (diff) | |
download | FreeBSD-src-8c932faae446ada0bed49a41fbb164c821227122.zip FreeBSD-src-8c932faae446ada0bed49a41fbb164c821227122.tar.gz |
Add some checks to ensure that Capsicum is behaving correctly, and add some
more explicit comments about what's going on and what future maintainers
need to do when e.g. adding a new operation to a sys_machdep.c.
Approved by: mentor(rwatson), re(bz)
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r-- | sys/kern/imgact_elf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index b41741a..ad79360 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -31,10 +31,12 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_capsicum.h" #include "opt_compat.h" #include "opt_core.h" #include <sys/param.h> +#include <sys/capability.h> #include <sys/exec.h> #include <sys/fcntl.h> #include <sys/imgact.h> @@ -578,6 +580,15 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long base_addr = 0; int vfslocked, error, i, numsegs; +#ifdef CAPABILITY_MODE + /* + * XXXJA: This check can go away once we are sufficiently confident + * that the checks in namei() are correct. + */ + if (IN_CAPABILITY_MODE(curthread)) + return (ECAPMODE); +#endif + tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK); nd = &tempdata->nd; attr = &tempdata->attr; |