mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
Merge remote-tracking branch 'sm8350/lineage-20' into lineage-23.0
* sm8350/lineage-20: (841 commits)
UPSTREAM: fs: prevent out-of-bounds array speculation when closing a file descriptor
UPSTREAM: file: let pick_file() tell caller it's done
BACKPORT: rcu-tasks: Add a grace-period start time for throttling and debug
BACKPORT: maccess: rename probe_user_{read,write} to copy_{from,to}_user_nofault
BACKPORT: powerpc: use probe_user_read() and probe_user_write()
BACKPORT: maccess: rename probe_kernel_address to get_kernel_nofault
BACKPORT: tracing/kprobes: handle mixed kernel/userspace probes better
BACKPORT: maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault
UPSTREAM: maccess: unexport probe_kernel_write()
UPSTREAM: maccess: return -ERANGE when probe_kernel_read() fails
UPSTREAM: maccess: allow architectures to provide kernel probing directly
BACKPORT: maccess: remove strncpy_from_unsafe
UPSTREAM: bpf:bpf_seq_printf(): handle potentially unsafe format string better
UPSTREAM: bpf: Use strncpy_from_unsafe_strict() in bpf_seq_printf() helper
UPSTREAM: bpf: handle the compat string in bpf_trace_copy_string better
UPSTREAM: bpf: factor out a bpf_trace_copy_string helper
BACKPORT: maccess: always use strict semantics for probe_kernel_read
UPSTREAM: maccess: unify the probe kernel arch hooks
UPSTREAM: maccess: remove probe_read_common and probe_write_common
UPSTREAM: maccess: remove duplicate kerneldoc comments
...
Change-Id: I22cf7d6fb34826727904effb4f012b0ef459149d
This commit is contained in:
commit
2eb0f824a1
529 changed files with 40893 additions and 9494 deletions
|
|
@ -1356,10 +1356,7 @@ static void cgroup_exit_root_id(struct cgroup_root *root)
|
|||
|
||||
void cgroup_free_root(struct cgroup_root *root)
|
||||
{
|
||||
if (root) {
|
||||
idr_destroy(&root->cgroup_idr);
|
||||
kfree(root);
|
||||
}
|
||||
kfree(root);
|
||||
}
|
||||
|
||||
static void cgroup_destroy_root(struct cgroup_root *root)
|
||||
|
|
@ -1900,12 +1897,14 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node,
|
|||
enum cgroup2_param {
|
||||
Opt_nsdelegate,
|
||||
Opt_memory_localevents,
|
||||
Opt_memory_recursiveprot,
|
||||
nr__cgroup2_params
|
||||
};
|
||||
|
||||
static const struct fs_parameter_spec cgroup2_param_specs[] = {
|
||||
fsparam_flag("nsdelegate", Opt_nsdelegate),
|
||||
fsparam_flag("memory_localevents", Opt_memory_localevents),
|
||||
fsparam_flag("memory_recursiveprot", Opt_memory_recursiveprot),
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
@ -1931,6 +1930,9 @@ static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param
|
|||
case Opt_memory_localevents:
|
||||
ctx->flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS;
|
||||
return 0;
|
||||
case Opt_memory_recursiveprot:
|
||||
ctx->flags |= CGRP_ROOT_MEMORY_RECURSIVE_PROT;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1947,6 +1949,11 @@ static void apply_cgroup_root_flags(unsigned int root_flags)
|
|||
cgrp_dfl_root.flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS;
|
||||
else
|
||||
cgrp_dfl_root.flags &= ~CGRP_ROOT_MEMORY_LOCAL_EVENTS;
|
||||
|
||||
if (root_flags & CGRP_ROOT_MEMORY_RECURSIVE_PROT)
|
||||
cgrp_dfl_root.flags |= CGRP_ROOT_MEMORY_RECURSIVE_PROT;
|
||||
else
|
||||
cgrp_dfl_root.flags &= ~CGRP_ROOT_MEMORY_RECURSIVE_PROT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1956,6 +1963,8 @@ static int cgroup_show_options(struct seq_file *seq, struct kernfs_root *kf_root
|
|||
seq_puts(seq, ",nsdelegate");
|
||||
if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS)
|
||||
seq_puts(seq, ",memory_localevents");
|
||||
if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_RECURSIVE_PROT)
|
||||
seq_puts(seq, ",memory_recursiveprot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2060,7 +2069,6 @@ void init_cgroup_root(struct cgroup_fs_context *ctx)
|
|||
atomic_set(&root->nr_cgrps, 1);
|
||||
cgrp->root = root;
|
||||
init_cgroup_housekeeping(cgrp);
|
||||
idr_init(&root->cgroup_idr);
|
||||
|
||||
root->flags = ctx->flags;
|
||||
if (ctx->release_agent)
|
||||
|
|
@ -2081,12 +2089,6 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
|
|||
|
||||
lockdep_assert_held(&cgroup_mutex);
|
||||
|
||||
ret = cgroup_idr_alloc(&root->cgroup_idr, root_cgrp, 1, 2, GFP_KERNEL);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
root_cgrp->id = ret;
|
||||
root_cgrp->ancestor_ids[0] = ret;
|
||||
|
||||
ret = percpu_ref_init(&root_cgrp->self.refcnt, css_release,
|
||||
0, GFP_KERNEL);
|
||||
if (ret)
|
||||
|
|
@ -2112,13 +2114,16 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
|
|||
|
||||
root->kf_root = kernfs_create_root(kf_sops,
|
||||
KERNFS_ROOT_CREATE_DEACTIVATED |
|
||||
KERNFS_ROOT_SUPPORT_EXPORTOP,
|
||||
KERNFS_ROOT_SUPPORT_EXPORTOP |
|
||||
KERNFS_ROOT_SUPPORT_USER_XATTR,
|
||||
root_cgrp);
|
||||
if (IS_ERR(root->kf_root)) {
|
||||
ret = PTR_ERR(root->kf_root);
|
||||
goto exit_root_id;
|
||||
}
|
||||
root_cgrp->kn = root->kf_root->kn;
|
||||
WARN_ON_ONCE(cgroup_ino(root_cgrp) != 1);
|
||||
root_cgrp->ancestor_ids[0] = cgroup_id(root_cgrp);
|
||||
|
||||
ret = css_populate_dir(&root_cgrp->self);
|
||||
if (ret)
|
||||
|
|
@ -2128,8 +2133,10 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
|
|||
if (ret)
|
||||
goto destroy_root;
|
||||
|
||||
ret = cgroup_bpf_inherit(root_cgrp);
|
||||
WARN_ON_ONCE(ret);
|
||||
if (root == &cgrp_dfl_root) {
|
||||
ret = cgroup_bpf_inherit(root_cgrp);
|
||||
WARN_ON_ONCE(ret);
|
||||
}
|
||||
|
||||
trace_cgroup_setup_root(root);
|
||||
|
||||
|
|
@ -2156,7 +2163,6 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
|
|||
BUG_ON(!list_empty(&root_cgrp->self.children));
|
||||
BUG_ON(atomic_read(&root->nr_cgrps) != 1);
|
||||
|
||||
kernfs_activate(root_cgrp->kn);
|
||||
ret = 0;
|
||||
goto out;
|
||||
|
||||
|
|
@ -3758,22 +3764,22 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
|
|||
#ifdef CONFIG_PSI
|
||||
static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
struct cgroup *cgroup = seq_css(seq)->cgroup;
|
||||
struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
|
||||
struct cgroup *cgrp = seq_css(seq)->cgroup;
|
||||
struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
|
||||
|
||||
return psi_show(seq, psi, PSI_IO);
|
||||
}
|
||||
static int cgroup_memory_pressure_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
struct cgroup *cgroup = seq_css(seq)->cgroup;
|
||||
struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
|
||||
struct cgroup *cgrp = seq_css(seq)->cgroup;
|
||||
struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
|
||||
|
||||
return psi_show(seq, psi, PSI_MEM);
|
||||
}
|
||||
static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
struct cgroup *cgroup = seq_css(seq)->cgroup;
|
||||
struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
|
||||
struct cgroup *cgrp = seq_css(seq)->cgroup;
|
||||
struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
|
||||
|
||||
return psi_show(seq, psi, PSI_CPU);
|
||||
}
|
||||
|
|
@ -5276,9 +5282,6 @@ static void css_release_work_fn(struct work_struct *work)
|
|||
tcgrp->nr_dying_descendants--;
|
||||
spin_unlock_irq(&css_set_lock);
|
||||
|
||||
cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
|
||||
cgrp->id = -1;
|
||||
|
||||
/*
|
||||
* There are two control paths which try to determine
|
||||
* cgroup from dentry without going through kernfs -
|
||||
|
|
@ -5443,10 +5446,12 @@ err_free_css:
|
|||
* it isn't associated with its kernfs_node and doesn't have the control
|
||||
* mask applied.
|
||||
*/
|
||||
static struct cgroup *cgroup_create(struct cgroup *parent)
|
||||
static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
|
||||
umode_t mode)
|
||||
{
|
||||
struct cgroup_root *root = parent->root;
|
||||
struct cgroup *cgrp, *tcgrp;
|
||||
struct kernfs_node *kn;
|
||||
int level = parent->level + 1;
|
||||
int ret;
|
||||
|
||||
|
|
@ -5466,15 +5471,13 @@ static struct cgroup *cgroup_create(struct cgroup *parent)
|
|||
goto out_cancel_ref;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporarily set the pointer to NULL, so idr_find() won't return
|
||||
* a half-baked cgroup.
|
||||
*/
|
||||
cgrp->id = cgroup_idr_alloc(&root->cgroup_idr, NULL, 2, 0, GFP_KERNEL);
|
||||
if (cgrp->id < 0) {
|
||||
ret = -ENOMEM;
|
||||
/* create the directory */
|
||||
kn = kernfs_create_dir(parent->kn, name, mode, cgrp);
|
||||
if (IS_ERR(kn)) {
|
||||
ret = PTR_ERR(kn);
|
||||
goto out_stat_exit;
|
||||
}
|
||||
cgrp->kn = kn;
|
||||
|
||||
init_cgroup_housekeeping(cgrp);
|
||||
|
||||
|
|
@ -5484,11 +5487,13 @@ static struct cgroup *cgroup_create(struct cgroup *parent)
|
|||
|
||||
ret = psi_cgroup_alloc(cgrp);
|
||||
if (ret)
|
||||
goto out_idr_free;
|
||||
goto out_kernfs_remove;
|
||||
|
||||
ret = cgroup_bpf_inherit(cgrp);
|
||||
if (ret)
|
||||
goto out_psi_free;
|
||||
if (cgrp->root == &cgrp_dfl_root) {
|
||||
ret = cgroup_bpf_inherit(cgrp);
|
||||
if (ret)
|
||||
goto out_psi_free;
|
||||
}
|
||||
|
||||
/*
|
||||
* New cgroup inherits effective freeze counter, and
|
||||
|
|
@ -5508,7 +5513,7 @@ static struct cgroup *cgroup_create(struct cgroup *parent)
|
|||
|
||||
spin_lock_irq(&css_set_lock);
|
||||
for (tcgrp = cgrp; tcgrp; tcgrp = cgroup_parent(tcgrp)) {
|
||||
cgrp->ancestor_ids[tcgrp->level] = tcgrp->id;
|
||||
cgrp->ancestor_ids[tcgrp->level] = cgroup_id(tcgrp);
|
||||
|
||||
if (tcgrp != cgrp) {
|
||||
tcgrp->nr_descendants++;
|
||||
|
|
@ -5537,12 +5542,6 @@ static struct cgroup *cgroup_create(struct cgroup *parent)
|
|||
atomic_inc(&root->nr_cgrps);
|
||||
cgroup_get_live(parent);
|
||||
|
||||
/*
|
||||
* @cgrp is now fully operational. If something fails after this
|
||||
* point, it'll be released via the normal destruction path.
|
||||
*/
|
||||
cgroup_idr_replace(&root->cgroup_idr, cgrp, cgrp->id);
|
||||
|
||||
/*
|
||||
* On the default hierarchy, a child doesn't automatically inherit
|
||||
* subtree_control from the parent. Each is configured manually.
|
||||
|
|
@ -5556,8 +5555,8 @@ static struct cgroup *cgroup_create(struct cgroup *parent)
|
|||
|
||||
out_psi_free:
|
||||
psi_cgroup_free(cgrp);
|
||||
out_idr_free:
|
||||
cgroup_idr_remove(&root->cgroup_idr, cgrp->id);
|
||||
out_kernfs_remove:
|
||||
kernfs_remove(cgrp->kn);
|
||||
out_stat_exit:
|
||||
if (cgroup_on_dfl(parent))
|
||||
cgroup_rstat_exit(cgrp);
|
||||
|
|
@ -5594,7 +5593,6 @@ fail:
|
|||
int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, umode_t mode)
|
||||
{
|
||||
struct cgroup *parent, *cgrp;
|
||||
struct kernfs_node *kn;
|
||||
int ret;
|
||||
|
||||
/* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */
|
||||
|
|
@ -5610,27 +5608,19 @@ int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, umode_t mode)
|
|||
goto out_unlock;
|
||||
}
|
||||
|
||||
cgrp = cgroup_create(parent);
|
||||
cgrp = cgroup_create(parent, name, mode);
|
||||
if (IS_ERR(cgrp)) {
|
||||
ret = PTR_ERR(cgrp);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* create the directory */
|
||||
kn = kernfs_create_dir(parent->kn, name, mode, cgrp);
|
||||
if (IS_ERR(kn)) {
|
||||
ret = PTR_ERR(kn);
|
||||
goto out_destroy;
|
||||
}
|
||||
cgrp->kn = kn;
|
||||
|
||||
/*
|
||||
* This extra ref will be put in cgroup_free_fn() and guarantees
|
||||
* that @cgrp->kn is always accessible.
|
||||
*/
|
||||
kernfs_get(kn);
|
||||
kernfs_get(cgrp->kn);
|
||||
|
||||
ret = cgroup_kn_set_ugid(kn);
|
||||
ret = cgroup_kn_set_ugid(cgrp->kn);
|
||||
if (ret)
|
||||
goto out_destroy;
|
||||
|
||||
|
|
@ -5645,7 +5635,7 @@ int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, umode_t mode)
|
|||
TRACE_CGROUP_PATH(mkdir, cgrp);
|
||||
|
||||
/* let's create and online css's */
|
||||
kernfs_activate(kn);
|
||||
kernfs_activate(cgrp->kn);
|
||||
|
||||
ret = 0;
|
||||
goto out_unlock;
|
||||
|
|
@ -5822,7 +5812,8 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
|
|||
|
||||
cgroup1_check_for_release(parent);
|
||||
|
||||
cgroup_bpf_offline(cgrp);
|
||||
if (cgrp->root == &cgrp_dfl_root)
|
||||
cgroup_bpf_offline(cgrp);
|
||||
|
||||
/* put the base reference */
|
||||
percpu_ref_kill(&cgrp->self.refcnt);
|
||||
|
|
@ -6075,8 +6066,7 @@ static int __init cgroup_wq_init(void)
|
|||
}
|
||||
core_initcall(cgroup_wq_init);
|
||||
|
||||
void cgroup_path_from_kernfs_id(const union kernfs_node_id *id,
|
||||
char *buf, size_t buflen)
|
||||
void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
|
||||
{
|
||||
struct kernfs_node *kn;
|
||||
|
||||
|
|
@ -6670,26 +6660,31 @@ void cgroup_sk_free(struct sock_cgroup_data *skcd)
|
|||
#endif /* CONFIG_SOCK_CGROUP_DATA */
|
||||
|
||||
#ifdef CONFIG_CGROUP_BPF
|
||||
int cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
|
||||
enum bpf_attach_type type, u32 flags)
|
||||
int cgroup_bpf_attach(struct cgroup *cgrp,
|
||||
struct bpf_prog *prog, struct bpf_prog *replace_prog,
|
||||
struct bpf_cgroup_link *link,
|
||||
enum bpf_attach_type type,
|
||||
u32 flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mutex_lock(&cgroup_mutex);
|
||||
ret = __cgroup_bpf_attach(cgrp, prog, type, flags);
|
||||
ret = __cgroup_bpf_attach(cgrp, prog, replace_prog, link, type, flags);
|
||||
mutex_unlock(&cgroup_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
|
||||
enum bpf_attach_type type, u32 flags)
|
||||
enum bpf_attach_type type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mutex_lock(&cgroup_mutex);
|
||||
ret = __cgroup_bpf_detach(cgrp, prog, type);
|
||||
ret = __cgroup_bpf_detach(cgrp, prog, NULL, type);
|
||||
mutex_unlock(&cgroup_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
|
||||
union bpf_attr __user *uattr)
|
||||
{
|
||||
|
|
@ -6750,7 +6745,10 @@ static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate);
|
|||
static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "nsdelegate\nmemory_localevents\n");
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"nsdelegate\n"
|
||||
"memory_localevents\n"
|
||||
"memory_recursiveprot\n");
|
||||
}
|
||||
static struct kobj_attribute cgroup_features_attr = __ATTR_RO(features);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue