Skip to content

Commit 34ef7bd

Browse files
committed
Revert "ima: define '_ima' as a builtin 'trusted' keyring"
This reverts commit 217091d, which caused the following build error: security/integrity/digsig.c:70:5: error: redefinition of ‘integrity_init_keyring’ security/integrity/integrity.h:149:12: note: previous definition of ‘integrity_init_keyring’ w security/integrity/integrity.h:149:12: warning: ‘integrity_init_keyring’ defined but not used reported by Krzysztof Kolasa. Mimi says: "I made the classic mistake of requesting this patch to be upstreamed at the last second, rather than waiting until the next open window. At this point, the best course would probably be to revert the two commits and fix them for the next open window" Reported-by: Krzysztof Kolasa <kkolasa@winsoft.pl> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 26b265c commit 34ef7bd

4 files changed

Lines changed: 1 addition & 55 deletions

File tree

‎security/integrity/digsig.c‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,19 @@
1313
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1414

1515
#include <linux/err.h>
16-
#include <linux/sched.h>
1716
#include <linux/rbtree.h>
18-
#include <linux/cred.h>
1917
#include <linux/key-type.h>
2018
#include <linux/digsig.h>
2119

2220
#include "integrity.h"
2321

2422
static struct key *keyring[INTEGRITY_KEYRING_MAX];
2523

26-
#ifdef CONFIG_IMA_TRUSTED_KEYRING
27-
static const char *keyring_name[INTEGRITY_KEYRING_MAX] = {
28-
".evm",
29-
".module",
30-
".ima",
31-
};
32-
#else
3324
static const char *keyring_name[INTEGRITY_KEYRING_MAX] = {
3425
"_evm",
3526
"_module",
3627
"_ima",
3728
};
38-
#endif
3929

4030
int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen,
4131
const char *digest, int digestlen)
@@ -45,7 +35,7 @@ int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen,
4535

4636
if (!keyring[id]) {
4737
keyring[id] =
48-
request_key(&key_type_keyring, keyring_name[id], NULL);
38+
request_key(&key_type_keyring, keyring_name[id], NULL);
4939
if (IS_ERR(keyring[id])) {
5040
int err = PTR_ERR(keyring[id]);
5141
pr_err("no %s keyring: %d\n", keyring_name[id], err);
@@ -66,21 +56,3 @@ int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen,
6656

6757
return -EOPNOTSUPP;
6858
}
69-
70-
int integrity_init_keyring(const unsigned int id)
71-
{
72-
const struct cred *cred = current_cred();
73-
const struct user_struct *user = cred->user;
74-
75-
keyring[id] = keyring_alloc(keyring_name[id], KUIDT_INIT(0),
76-
KGIDT_INIT(0), cred,
77-
((KEY_POS_ALL & ~KEY_POS_SETATTR) |
78-
KEY_USR_VIEW | KEY_USR_READ),
79-
KEY_ALLOC_NOT_IN_QUOTA, user->uid_keyring);
80-
if (!IS_ERR(keyring[id]))
81-
set_bit(KEY_FLAG_TRUSTED_ONLY, &keyring[id]->flags);
82-
else
83-
pr_info("Can't allocate %s keyring (%ld)\n",
84-
keyring_name[id], PTR_ERR(keyring[id]));
85-
return 0;
86-
}

‎security/integrity/ima/Kconfig‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,3 @@ config IMA_APPRAISE
123123
For more information on integrity appraisal refer to:
124124
<http://linux-ima.sourceforge.net>
125125
If unsure, say N.
126-
127-
config IMA_TRUSTED_KEYRING
128-
bool "Require all keys on the _ima keyring be signed"
129-
depends on IMA_APPRAISE && SYSTEM_TRUSTED_KEYRING
130-
default y
131-
help
132-
This option requires that all keys added to the _ima
133-
keyring be signed by a key on the system trusted keyring.

‎security/integrity/ima/ima_appraise.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,3 @@ int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name)
381381
}
382382
return result;
383383
}
384-
385-
#ifdef CONFIG_IMA_TRUSTED_KEYRING
386-
static int __init init_ima_keyring(void)
387-
{
388-
int ret;
389-
390-
ret = integrity_init_keyring(INTEGRITY_KEYRING_IMA);
391-
return 0;
392-
}
393-
late_initcall(init_ima_keyring);
394-
#endif

‎security/integrity/integrity.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,12 @@ static inline int integrity_digsig_verify(const unsigned int id,
137137
#ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS
138138
int asymmetric_verify(struct key *keyring, const char *sig,
139139
int siglen, const char *data, int datalen);
140-
141-
int integrity_init_keyring(const unsigned int id);
142140
#else
143141
static inline int asymmetric_verify(struct key *keyring, const char *sig,
144142
int siglen, const char *data, int datalen)
145143
{
146144
return -EOPNOTSUPP;
147145
}
148-
149-
static int integrity_init_keyring(const unsigned int id)
150-
{
151-
return 0;
152-
}
153146
#endif
154147

155148
#ifdef CONFIG_INTEGRITY_AUDIT

0 commit comments

Comments
 (0)