Skip to content

the bpf_map_update_elem in xdpdump_user.c crashes when key is more than 127 #8

Description

@souradeep100

The the number of cpus are more than 127, then it hits assert, and upon checking we can see it is hitting following error:
If the key is 128 or more then the bpf syscall is failing.
bpf(BPF_MAP_UPDATE_ELEM, {map_fd=3, key=0x7fffae9f9478, value=0x7fffae9f9474, flags=BPF_ANY}, 72) = -1 E2BIG (Argument list too long)

I have verified the same key value works using linux bpf self test test_maps.

test_hashmap(unsigned int task, void *data)
  38 {
  39         long long key, next_key, first_key, value;
  40         int fd;
  41
  42         fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value),
  43                             2, map_flags);
  44         if (fd < 0) {
  45                 printf("Failed to create hashmap '%s'!\n", strerror(errno));
  46                 exit(1);
  47         }
  48
  49         key = 128;
  50         value = 1234;
  51         /* Insert key=1 element. */
  52         printf("insert key 128 and value 1234\n");
  53         assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0);
  54         printf("no assert\n");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions