Skip to content

Commit

Permalink
apparmor: export set of capabilities supported by the apparmor module
Browse files Browse the repository at this point in the history
Signed-off-by: John Johansen <[email protected]>
Acked-by: Seth Arnold <[email protected]>
  • Loading branch information
John Johansen committed Aug 14, 2013
1 parent 29b3822 commit 84f1f78
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion security/apparmor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ quiet_cmd_make-caps = GEN $@
cmd_make-caps = echo "static const char *const capability_names[] = {" > $@ ;\
sed $< >>$@ -r -n -e '/CAP_FS_MASK/d' \
-e 's/^\#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/[\2] = "\L\1",/p';\
echo "};" >> $@
echo "};" >> $@ ;\
echo -n '\#define AA_FS_CAPS_MASK "' >> $@ ;\
sed $< -r -n -e '/CAP_FS_MASK/d' \
-e 's/^\#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/\L\1/p' | \
tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@


# Build a lower case string table of rlimit names.
Expand Down
1 change: 1 addition & 0 deletions security/apparmor/apparmorfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ static struct aa_fs_entry aa_fs_entry_features[] = {
AA_FS_DIR("file", aa_fs_entry_file),
AA_FS_FILE_U64("capability", VFS_CAP_FLAGS_MASK),
AA_FS_DIR("rlimit", aa_fs_entry_rlimit),
AA_FS_DIR("caps", aa_fs_entry_caps),
{ }
};

Expand Down
5 changes: 5 additions & 0 deletions security/apparmor/capability.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
*/
#include "capability_names.h"

struct aa_fs_entry aa_fs_entry_caps[] = {
AA_FS_FILE_STRING("mask", AA_FS_CAPS_MASK),
{ }
};

struct audit_cache {
struct aa_profile *profile;
kernel_cap_t caps;
Expand Down
4 changes: 4 additions & 0 deletions security/apparmor/include/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <linux/sched.h>

#include "apparmorfs.h"

struct aa_profile;

/* aa_caps - confinement data for capabilities
Expand All @@ -34,6 +36,8 @@ struct aa_caps {
kernel_cap_t extended;
};

extern struct aa_fs_entry aa_fs_entry_caps[];

int aa_capable(struct task_struct *task, struct aa_profile *profile, int cap,
int audit);

Expand Down

0 comments on commit 84f1f78

Please sign in to comment.