Skip to content

Commit fc7e0b2

Browse files
committed
apparmor: move permissions into their own file to be more easily shared
Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent c961ee5 commit fc7e0b2

4 files changed

Lines changed: 43 additions & 19 deletions

File tree

‎security/apparmor/include/file.h‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,11 @@
1717

1818
#include "domain.h"
1919
#include "match.h"
20+
#include "perms.h"
2021

2122
struct aa_profile;
2223
struct path;
2324

24-
/*
25-
* We use MAY_EXEC, MAY_WRITE, MAY_READ, MAY_APPEND and the following flags
26-
* for profile permissions
27-
*/
28-
#define AA_MAY_CREATE 0x0010
29-
#define AA_MAY_DELETE 0x0020
30-
#define AA_MAY_META_WRITE 0x0040
31-
#define AA_MAY_META_READ 0x0080
32-
33-
#define AA_MAY_CHMOD 0x0100
34-
#define AA_MAY_CHOWN 0x0200
35-
#define AA_MAY_LOCK 0x0400
36-
#define AA_EXEC_MMAP 0x0800
37-
38-
#define AA_MAY_LINK 0x1000
39-
#define AA_LINK_SUBSET AA_MAY_LOCK /* overlaid */
40-
#define AA_MAY_ONEXEC 0x40000000 /* exec allows onexec */
41-
#define AA_MAY_CHANGE_PROFILE 0x80000000
42-
#define AA_MAY_CHANGEHAT 0x80000000 /* ctrl auditing only */
4325

4426
#define AA_AUDIT_FILE_MASK (MAY_READ | MAY_WRITE | MAY_EXEC | MAY_APPEND |\
4527
AA_MAY_CREATE | AA_MAY_DELETE | \

‎security/apparmor/include/perms.h‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* AppArmor security module
3+
*
4+
* This file contains AppArmor basic permission sets definitions.
5+
*
6+
* Copyright 2017 Canonical Ltd.
7+
*
8+
* This program is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU General Public License as
10+
* published by the Free Software Foundation, version 2 of the
11+
* License.
12+
*/
13+
14+
#ifndef __AA_PERM_H
15+
#define __AA_PERM_H
16+
17+
#include <linux/fs.h>
18+
19+
/*
20+
* We use MAY_EXEC, MAY_WRITE, MAY_READ, MAY_APPEND and the following flags
21+
* for profile permissions
22+
*/
23+
#define AA_MAY_CREATE 0x0010
24+
#define AA_MAY_DELETE 0x0020
25+
#define AA_MAY_META_WRITE 0x0040
26+
#define AA_MAY_META_READ 0x0080
27+
28+
#define AA_MAY_CHMOD 0x0100
29+
#define AA_MAY_CHOWN 0x0200
30+
#define AA_MAY_LOCK 0x0400
31+
#define AA_EXEC_MMAP 0x0800
32+
33+
#define AA_MAY_LINK 0x1000
34+
#define AA_LINK_SUBSET AA_MAY_LOCK /* overlaid */
35+
#define AA_MAY_ONEXEC 0x40000000 /* exec allows onexec */
36+
#define AA_MAY_CHANGE_PROFILE 0x80000000
37+
#define AA_MAY_CHANGEHAT 0x80000000 /* ctrl auditing only */
38+
39+
40+
#endif /* __AA_PERM_H */

‎security/apparmor/include/policy.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "domain.h"
3030
#include "file.h"
3131
#include "lib.h"
32+
#include "perms.h"
3233
#include "resource.h"
3334

3435

‎security/apparmor/lib.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "include/audit.h"
2222
#include "include/apparmor.h"
2323
#include "include/lib.h"
24+
#include "include/perms.h"
2425
#include "include/policy.h"
2526

2627
/**

0 commit comments

Comments
 (0)