Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
93b9c98b
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
93b9c98b
编写于
3月 30, 2011
作者:
J
James Morris
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'next-queue' into next
上级
efb3bb4f
58068960
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
66 addition
and
29 deletion
+66
-29
include/linux/key.h
include/linux/key.h
+13
-0
net/dns_resolver/dns_key.c
net/dns_resolver/dns_key.c
+6
-4
security/Kconfig
security/Kconfig
+1
-0
security/keys/internal.h
security/keys/internal.h
+3
-1
security/keys/keyctl.c
security/keys/keyctl.c
+6
-0
security/keys/keyring.c
security/keys/keyring.c
+24
-13
security/keys/proc.c
security/keys/proc.c
+1
-1
security/keys/process_keys.c
security/keys/process_keys.c
+7
-5
security/keys/request_key.c
security/keys/request_key.c
+1
-2
security/keys/request_key_auth.c
security/keys/request_key_auth.c
+2
-1
security/keys/user_defined.c
security/keys/user_defined.c
+2
-2
未找到文件。
include/linux/key.h
浏览文件 @
93b9c98b
...
...
@@ -276,6 +276,19 @@ static inline key_serial_t key_serial(struct key *key)
return
key
?
key
->
serial
:
0
;
}
/**
* key_is_instantiated - Determine if a key has been positively instantiated
* @key: The key to check.
*
* Return true if the specified key has been positively instantiated, false
* otherwise.
*/
static
inline
bool
key_is_instantiated
(
const
struct
key
*
key
)
{
return
test_bit
(
KEY_FLAG_INSTANTIATED
,
&
key
->
flags
)
&&
!
test_bit
(
KEY_FLAG_NEGATIVE
,
&
key
->
flags
);
}
#define rcu_dereference_key(KEY) \
(rcu_dereference_protected((KEY)->payload.rcudata, \
rwsem_is_locked(&((struct key *)(KEY))->sem)))
...
...
net/dns_resolver/dns_key.c
浏览文件 @
93b9c98b
...
...
@@ -212,10 +212,12 @@ static void dns_resolver_describe(const struct key *key, struct seq_file *m)
int
err
=
key
->
type_data
.
x
[
0
];
seq_puts
(
m
,
key
->
description
);
if
(
err
)
seq_printf
(
m
,
": %d"
,
err
);
else
seq_printf
(
m
,
": %u"
,
key
->
datalen
);
if
(
key_is_instantiated
(
key
))
{
if
(
err
)
seq_printf
(
m
,
": %d"
,
err
);
else
seq_printf
(
m
,
": %u"
,
key
->
datalen
);
}
}
/*
...
...
security/Kconfig
浏览文件 @
93b9c98b
...
...
@@ -167,6 +167,7 @@ config INTEL_TXT
config
LSM_MMAP_MIN_ADDR
int
"Low address space for LSM to protect from user allocation"
depends
on
SECURITY
&&
SECURITY_SELINUX
default
32768
if
ARM
default
65536
help
This
is
the
portion
of
low
virtual
memory
which
should
be
protected
...
...
security/keys/internal.h
浏览文件 @
93b9c98b
...
...
@@ -109,11 +109,13 @@ extern key_ref_t keyring_search_aux(key_ref_t keyring_ref,
const
struct
cred
*
cred
,
struct
key_type
*
type
,
const
void
*
description
,
key_match_func_t
match
);
key_match_func_t
match
,
bool
no_state_check
);
extern
key_ref_t
search_my_process_keyrings
(
struct
key_type
*
type
,
const
void
*
description
,
key_match_func_t
match
,
bool
no_state_check
,
const
struct
cred
*
cred
);
extern
key_ref_t
search_process_keyrings
(
struct
key_type
*
type
,
const
void
*
description
,
...
...
security/keys/keyctl.c
浏览文件 @
93b9c98b
...
...
@@ -206,8 +206,14 @@ SYSCALL_DEFINE4(request_key, const char __user *, _type,
goto
error5
;
}
/* wait for the key to finish being constructed */
ret
=
wait_for_key_construction
(
key
,
1
);
if
(
ret
<
0
)
goto
error6
;
ret
=
key
->
serial
;
error6:
key_put
(
key
);
error5:
key_type_put
(
ktype
);
...
...
security/keys/keyring.c
浏览文件 @
93b9c98b
...
...
@@ -176,13 +176,15 @@ static void keyring_describe(const struct key *keyring, struct seq_file *m)
else
seq_puts
(
m
,
"[anon]"
);
rcu_read_lock
();
klist
=
rcu_dereference
(
keyring
->
payload
.
subscriptions
);
if
(
klist
)
seq_printf
(
m
,
": %u/%u"
,
klist
->
nkeys
,
klist
->
maxkeys
);
else
seq_puts
(
m
,
": empty"
);
rcu_read_unlock
();
if
(
key_is_instantiated
(
keyring
))
{
rcu_read_lock
();
klist
=
rcu_dereference
(
keyring
->
payload
.
subscriptions
);
if
(
klist
)
seq_printf
(
m
,
": %u/%u"
,
klist
->
nkeys
,
klist
->
maxkeys
);
else
seq_puts
(
m
,
": empty"
);
rcu_read_unlock
();
}
}
/*
...
...
@@ -271,6 +273,7 @@ struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
* @type: The type of key to search for.
* @description: Parameter for @match.
* @match: Function to rule on whether or not a key is the one required.
* @no_state_check: Don't check if a matching key is bad
*
* Search the supplied keyring tree for a key that matches the criteria given.
* The root keyring and any linked keyrings must grant Search permission to the
...
...
@@ -303,7 +306,8 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
const
struct
cred
*
cred
,
struct
key_type
*
type
,
const
void
*
description
,
key_match_func_t
match
)
key_match_func_t
match
,
bool
no_state_check
)
{
struct
{
struct
keyring_list
*
keylist
;
...
...
@@ -345,6 +349,8 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
kflags
=
keyring
->
flags
;
if
(
keyring
->
type
==
type
&&
match
(
keyring
,
description
))
{
key
=
keyring
;
if
(
no_state_check
)
goto
found
;
/* check it isn't negative and hasn't expired or been
* revoked */
...
...
@@ -384,11 +390,13 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
continue
;
/* skip revoked keys and expired keys */
if
(
kflags
&
(
1
<<
KEY_FLAG_REVOKED
))
continue
;
if
(
!
no_state_check
)
{
if
(
kflags
&
(
1
<<
KEY_FLAG_REVOKED
))
continue
;
if
(
key
->
expiry
&&
now
.
tv_sec
>=
key
->
expiry
)
continue
;
if
(
key
->
expiry
&&
now
.
tv_sec
>=
key
->
expiry
)
continue
;
}
/* keys that don't match */
if
(
!
match
(
key
,
description
))
...
...
@@ -399,6 +407,9 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
cred
,
KEY_SEARCH
)
<
0
)
continue
;
if
(
no_state_check
)
goto
found
;
/* we set a different error code if we pass a negative key */
if
(
kflags
&
(
1
<<
KEY_FLAG_NEGATIVE
))
{
err
=
key
->
type_data
.
reject_error
;
...
...
@@ -478,7 +489,7 @@ key_ref_t keyring_search(key_ref_t keyring,
return
ERR_PTR
(
-
ENOKEY
);
return
keyring_search_aux
(
keyring
,
current
->
cred
,
type
,
description
,
type
->
match
);
type
,
description
,
type
->
match
,
false
);
}
EXPORT_SYMBOL
(
keyring_search
);
...
...
security/keys/proc.c
浏览文件 @
93b9c98b
...
...
@@ -199,7 +199,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
if
(
key
->
perm
&
KEY_POS_VIEW
)
{
skey_ref
=
search_my_process_keyrings
(
key
->
type
,
key
,
lookup_user_key_possessed
,
cred
);
true
,
cred
);
if
(
!
IS_ERR
(
skey_ref
))
{
key_ref_put
(
skey_ref
);
key_ref
=
make_key_ref
(
key
,
1
);
...
...
security/keys/process_keys.c
浏览文件 @
93b9c98b
...
...
@@ -331,6 +331,7 @@ void key_fsgid_changed(struct task_struct *tsk)
key_ref_t
search_my_process_keyrings
(
struct
key_type
*
type
,
const
void
*
description
,
key_match_func_t
match
,
bool
no_state_check
,
const
struct
cred
*
cred
)
{
key_ref_t
key_ref
,
ret
,
err
;
...
...
@@ -350,7 +351,7 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
if
(
cred
->
thread_keyring
)
{
key_ref
=
keyring_search_aux
(
make_key_ref
(
cred
->
thread_keyring
,
1
),
cred
,
type
,
description
,
match
);
cred
,
type
,
description
,
match
,
no_state_check
);
if
(
!
IS_ERR
(
key_ref
))
goto
found
;
...
...
@@ -371,7 +372,7 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
if
(
cred
->
tgcred
->
process_keyring
)
{
key_ref
=
keyring_search_aux
(
make_key_ref
(
cred
->
tgcred
->
process_keyring
,
1
),
cred
,
type
,
description
,
match
);
cred
,
type
,
description
,
match
,
no_state_check
);
if
(
!
IS_ERR
(
key_ref
))
goto
found
;
...
...
@@ -395,7 +396,7 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
make_key_ref
(
rcu_dereference
(
cred
->
tgcred
->
session_keyring
),
1
),
cred
,
type
,
description
,
match
);
cred
,
type
,
description
,
match
,
no_state_check
);
rcu_read_unlock
();
if
(
!
IS_ERR
(
key_ref
))
...
...
@@ -417,7 +418,7 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
else
if
(
cred
->
user
->
session_keyring
)
{
key_ref
=
keyring_search_aux
(
make_key_ref
(
cred
->
user
->
session_keyring
,
1
),
cred
,
type
,
description
,
match
);
cred
,
type
,
description
,
match
,
no_state_check
);
if
(
!
IS_ERR
(
key_ref
))
goto
found
;
...
...
@@ -459,7 +460,8 @@ key_ref_t search_process_keyrings(struct key_type *type,
might_sleep
();
key_ref
=
search_my_process_keyrings
(
type
,
description
,
match
,
cred
);
key_ref
=
search_my_process_keyrings
(
type
,
description
,
match
,
false
,
cred
);
if
(
!
IS_ERR
(
key_ref
))
goto
found
;
err
=
key_ref
;
...
...
security/keys/request_key.c
浏览文件 @
93b9c98b
...
...
@@ -530,8 +530,7 @@ struct key *request_key_and_link(struct key_type *type,
dest_keyring
,
flags
);
/* search all the process keyrings for a key */
key_ref
=
search_process_keyrings
(
type
,
description
,
type
->
match
,
cred
);
key_ref
=
search_process_keyrings
(
type
,
description
,
type
->
match
,
cred
);
if
(
!
IS_ERR
(
key_ref
))
{
key
=
key_ref_to_ptr
(
key_ref
);
...
...
security/keys/request_key_auth.c
浏览文件 @
93b9c98b
...
...
@@ -59,7 +59,8 @@ static void request_key_auth_describe(const struct key *key,
seq_puts
(
m
,
"key:"
);
seq_puts
(
m
,
key
->
description
);
seq_printf
(
m
,
" pid:%d ci:%zu"
,
rka
->
pid
,
rka
->
callout_len
);
if
(
key_is_instantiated
(
key
))
seq_printf
(
m
,
" pid:%d ci:%zu"
,
rka
->
pid
,
rka
->
callout_len
);
}
/*
...
...
security/keys/user_defined.c
浏览文件 @
93b9c98b
...
...
@@ -169,8 +169,8 @@ EXPORT_SYMBOL_GPL(user_destroy);
void
user_describe
(
const
struct
key
*
key
,
struct
seq_file
*
m
)
{
seq_puts
(
m
,
key
->
description
);
seq_printf
(
m
,
": %u"
,
key
->
datalen
);
if
(
key_is_instantiated
(
key
))
seq_printf
(
m
,
": %u"
,
key
->
datalen
);
}
EXPORT_SYMBOL_GPL
(
user_describe
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录