aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/uapi/linux/audit.h3
-rw-r--r--kernel/audit.c3
-rw-r--r--kernel/auditsc.c3
3 files changed, 7 insertions, 2 deletions
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 05e5e8fc2ac4..e2f0d9977131 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -387,7 +387,8 @@ struct audit_features {
387}; 387};
388 388
389#define AUDIT_FEATURE_ONLY_UNSET_LOGINUID 0 389#define AUDIT_FEATURE_ONLY_UNSET_LOGINUID 0
390#define AUDIT_LAST_FEATURE AUDIT_FEATURE_ONLY_UNSET_LOGINUID 390#define AUDIT_FEATURE_LOGINUID_IMMUTABLE 1
391#define AUDIT_LAST_FEATURE AUDIT_FEATURE_LOGINUID_IMMUTABLE
391 392
392#define audit_feature_valid(x) ((x) >= 0 && (x) <= AUDIT_LAST_FEATURE) 393#define audit_feature_valid(x) ((x) >= 0 && (x) <= AUDIT_LAST_FEATURE)
393#define AUDIT_FEATURE_TO_MASK(x) (1 << ((x) & 31)) /* mask for __u32 */ 394#define AUDIT_FEATURE_TO_MASK(x) (1 << ((x) & 31)) /* mask for __u32 */
diff --git a/kernel/audit.c b/kernel/audit.c
index fbfa3a74decb..f3f36f5eb4ae 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -144,8 +144,9 @@ static struct audit_features af = {.vers = AUDIT_FEATURE_VERSION,
144 .features = 0, 144 .features = 0,
145 .lock = 0,}; 145 .lock = 0,};
146 146
147static char *audit_feature_names[1] = { 147static char *audit_feature_names[2] = {
148 "only_unset_loginuid", 148 "only_unset_loginuid",
149 "loginuid_immutable",
149}; 150};
150 151
151 152
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 924c0bf048d2..63223d671a6e 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1971,6 +1971,9 @@ static int audit_set_loginuid_perm(kuid_t loginuid)
1971 /* if we are unset, we don't need privs */ 1971 /* if we are unset, we don't need privs */
1972 if (!audit_loginuid_set(current)) 1972 if (!audit_loginuid_set(current))
1973 return 0; 1973 return 0;
1974 /* if AUDIT_FEATURE_LOGINUID_IMMUTABLE means never ever allow a change*/
1975 if (is_audit_feature_set(AUDIT_FEATURE_LOGINUID_IMMUTABLE))
1976 return -EPERM;
1974 /* it is set, you need permission */ 1977 /* it is set, you need permission */
1975 if (!capable(CAP_AUDIT_CONTROL)) 1978 if (!capable(CAP_AUDIT_CONTROL))
1976 return -EPERM; 1979 return -EPERM;