Skip to content

Commit dabd39c

Browse files
committed
KEYS: Make /proc/keys unconditional if CONFIG_KEYS=y
Now that /proc/keys is used by libkeyutils to look up a key by type and description, we should make it unconditional and remove CONFIG_DEBUG_PROC_KEYS. Reported-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Jiri Kosina <jkosina@suse.cz>
1 parent 961be7e commit dabd39c

3 files changed

Lines changed: 0 additions & 28 deletions

File tree

‎Documentation/security/keys.txt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ about the status of the key service:
323323
U Under construction by callback to userspace
324324
N Negative key
325325

326-
This file must be enabled at kernel configuration time as it allows anyone
327-
to list the keys database.
328326

329327
(*) /proc/key-users
330328

‎security/keys/Kconfig‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,3 @@ config ENCRYPTED_KEYS
8080
Userspace only ever sees/stores encrypted blobs.
8181

8282
If you are unsure as to whether this is required, answer N.
83-
84-
config KEYS_DEBUG_PROC_KEYS
85-
bool "Enable the /proc/keys file by which keys may be viewed"
86-
depends on KEYS
87-
help
88-
This option turns on support for the /proc/keys file - through which
89-
can be listed all the keys on the system that are viewable by the
90-
reading process.
91-
92-
The only keys included in the list are those that grant View
93-
permission to the reading process whether or not it possesses them.
94-
Note that LSM security checks are still performed, and may further
95-
filter out keys that the current process is not authorised to view.
96-
97-
Only key attributes are listed here; key payloads are not included in
98-
the resulting table.
99-
100-
If you are unsure as to whether this is required, answer N.

‎security/keys/proc.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <asm/errno.h>
1919
#include "internal.h"
2020

21-
#ifdef CONFIG_KEYS_DEBUG_PROC_KEYS
2221
static int proc_keys_open(struct inode *inode, struct file *file);
2322
static void *proc_keys_start(struct seq_file *p, loff_t *_pos);
2423
static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos);
@@ -38,7 +37,6 @@ static const struct file_operations proc_keys_fops = {
3837
.llseek = seq_lseek,
3938
.release = seq_release,
4039
};
41-
#endif
4240

4341
static int proc_key_users_open(struct inode *inode, struct file *file);
4442
static void *proc_key_users_start(struct seq_file *p, loff_t *_pos);
@@ -67,11 +65,9 @@ static int __init key_proc_init(void)
6765
{
6866
struct proc_dir_entry *p;
6967

70-
#ifdef CONFIG_KEYS_DEBUG_PROC_KEYS
7168
p = proc_create("keys", 0, NULL, &proc_keys_fops);
7269
if (!p)
7370
panic("Cannot create /proc/keys\n");
74-
#endif
7571

7672
p = proc_create("key-users", 0, NULL, &proc_key_users_fops);
7773
if (!p)
@@ -86,8 +82,6 @@ __initcall(key_proc_init);
8682
* Implement "/proc/keys" to provide a list of the keys on the system that
8783
* grant View permission to the caller.
8884
*/
89-
#ifdef CONFIG_KEYS_DEBUG_PROC_KEYS
90-
9185
static struct rb_node *key_serial_next(struct seq_file *p, struct rb_node *n)
9286
{
9387
struct user_namespace *user_ns = seq_user_ns(p);
@@ -275,8 +269,6 @@ static int proc_keys_show(struct seq_file *m, void *v)
275269
return 0;
276270
}
277271

278-
#endif /* CONFIG_KEYS_DEBUG_PROC_KEYS */
279-
280272
static struct rb_node *__key_user_next(struct user_namespace *user_ns, struct rb_node *n)
281273
{
282274
while (n) {

0 commit comments

Comments
 (0)