Re: [RFC bpf-next 3/5] bpf: pin, translate, and unpin __kptr_user from syscalls.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 8/12/24 10:36, Alexei Starovoitov wrote:
On Mon, Aug 12, 2024 at 10:24 AM Kui-Feng Lee <sinquersw@xxxxxxxxx> wrote:


+static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
+                               void *key, void *value, __u64 flags)
+{
+       int err;
+
+       if (flags & BPF_FROM_USER) {

there shouldn't be a need for this extra flag.
map->record has the info whether uptr is present or not.

The BPF_FROM_USER flag is used to support updating map values from BPF
programs as well. Although BPF programs can udpate map values, I
don't want the values of uptrs to be changed by the BPF programs.

Should we just forbid the BPF programs to udpate the map values having
uptrs in them?

hmm. map_update_elem() is disallowed from bpf prog.

         case BPF_MAP_TYPE_TASK_STORAGE:
                 if (func_id != BPF_FUNC_task_storage_get &&
                     func_id != BPF_FUNC_task_storage_delete &&
                     func_id != BPF_FUNC_kptr_xchg)
                         goto error;

Thank you for the information!





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux