[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1520454869-13871-2-git-send-email-longman@redhat.com>
Date: Wed, 7 Mar 2018 15:34:25 -0500
From: Waiman Long <longman@...hat.com>
To: "Luis R. Rodriguez" <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Matthew Wilcox <willy@...radead.org>,
Waiman Long <longman@...hat.com>
Subject: [PATCH 1/5] sysctl: Clarify how the ctl_table.flags should be set
Additional comments are added to clarify how the ctl_table.flags
field should be set as well as precaution on what needs to be done
when additional flags are defined in the future.
Signed-off-by: Waiman Long <longman@...hat.com>
---
include/linux/sysctl.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 3db57af..bc09361 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -125,7 +125,7 @@ struct ctl_table
} __randomize_layout;
/**
- * enum ctl_table_flags - flags for the ctl table
+ * enum ctl_table_flags - flags for the ctl table (struct ctl_table.flags)
*
* @CTL_FLAGS_CLAMP_RANGE: Set to indicate that the entry should be
* flexibly clamped to min/max range in case the user provided
@@ -134,10 +134,23 @@ struct ctl_table
* had been issued for that entry.
*
* At most 16 different flags will be allowed.
+ *
+ * The flags can be set in two different ways. They can either be
+ * statically set at definition time or dynamically set at run time.
+ *
+ * Currently, only the CTL_FLAGS_OOR_WARNED flag is set at run time.
+ * No locking or atomic access to set @CTL_FLAGS_OOR_WARNED is needed
+ * in the current use case. If similar dynamic flags are defined in the
+ * future, we may need to revisit again to see if atomic access or
+ * locking is needed to prevent lost changes due to concurrent updates
+ * to the flags field.
*/
enum ctl_table_flags {
+ /* Statically set flags */
CTL_FLAGS_CLAMP_RANGE = BIT(0),
- CTL_FLAGS_OOR_WARNED = BIT(1),
+
+ /* Flags set at run time */
+ CTL_FLAGS_OOR_WARNED = BIT(8),
};
struct ctl_node {
--
1.8.3.1
Powered by blists - more mailing lists