Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
9a2d40c1
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9a2d40c1
编写于
1月 16, 2017
作者:
J
John Johansen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
apparmor: add strn version of aa_find_ns
Signed-off-by:
N
John Johansen
<
john.johansen@canonical.com
>
上级
1741e9eb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
6 deletion
+29
-6
security/apparmor/include/policy_ns.h
security/apparmor/include/policy_ns.h
+10
-3
security/apparmor/policy_ns.c
security/apparmor/policy_ns.c
+19
-3
未找到文件。
security/apparmor/include/policy_ns.h
浏览文件 @
9a2d40c1
...
@@ -82,6 +82,7 @@ void aa_free_root_ns(void);
...
@@ -82,6 +82,7 @@ void aa_free_root_ns(void);
void
aa_free_ns_kref
(
struct
kref
*
kref
);
void
aa_free_ns_kref
(
struct
kref
*
kref
);
struct
aa_ns
*
aa_find_ns
(
struct
aa_ns
*
root
,
const
char
*
name
);
struct
aa_ns
*
aa_find_ns
(
struct
aa_ns
*
root
,
const
char
*
name
);
struct
aa_ns
*
aa_findn_ns
(
struct
aa_ns
*
root
,
const
char
*
name
,
size_t
n
);
struct
aa_ns
*
aa_prepare_ns
(
const
char
*
name
);
struct
aa_ns
*
aa_prepare_ns
(
const
char
*
name
);
void
__aa_remove_ns
(
struct
aa_ns
*
ns
);
void
__aa_remove_ns
(
struct
aa_ns
*
ns
);
...
@@ -119,18 +120,24 @@ static inline void aa_put_ns(struct aa_ns *ns)
...
@@ -119,18 +120,24 @@ static inline void aa_put_ns(struct aa_ns *ns)
}
}
/**
/**
* __aa_find_ns - find a namespace on a list by @name
* __aa_find
n
_ns - find a namespace on a list by @name
* @head: list to search for namespace on (NOT NULL)
* @head: list to search for namespace on (NOT NULL)
* @name: name of namespace to look for (NOT NULL)
* @name: name of namespace to look for (NOT NULL)
*
*
@n: length of @name
* Returns: unrefcounted namespace
* Returns: unrefcounted namespace
*
*
* Requires: rcu_read_lock be held
* Requires: rcu_read_lock be held
*/
*/
static
inline
struct
aa_ns
*
__aa_findn_ns
(
struct
list_head
*
head
,
const
char
*
name
,
size_t
n
)
{
return
(
struct
aa_ns
*
)
__policy_strn_find
(
head
,
name
,
n
);
}
static
inline
struct
aa_ns
*
__aa_find_ns
(
struct
list_head
*
head
,
static
inline
struct
aa_ns
*
__aa_find_ns
(
struct
list_head
*
head
,
const
char
*
name
)
const
char
*
name
)
{
{
return
(
struct
aa_ns
*
)
__policy_find
(
head
,
name
);
return
__aa_findn_ns
(
head
,
name
,
strlen
(
name
)
);
}
}
#endif
/* AA_NAMESPACE_H */
#endif
/* AA_NAMESPACE_H */
security/apparmor/policy_ns.c
浏览文件 @
9a2d40c1
...
@@ -139,26 +139,42 @@ void aa_free_ns(struct aa_ns *ns)
...
@@ -139,26 +139,42 @@ void aa_free_ns(struct aa_ns *ns)
}
}
/**
/**
* aa_find_ns - look up a profile namespace on the namespace list
* aa_find
n
_ns - look up a profile namespace on the namespace list
* @root: namespace to search in (NOT NULL)
* @root: namespace to search in (NOT NULL)
* @name: name of namespace to find (NOT NULL)
* @name: name of namespace to find (NOT NULL)
* @n: length of @name
*
*
* Returns: a refcounted namespace on the list, or NULL if no namespace
* Returns: a refcounted namespace on the list, or NULL if no namespace
* called @name exists.
* called @name exists.
*
*
* refcount released by caller
* refcount released by caller
*/
*/
struct
aa_ns
*
aa_find
_ns
(
struct
aa_ns
*
root
,
const
char
*
name
)
struct
aa_ns
*
aa_find
n_ns
(
struct
aa_ns
*
root
,
const
char
*
name
,
size_t
n
)
{
{
struct
aa_ns
*
ns
=
NULL
;
struct
aa_ns
*
ns
=
NULL
;
rcu_read_lock
();
rcu_read_lock
();
ns
=
aa_get_ns
(
__aa_find
_ns
(
&
root
->
sub_ns
,
name
));
ns
=
aa_get_ns
(
__aa_find
n_ns
(
&
root
->
sub_ns
,
name
,
n
));
rcu_read_unlock
();
rcu_read_unlock
();
return
ns
;
return
ns
;
}
}
/**
* aa_find_ns - look up a profile namespace on the namespace list
* @root: namespace to search in (NOT NULL)
* @name: name of namespace to find (NOT NULL)
*
* Returns: a refcounted namespace on the list, or NULL if no namespace
* called @name exists.
*
* refcount released by caller
*/
struct
aa_ns
*
aa_find_ns
(
struct
aa_ns
*
root
,
const
char
*
name
)
{
return
aa_findn_ns
(
root
,
name
,
strlen
(
name
));
}
/**
/**
* aa_prepare_ns - find an existing or create a new namespace of @name
* aa_prepare_ns - find an existing or create a new namespace of @name
* @name: the namespace to find or add (MAYBE NULL)
* @name: the namespace to find or add (MAYBE NULL)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录