summaryrefslogtreecommitdiffstats
path: root/security/tomoyo
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 13:30:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 13:30:44 -0500
commit55b3a0cb5aeef0961ee18eac058e488f149a0053 (patch)
treeb8ac5161349f5e5dea8b2a29842fe43ee78f23a2 /security/tomoyo
parentdee02770cdcd8bc06a48c917ce5df2fb56cf6059 (diff)
parent34d8751fd4ffa34e85ee7e85d34168b3f3f62b42 (diff)
Merge branch 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull general security subsystem updates from James Morris: "TPM (from Jarkko): - essential clean up for tpm_crb so that ARM64 and x86 versions do not distract each other as much as before - /dev/tpm0 rejects now too short writes (shorter buffer than specified in the command header - use DMA-safe buffer in tpm_tis_spi - otherwise mostly minor fixes. Smack: - base support for overlafs Capabilities: - BPRM_FCAPS fixes, from Richard Guy Briggs: The audit subsystem is adding a BPRM_FCAPS record when auditing setuid application execution (SYSCALL execve). This is not expected as it was supposed to be limited to when the file system actually had capabilities in an extended attribute. It lists all capabilities making the event really ugly to parse what is happening. The PATH record correctly records the setuid bit and owner. Suppress the BPRM_FCAPS record on set*id. TOMOYO: - Y2038 timestamping fixes" * 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (28 commits) MAINTAINERS: update the IMA, EVM, trusted-keys, encrypted-keys entries Smack: Base support for overlayfs MAINTAINERS: remove David Safford as maintainer for encrypted+trusted keys tomoyo: fix timestamping for y2038 capabilities: audit log other surprising conditions capabilities: fix logic for effective root or real root capabilities: invert logic for clarity capabilities: remove a layer of conditional logic capabilities: move audit log decision to function capabilities: use intuitive names for id changes capabilities: use root_priveleged inline to clarify logic capabilities: rename has_cap to has_fcap capabilities: intuitive names for cap gain status capabilities: factor out cap_bprm_set_creds privileged root tpm, tpm_tis: use ARRAY_SIZE() to define TPM_HID_USR_IDX tpm: fix duplicate inline declaration specifier tpm: fix type of a local variables in tpm_tis_spi.c tpm: fix type of a local variable in tpm2_map_command() tpm: fix type of a local variable in tpm2_get_cc_attrs_tbl() tpm-dev-common: Reject too short writes ...
Diffstat (limited to 'security/tomoyo')
-rw-r--r--security/tomoyo/audit.c2
-rw-r--r--security/tomoyo/common.c4
-rw-r--r--security/tomoyo/common.h2
-rw-r--r--security/tomoyo/util.c39
4 files changed, 13 insertions, 34 deletions
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index d330b060dcff..0f73fe30e37a 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -157,7 +157,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
157 if (!buffer) 157 if (!buffer)
158 return NULL; 158 return NULL;
159 159
160 tomoyo_convert_time(get_seconds(), &stamp); 160 tomoyo_convert_time(ktime_get_real_seconds(), &stamp);
161 161
162 pos = snprintf(buffer, tomoyo_buffer_len - 1, 162 pos = snprintf(buffer, tomoyo_buffer_len - 1,
163 "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s " 163 "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s "
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 21691b99e61f..25eed4b0b0e8 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -2257,7 +2257,7 @@ static const char * const tomoyo_memory_headers[TOMOYO_MAX_MEMORY_STAT] = {
2257/* Timestamp counter for last updated. */ 2257/* Timestamp counter for last updated. */
2258static unsigned int tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT]; 2258static unsigned int tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT];
2259/* Counter for number of updates. */ 2259/* Counter for number of updates. */
2260static unsigned int tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT]; 2260static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT];
2261 2261
2262/** 2262/**
2263 * tomoyo_update_stat - Update statistic counters. 2263 * tomoyo_update_stat - Update statistic counters.
@@ -2272,7 +2272,7 @@ void tomoyo_update_stat(const u8 index)
2272 * I don't use atomic operations because race condition is not fatal. 2272 * I don't use atomic operations because race condition is not fatal.
2273 */ 2273 */
2274 tomoyo_stat_updated[index]++; 2274 tomoyo_stat_updated[index]++;
2275 tomoyo_stat_modified[index] = get_seconds(); 2275 tomoyo_stat_modified[index] = ktime_get_real_seconds();
2276} 2276}
2277 2277
2278/** 2278/**
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index e4097d7994b1..7adccdd8e36d 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -1037,7 +1037,7 @@ void tomoyo_check_acl(struct tomoyo_request_info *r,
1037 bool (*check_entry) (struct tomoyo_request_info *, 1037 bool (*check_entry) (struct tomoyo_request_info *,
1038 const struct tomoyo_acl_info *)); 1038 const struct tomoyo_acl_info *));
1039void tomoyo_check_profile(void); 1039void tomoyo_check_profile(void);
1040void tomoyo_convert_time(time_t time, struct tomoyo_time *stamp); 1040void tomoyo_convert_time(time64_t time, struct tomoyo_time *stamp);
1041void tomoyo_del_condition(struct list_head *element); 1041void tomoyo_del_condition(struct list_head *element);
1042void tomoyo_fill_path_info(struct tomoyo_path_info *ptr); 1042void tomoyo_fill_path_info(struct tomoyo_path_info *ptr);
1043void tomoyo_get_attributes(struct tomoyo_obj_info *obj); 1043void tomoyo_get_attributes(struct tomoyo_obj_info *obj);
diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c
index 580b318910f1..d3d9d9f1edb0 100644
--- a/security/tomoyo/util.c
+++ b/security/tomoyo/util.c
@@ -87,38 +87,17 @@ const u8 tomoyo_index2category[TOMOYO_MAX_MAC_INDEX] = {
87 * @stamp: Pointer to "struct tomoyo_time". 87 * @stamp: Pointer to "struct tomoyo_time".
88 * 88 *
89 * Returns nothing. 89 * Returns nothing.
90 *
91 * This function does not handle Y2038 problem.
92 */ 90 */
93void tomoyo_convert_time(time_t time, struct tomoyo_time *stamp) 91void tomoyo_convert_time(time64_t time64, struct tomoyo_time *stamp)
94{ 92{
95 static const u16 tomoyo_eom[2][12] = { 93 struct tm tm;
96 { 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, 94 time64_to_tm(time64, 0, &tm);
97 { 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } 95 stamp->sec = tm.tm_sec;
98 }; 96 stamp->min = tm.tm_min;
99 u16 y; 97 stamp->hour = tm.tm_hour;
100 u8 m; 98 stamp->day = tm.tm_mday;
101 bool r; 99 stamp->month = tm.tm_mon + 1;
102 stamp->sec = time % 60; 100 stamp->year = tm.tm_year + 1900;
103 time /= 60;
104 stamp->min = time % 60;
105 time /= 60;
106 stamp->hour = time % 24;
107 time /= 24;
108 for (y = 1970; ; y++) {
109 const unsigned short days = (y & 3) ? 365 : 366;
110 if (time < days)
111 break;
112 time -= days;
113 }
114 r = (y & 3) == 0;
115 for (m = 0; m < 11 && time >= tomoyo_eom[r][m]; m++)
116 ;
117 if (m)
118 time -= tomoyo_eom[r][m - 1];
119 stamp->year = y;
120 stamp->month = ++m;
121 stamp->day = ++time;
122} 101}
123 102
124/** 103/**