cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

prevent_map_lookup.c (858B)


      1{
      2	"prevent map lookup in stack trace",
      3	.insns = {
      4	BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
      5	BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
      6	BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
      7	BPF_LD_MAP_FD(BPF_REG_1, 0),
      8	BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
      9	BPF_EXIT_INSN(),
     10	},
     11	.fixup_map_stacktrace = { 3 },
     12	.result = REJECT,
     13	.errstr = "cannot pass map_type 7 into func bpf_map_lookup_elem",
     14	.prog_type = BPF_PROG_TYPE_PERF_EVENT,
     15},
     16{
     17	"prevent map lookup in prog array",
     18	.insns = {
     19	BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
     20	BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
     21	BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
     22	BPF_LD_MAP_FD(BPF_REG_1, 0),
     23	BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
     24	BPF_EXIT_INSN(),
     25	},
     26	.fixup_prog2 = { 3 },
     27	.result = REJECT,
     28	.errstr = "cannot pass map_type 3 into func bpf_map_lookup_elem",
     29},