1. 19 Feb, 2022 12 commits
  2. 18 Feb, 2022 27 commits
  3. 17 Feb, 2022 1 commit
    • Song Liu's avatar
      bpf: bpf_prog_pack: Set proper size before freeing ro_header · d24d2a2b
      Song Liu authored
      bpf_prog_pack_free() uses header->size to decide whether the header
      should be freed with module_memfree() or the bpf_prog_pack logic.
      However, in kvmalloc() failure path of bpf_jit_binary_pack_alloc(),
      header->size is not set yet. As a result, bpf_prog_pack_free() may treat
      a slice of a pack as a standalone kvmalloc'd header and call
      module_memfree() on the whole pack. This in turn causes use-after-free by
      other users of the pack.
      
      Fix this by setting ro_header->size before freeing ro_header.
      
      Fixes: 33c98058 ("bpf: Introduce bpf_jit_binary_pack_[alloc|finalize|free]")
      Reported-by: syzbot+2f649ec6d2eea1495a8f@syzkaller.appspotmail.com
      Reported-by: syzbot+ecb1e7e51c52f68f7481@syzkaller.appspotmail.com
      Reported-by: syzbot+87f65c75f4a72db05445@syzkaller.appspotmail.com
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220217183001.1876034-1-song@kernel.org
      d24d2a2b