• R/O
  • SSH
  • HTTPS

caitsith: 提交


Commit MetaInfo

修訂295 (tree)
時間2020-01-02 17:22:00
作者kumaneko

Log Message

(empty log message)

Change Summary

差異

--- trunk/caitsith-patch/caitsith/policy_io.c (revision 294)
+++ trunk/caitsith-patch/caitsith/policy_io.c (revision 295)
@@ -1195,7 +1195,7 @@
11951195 struct list_head cs_name_list[CS_MAX_HASH];
11961196
11971197 /* Counter for number of updates. */
1198-static unsigned int cs_stat_updated[CS_MAX_POLICY_STAT];
1198+static atomic_t cs_stat_updated[CS_MAX_POLICY_STAT];
11991199
12001200 /* Timestamp counter for last updated. */
12011201 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
@@ -3178,10 +3178,7 @@
31783178 */
31793179 static void cs_update_stat(const u8 index)
31803180 {
3181- /*
3182- * I don't use atomic operations because race condition is not fatal.
3183- */
3184- cs_stat_updated[index]++;
3181+ atomic_inc(&cs_stat_updated[index]);
31853182 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
31863183 cs_stat_modified[index] = get_seconds();
31873184 #else
@@ -3206,7 +3203,8 @@
32063203 [CS_STAT_REQUEST_DENIED] = "Requests denied:",
32073204 };
32083205
3209- cs_io_printf(head, "stat %s %u", k[i], cs_stat_updated[i]);
3206+ cs_io_printf(head, "stat %s %u", k[i],
3207+ atomic_read(&cs_stat_updated[i]));
32103208 if (cs_stat_modified[i]) {
32113209 struct cs_time stamp;
32123210
--- trunk/caitsith-patch/security/caitsith/policy_io.c (revision 294)
+++ trunk/caitsith-patch/security/caitsith/policy_io.c (revision 295)
@@ -1238,7 +1238,7 @@
12381238 struct list_head cs_name_list[CS_MAX_HASH];
12391239
12401240 /* Counter for number of updates. */
1241-static unsigned int cs_stat_updated[CS_MAX_POLICY_STAT];
1241+static atomic_t cs_stat_updated[CS_MAX_POLICY_STAT];
12421242
12431243 /* Timestamp counter for last updated. */
12441244 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
@@ -3215,10 +3215,7 @@
32153215 */
32163216 static void cs_update_stat(const u8 index)
32173217 {
3218- /*
3219- * I don't use atomic operations because race condition is not fatal.
3220- */
3221- cs_stat_updated[index]++;
3218+ atomic_inc(&cs_stat_updated[index]);
32223219 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
32233220 cs_stat_modified[index] = get_seconds();
32243221 #else
@@ -3242,7 +3239,9 @@
32423239 [CS_STAT_POLICY_UPDATES] = "Policy updated:",
32433240 [CS_STAT_REQUEST_DENIED] = "Requests denied:",
32443241 };
3245- cs_io_printf(head, "stat %s %u", k[i], cs_stat_updated[i]);
3242+
3243+ cs_io_printf(head, "stat %s %u", k[i],
3244+ atomic_read(&cs_stat_updated[i]));
32463245 if (cs_stat_modified[i]) {
32473246 struct cs_time stamp;
32483247
Show on old repository browser