@@ -44,7 +44,7 @@ static void report_load(const char *origin, struct file *file, char *operation)
44
44
kfree (pathname );
45
45
}
46
46
47
- static int enabled = IS_ENABLED (CONFIG_SECURITY_LOADPIN_ENABLED );
47
+ static int enforce = IS_ENABLED (CONFIG_SECURITY_LOADPIN_ENFORCE );
48
48
static struct super_block * pinned_root ;
49
49
static DEFINE_SPINLOCK (pinned_root_spinlock );
50
50
@@ -60,8 +60,8 @@ static struct ctl_path loadpin_sysctl_path[] = {
60
60
61
61
static struct ctl_table loadpin_sysctl_table [] = {
62
62
{
63
- .procname = "enabled " ,
64
- .data = & enabled ,
63
+ .procname = "enforce " ,
64
+ .data = & enforce ,
65
65
.maxlen = sizeof (int ),
66
66
.mode = 0644 ,
67
67
.proc_handler = proc_dointvec_minmax ,
@@ -84,8 +84,11 @@ static void check_pinning_enforcement(struct super_block *mnt_sb)
84
84
* device, allow sysctl to change modes for testing.
85
85
*/
86
86
if (mnt_sb -> s_bdev ) {
87
+ char bdev [BDEVNAME_SIZE ];
88
+
87
89
ro = bdev_read_only (mnt_sb -> s_bdev );
88
- pr_info ("dev(%u,%u): %s\n" ,
90
+ bdevname (mnt_sb -> s_bdev , bdev );
91
+ pr_info ("%s (%u:%u): %s\n" , bdev ,
89
92
MAJOR (mnt_sb -> s_bdev -> bd_dev ),
90
93
MINOR (mnt_sb -> s_bdev -> bd_dev ),
91
94
ro ? "read-only" : "writable" );
@@ -97,7 +100,7 @@ static void check_pinning_enforcement(struct super_block *mnt_sb)
97
100
loadpin_sysctl_table ))
98
101
pr_notice ("sysctl registration failed!\n" );
99
102
else
100
- pr_info ("load pinning can be disabled.\n" );
103
+ pr_info ("enforcement can be disabled.\n" );
101
104
} else
102
105
pr_info ("load pinning engaged.\n" );
103
106
}
@@ -128,7 +131,7 @@ static int loadpin_read_file(struct file *file, enum kernel_read_file_id id)
128
131
129
132
/* This handles the older init_module API that has a NULL file. */
130
133
if (!file ) {
131
- if (!enabled ) {
134
+ if (!enforce ) {
132
135
report_load (origin , NULL , "old-api-pinning-ignored" );
133
136
return 0 ;
134
137
}
@@ -151,7 +154,7 @@ static int loadpin_read_file(struct file *file, enum kernel_read_file_id id)
151
154
* Unlock now since it's only pinned_root we care about.
152
155
* In the worst case, we will (correctly) report pinning
153
156
* failures before we have announced that pinning is
154
- * enabled . This would be purely cosmetic.
157
+ * enforcing . This would be purely cosmetic.
155
158
*/
156
159
spin_unlock (& pinned_root_spinlock );
157
160
check_pinning_enforcement (pinned_root );
@@ -161,7 +164,7 @@ static int loadpin_read_file(struct file *file, enum kernel_read_file_id id)
161
164
}
162
165
163
166
if (IS_ERR_OR_NULL (pinned_root ) || load_root != pinned_root ) {
164
- if (unlikely (!enabled )) {
167
+ if (unlikely (!enforce )) {
165
168
report_load (origin , file , "pinning-ignored" );
166
169
return 0 ;
167
170
}
@@ -186,10 +189,11 @@ static struct security_hook_list loadpin_hooks[] __lsm_ro_after_init = {
186
189
187
190
void __init loadpin_add_hooks (void )
188
191
{
189
- pr_info ("ready to pin (currently %sabled)" , enabled ? "en" : "dis" );
192
+ pr_info ("ready to pin (currently %senforcing)\n" ,
193
+ enforce ? "" : "not " );
190
194
security_add_hooks (loadpin_hooks , ARRAY_SIZE (loadpin_hooks ), "loadpin" );
191
195
}
192
196
193
197
/* Should not be mutable after boot, so not listed in sysfs (perm == 0). */
194
- module_param (enabled , int , 0 );
195
- MODULE_PARM_DESC (enabled , "Pin module/firmware loading (default: true) " );
198
+ module_param (enforce , int , 0 );
199
+ MODULE_PARM_DESC (enforce , "Enforce module/firmware pinning " );
0 commit comments