mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Merge 16c54d6a49 ("mm: fix apply_to_existing_page_range()") into android14-6.1-lts
Steps on the way to 6.1.135 Change-Id: I789088e35ba0c1f8c14466c6440828e3249159df Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -2104,6 +2104,7 @@ bool bpf_prog_map_compatible(struct bpf_map *map,
|
||||
{
|
||||
enum bpf_prog_type prog_type = resolve_prog_type(fp);
|
||||
bool ret;
|
||||
struct bpf_prog_aux *aux = fp->aux;
|
||||
|
||||
if (fp->kprobe_override)
|
||||
return false;
|
||||
@@ -2115,12 +2116,26 @@ bool bpf_prog_map_compatible(struct bpf_map *map,
|
||||
*/
|
||||
map->owner.type = prog_type;
|
||||
map->owner.jited = fp->jited;
|
||||
map->owner.xdp_has_frags = fp->aux->xdp_has_frags;
|
||||
map->owner.xdp_has_frags = aux->xdp_has_frags;
|
||||
map->owner.attach_func_proto = aux->attach_func_proto;
|
||||
ret = true;
|
||||
} else {
|
||||
ret = map->owner.type == prog_type &&
|
||||
map->owner.jited == fp->jited &&
|
||||
map->owner.xdp_has_frags == fp->aux->xdp_has_frags;
|
||||
map->owner.xdp_has_frags == aux->xdp_has_frags;
|
||||
if (ret &&
|
||||
map->owner.attach_func_proto != aux->attach_func_proto) {
|
||||
switch (prog_type) {
|
||||
case BPF_PROG_TYPE_TRACING:
|
||||
case BPF_PROG_TYPE_LSM:
|
||||
case BPF_PROG_TYPE_EXT:
|
||||
case BPF_PROG_TYPE_STRUCT_OPS:
|
||||
ret = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock(&map->owner.lock);
|
||||
|
||||
|
||||
@@ -793,7 +793,7 @@ static const struct vm_operations_struct bpf_map_default_vmops = {
|
||||
static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct bpf_map *map = filp->private_data;
|
||||
int err;
|
||||
int err = 0;
|
||||
|
||||
if (!map->ops->map_mmap || map_value_has_spin_lock(map) ||
|
||||
map_value_has_timer(map) || map_value_has_kptrs(map))
|
||||
@@ -818,7 +818,12 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
bpf_map_write_active_inc(map);
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&map->freeze_mutex);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* set default open/close callbacks */
|
||||
vma->vm_ops = &bpf_map_default_vmops;
|
||||
@@ -829,13 +834,11 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
vm_flags_clear(vma, VM_MAYWRITE);
|
||||
|
||||
err = map->ops->map_mmap(map, vma);
|
||||
if (err)
|
||||
goto out;
|
||||
if (err) {
|
||||
if (vma->vm_flags & VM_WRITE)
|
||||
bpf_map_write_active_dec(map);
|
||||
}
|
||||
|
||||
if (vma->vm_flags & VM_MAYWRITE)
|
||||
bpf_map_write_active_inc(map);
|
||||
out:
|
||||
mutex_unlock(&map->freeze_mutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user