Re: [Bpf] ISA: BPF_MSH and deprecated packet access instructions

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

 



> We do not support any load/sotre instruction with mode BPF_MSH in
> binutils.  Should we do so?  What are these?
>
>> Under "Load and store instructions", various mode modifiers are documented.
>> I notice that BPF_MSH (0xa0) is not documented, but appears to be in use in 
>> various projects, including Linux, BSD, seccomp, etc. and is even documented
>> in various books such as
>> https://www.google.com/books/edition/Programming_Linux_Hacker_Tools_Uncovere
>> d/yqHVAwAAQBAJ?hl=en&gbpv=1&dq=%22BPF_MSH%22&pg=PA129&printsec=frontcover
>>
>> Should we document it as deprecated and add it to the set of deprecated
>> instructions (the legacy conformance group) like BPF_ABS and BPF_IND
>> already are?
>>
>> Also, for purposes of the IANA registry of instructions where we list which
>> opcodes are "(deprecated, implementation-specific)", I currently list all
>> possible BPF_ABS and BPF_IND opcodes regardless of whether they were
>> ever used (I didn't check which were used and which might not have been),
>> so I could just list all possible BPF_MSH opcodes similarly.  But if we know
>> that some were never used then I don't need to do so, so I guess I should
>> ask:
>> do we have a list of which combinations were actually used or should we
>> continue to just deprecate all combinations?
>>
>> As an example,
>> https://github.com/seccomp/libseccomp/blob/main/tools/scmp_bpf_disasm.c#L68
>> lists 6 variants of BPF_MSH: LD and LDX, for B, H, and W (but not DW).
>> Other sources like the book page referenced above, and the BSD man page,
>> list only BPF_LDX | BPF_B | BPF_MSH, which is in Linux sources such as
>> https://elixir.bootlin.com/linux/v6.8-rc1/source/lib/test_bpf.c#L368
>>
>> So, should we list the DW variants as deprecated, or never assigned?
>> Should we list the H, W, and LD variants as deprecated, or never assigned?
>>
>> What about DW and LDX variants of BPF_IND and BPF_ABS?

These we support:

  /* Absolute load instructions, designed to be used in socket filters.  */
  {BPF_INSN_LDABSB, "ldabsb%W%i32", "r0 = * ( u8 * ) skb [ %i32 ]",
   BPF_V1, BPF_CODE, BPF_CLASS_LD|BPF_SIZE_B|BPF_MODE_ABS},
  {BPF_INSN_LDABSH, "ldabsh%W%i32", "r0 = * ( u16 * ) skb [ %i32 ]",
   BPF_V1, BPF_CODE, BPF_CLASS_LD|BPF_SIZE_H|BPF_MODE_ABS},
  {BPF_INSN_LDABSW, "ldabsw%W%i32", "r0 = * ( u32 * ) skb [ %i32 ]",
   BPF_V1, BPF_CODE, BPF_CLASS_LD|BPF_SIZE_W|BPF_MODE_ABS},
  {BPF_INSN_LDABSDW, "ldabsdw%W%i32", "r0 = * ( u64 * ) skb [ %i32 ]",
   BPF_V1, BPF_CODE, BPF_CLASS_LD|BPF_SIZE_DW|BPF_MODE_ABS},

  /* Generic load instructions (to register.)  */
  {BPF_INSN_LDXB, "ldxb%W%dr , [ %sr %o16 ]", "%dr = * ( u8 * ) ( %sr %o16 )",
   BPF_V1, BPF_CODE, BPF_CLASS_LDX|BPF_SIZE_B|BPF_MODE_MEM},
  {BPF_INSN_LDXH, "ldxh%W%dr , [ %sr %o16 ]", "%dr = * ( u16 * ) ( %sr %o16 )",
   BPF_V1, BPF_CODE, BPF_CLASS_LDX|BPF_SIZE_H|BPF_MODE_MEM},
  {BPF_INSN_LDXW, "ldxw%W%dr , [ %sr %o16 ]", "%dr = * ( u32 * ) ( %sr %o16 )",
   BPF_V1, BPF_CODE, BPF_CLASS_LDX|BPF_SIZE_W|BPF_MODE_MEM},
  {BPF_INSN_LDXDW, "ldxdw%W%dr , [ %sr %o16 ]","%dr = * ( u64 * ) ( %sr %o16 )",
   BPF_V1, BPF_CODE, BPF_CLASS_LDX|BPF_SIZE_DW|BPF_MODE_MEM},


>> Dave

-- 
Bpf mailing list
Bpf@xxxxxxxx
https://www.ietf.org/mailman/listinfo/bpf




[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