[all-commits] [llvm/llvm-project] a5a6cf: BPF: permit type modifiers for __builtin_btf_type_...

yonghong-song via All-commits all-commits at lists.llvm.org
Mon May 3 17:38:27 PDT 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a5a6cfe2f030e81e689ed9af4e95ddf95c4d8675
      https://github.com/llvm/llvm-project/commit/a5a6cfe2f030e81e689ed9af4e95ddf95c4d8675
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-05-03 (Mon, 03 May 2021)

  Changed paths:
    M llvm/lib/Target/BPF/BPFPreserveDIType.cpp
    A llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-2.ll

  Log Message:
  -----------
  BPF: permit type modifiers for __builtin_btf_type_id() relocation

Lorenz Bauer from Cloudflare tried to use "const struct <name>"
as the type for __builtin_btf_type_id(*(const struct <name>)0, 1)
relocation and hit a llvm BPF fatal error.
   https://lore.kernel.org/bpf/a3782f71-3f6b-1e75-17a9-1827822c2030@fb.com/

   ...
   fatal error: error in backend: Empty type name for BTF_TYPE_ID_REMOTE reloc

Currently, we require the debuginfo type itself must have a name.
In this case, the debuginfo type is "const" which points to "struct <name>".
The "const" type does not have a name, hence the above fatal error
will be triggered.

Let us permit "const" and "volatile" type modifiers. We skip modifiers
in some other cases as well like structure member type tracing.
This can aviod the above fatal error.

Differential Revision: https://reviews.llvm.org/D97986

(cherry picked from commit 9c0274cdeae904089806be6faee72b9126d2cf5b)




More information about the All-commits mailing list