forked from Minki/linux
Two bugfix patches for 5.5.
tomoyo: Suppress RCU warning at list_for_each_entry_rcu(). tomoyo: Don't use nifty names on sockets. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJeCqRMAAoJEEJfEo0MZPUqmRoQAJdWfsAObzNRq8VsiZJTQ7NV Y4Nz1QYAUMjsSnWCTY1iI/9a4SY7zOmlGoCO9pC4leGeV/H9FCp+flBVBs6nEiQF A/bRT9P9ek3urr+kOj1A9udxRRXQdQ292TVd9Ll7fJuamLHsLAQSTht27SdJyStQ FY5COJCTC3Qvoz/jdkqQ1qEyYUavH6FvNjN9eIsjLow6BahHzDj/sw6WC/iUQhOC 55mK10bN7jHvewRsrW5HLQ0aUazz/6FTZIuVckFpk/R67aljEIsMccAeYw7XeBWS a4AqI5a+8Go8ryXeM6y76JF3SnWpX9PZYLMYZz2SYkohBbl+ivVKJZOWEOQPhYTO wFAFSwZVA4uEsYEQF7qWGsQGMS/QR1tre2na4dWjpSZ0Ly2xX81tcjEhVYq6jsuk 1MGHTDCc93dMJW8OKx31CRRr9mIkJ4C1pJqQzlApjkqxUMq3Bxdidc4WOshB20y6 cLf1nfIor4/8VBb8LdBICPcedfHWk3KY6nL5yTqUjtETln7Ba/UeXpPKL9kH15Pg N29AzQfNuRyTL/s51ZRrvmh/WJWIrl2xLue3s5u8yJA6DivUb8U46BK+BQn+POHG XJDydAxynKYbPlqbNE6yoFl36BwyNwy5vWQp/0ONiwXHPSl3lsi5LYWy0XGODS8a 9SSbLovjKTvMeLnoN+AI =11MC -----END PGP SIGNATURE----- Merge tag 'tomoyo-fixes-for-5.5' of git://git.osdn.net/gitroot/tomoyo/tomoyo-test1 Pull tomoyo fixes from Tetsuo Handa: "Two bug fixes: - Suppress RCU warning at list_for_each_entry_rcu() - Don't use fancy names on sockets" * tag 'tomoyo-fixes-for-5.5' of git://git.osdn.net/gitroot/tomoyo/tomoyo-test1: tomoyo: Suppress RCU warning at list_for_each_entry_rcu(). tomoyo: Don't use nifty names on sockets.
This commit is contained in:
commit
c5c928c667
@ -951,7 +951,8 @@ static bool tomoyo_manager(void)
|
||||
exe = tomoyo_get_exe();
|
||||
if (!exe)
|
||||
return false;
|
||||
list_for_each_entry_rcu(ptr, &tomoyo_kernel_namespace.policy_list[TOMOYO_ID_MANAGER], head.list) {
|
||||
list_for_each_entry_rcu(ptr, &tomoyo_kernel_namespace.policy_list[TOMOYO_ID_MANAGER], head.list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (!ptr->head.is_deleted &&
|
||||
(!tomoyo_pathcmp(domainname, ptr->manager) ||
|
||||
!strcmp(exe, ptr->manager->name))) {
|
||||
@ -1095,7 +1096,8 @@ static int tomoyo_delete_domain(char *domainname)
|
||||
if (mutex_lock_interruptible(&tomoyo_policy_lock))
|
||||
return -EINTR;
|
||||
/* Is there an active domain? */
|
||||
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
|
||||
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
/* Never delete tomoyo_kernel_domain */
|
||||
if (domain == &tomoyo_kernel_domain)
|
||||
continue;
|
||||
@ -2778,7 +2780,8 @@ void tomoyo_check_profile(void)
|
||||
|
||||
tomoyo_policy_loaded = true;
|
||||
pr_info("TOMOYO: 2.6.0\n");
|
||||
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
|
||||
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
const u8 profile = domain->profile;
|
||||
struct tomoyo_policy_namespace *ns = domain->ns;
|
||||
|
||||
|
@ -41,7 +41,8 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size,
|
||||
|
||||
if (mutex_lock_interruptible(&tomoyo_policy_lock))
|
||||
return -ENOMEM;
|
||||
list_for_each_entry_rcu(entry, list, list) {
|
||||
list_for_each_entry_rcu(entry, list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (entry->is_deleted == TOMOYO_GC_IN_PROGRESS)
|
||||
continue;
|
||||
if (!check_duplicate(entry, new_entry))
|
||||
@ -119,7 +120,8 @@ int tomoyo_update_domain(struct tomoyo_acl_info *new_entry, const int size,
|
||||
}
|
||||
if (mutex_lock_interruptible(&tomoyo_policy_lock))
|
||||
goto out;
|
||||
list_for_each_entry_rcu(entry, list, list) {
|
||||
list_for_each_entry_rcu(entry, list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (entry->is_deleted == TOMOYO_GC_IN_PROGRESS)
|
||||
continue;
|
||||
if (!tomoyo_same_acl_head(entry, new_entry) ||
|
||||
@ -166,7 +168,8 @@ void tomoyo_check_acl(struct tomoyo_request_info *r,
|
||||
u16 i = 0;
|
||||
|
||||
retry:
|
||||
list_for_each_entry_rcu(ptr, list, list) {
|
||||
list_for_each_entry_rcu(ptr, list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (ptr->is_deleted || ptr->type != r->param_type)
|
||||
continue;
|
||||
if (!check_entry(r, ptr))
|
||||
@ -298,7 +301,8 @@ static inline bool tomoyo_scan_transition
|
||||
{
|
||||
const struct tomoyo_transition_control *ptr;
|
||||
|
||||
list_for_each_entry_rcu(ptr, list, head.list) {
|
||||
list_for_each_entry_rcu(ptr, list, head.list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (ptr->head.is_deleted || ptr->type != type)
|
||||
continue;
|
||||
if (ptr->domainname) {
|
||||
@ -735,7 +739,8 @@ retry:
|
||||
|
||||
/* Check 'aggregator' directive. */
|
||||
candidate = &exename;
|
||||
list_for_each_entry_rcu(ptr, list, head.list) {
|
||||
list_for_each_entry_rcu(ptr, list, head.list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (ptr->head.is_deleted ||
|
||||
!tomoyo_path_matches_pattern(&exename,
|
||||
ptr->original_name))
|
||||
|
@ -133,7 +133,8 @@ tomoyo_path_matches_group(const struct tomoyo_path_info *pathname,
|
||||
{
|
||||
struct tomoyo_path_group *member;
|
||||
|
||||
list_for_each_entry_rcu(member, &group->member_list, head.list) {
|
||||
list_for_each_entry_rcu(member, &group->member_list, head.list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (member->head.is_deleted)
|
||||
continue;
|
||||
if (!tomoyo_path_matches_pattern(pathname, member->member_name))
|
||||
@ -161,7 +162,8 @@ bool tomoyo_number_matches_group(const unsigned long min,
|
||||
struct tomoyo_number_group *member;
|
||||
bool matched = false;
|
||||
|
||||
list_for_each_entry_rcu(member, &group->member_list, head.list) {
|
||||
list_for_each_entry_rcu(member, &group->member_list, head.list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (member->head.is_deleted)
|
||||
continue;
|
||||
if (min > member->number.values[1] ||
|
||||
@ -191,7 +193,8 @@ bool tomoyo_address_matches_group(const bool is_ipv6, const __be32 *address,
|
||||
bool matched = false;
|
||||
const u8 size = is_ipv6 ? 16 : 4;
|
||||
|
||||
list_for_each_entry_rcu(member, &group->member_list, head.list) {
|
||||
list_for_each_entry_rcu(member, &group->member_list, head.list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (member->head.is_deleted)
|
||||
continue;
|
||||
if (member->address.is_ipv6 != is_ipv6)
|
||||
|
@ -217,31 +217,6 @@ out:
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
/**
|
||||
* tomoyo_get_socket_name - Get the name of a socket.
|
||||
*
|
||||
* @path: Pointer to "struct path".
|
||||
* @buffer: Pointer to buffer to return value in.
|
||||
* @buflen: Sizeof @buffer.
|
||||
*
|
||||
* Returns the buffer.
|
||||
*/
|
||||
static char *tomoyo_get_socket_name(const struct path *path, char * const buffer,
|
||||
const int buflen)
|
||||
{
|
||||
struct inode *inode = d_backing_inode(path->dentry);
|
||||
struct socket *sock = inode ? SOCKET_I(inode) : NULL;
|
||||
struct sock *sk = sock ? sock->sk : NULL;
|
||||
|
||||
if (sk) {
|
||||
snprintf(buffer, buflen, "socket:[family=%u:type=%u:protocol=%u]",
|
||||
sk->sk_family, sk->sk_type, sk->sk_protocol);
|
||||
} else {
|
||||
snprintf(buffer, buflen, "socket:[unknown]");
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* tomoyo_realpath_from_path - Returns realpath(3) of the given pathname but ignores chroot'ed root.
|
||||
*
|
||||
@ -279,12 +254,7 @@ char *tomoyo_realpath_from_path(const struct path *path)
|
||||
break;
|
||||
/* To make sure that pos is '\0' terminated. */
|
||||
buf[buf_len - 1] = '\0';
|
||||
/* Get better name for socket. */
|
||||
if (sb->s_magic == SOCKFS_MAGIC) {
|
||||
pos = tomoyo_get_socket_name(path, buf, buf_len - 1);
|
||||
goto encode;
|
||||
}
|
||||
/* For "pipe:[\$]". */
|
||||
/* For "pipe:[\$]" and "socket:[\$]". */
|
||||
if (dentry->d_op && dentry->d_op->d_dname) {
|
||||
pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1);
|
||||
goto encode;
|
||||
|
@ -594,7 +594,8 @@ struct tomoyo_domain_info *tomoyo_find_domain(const char *domainname)
|
||||
|
||||
name.name = domainname;
|
||||
tomoyo_fill_path_info(&name);
|
||||
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
|
||||
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
if (!domain->is_deleted &&
|
||||
!tomoyo_pathcmp(&name, domain->domainname))
|
||||
return domain;
|
||||
@ -1028,7 +1029,8 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r)
|
||||
return false;
|
||||
if (!domain)
|
||||
return true;
|
||||
list_for_each_entry_rcu(ptr, &domain->acl_info_list, list) {
|
||||
list_for_each_entry_rcu(ptr, &domain->acl_info_list, list,
|
||||
srcu_read_lock_held(&tomoyo_ss)) {
|
||||
u16 perm;
|
||||
u8 i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user