From: Yonghong Song <yonghong.song@linux.dev>
To: dthaler1968@googlemail.com
Cc: bpf@ietf.org, bpf@vger.kernel.org
Subject: Re: ISA: BPF_MSH and deprecated packet access instructions
Date: Sat, 27 Jan 2024 17:24:17 -0800 [thread overview]
Message-ID: <110aad7a-f8a3-46ed-9fda-2f8ee54dcb89@linux.dev> (raw)
In-Reply-To: <018901da5184$647f7ae0$2d7e70a0$@gmail.com>
On 1/27/24 4:53 PM, dthaler1968@googlemail.com wrote:
>> -----Original Message-----
>> From: Yonghong Song <yonghong.song@linux.dev>
>> Sent: Saturday, January 27, 2024 4:27 PM
>> To: dthaler1968@googlemail.com
>> Cc: bpf@ietf.org; bpf@vger.kernel.org
>> Subject: Re: ISA: BPF_MSH and deprecated packet access instructions
>>
>>
>> On 1/27/24 10:50 AM, dthaler1968@googlemail.com wrote:
>>> 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_Un
>>> covere
>>>
>> d/yqHVAwAAQBAJ?hl=en&gbpv=1&dq=%22BPF_MSH%22&pg=PA129&printsec
>> =frontco
>>> ver
>>>
>>> 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
>> From kernel source code (net/core/filter.c), the only supported format is
>> BPF_LDX | BPF_MSH | BPF_B
>>
>> The insn (BPF_LDX | BPF_MSH | BPF_B) is only used when cBPF (classic BPF) is
>> converted to BPF insn set. If the current BPF program has this insn, verifier will
>> reject it and bpf kernel interpreter does not support this insn either. So
>> technically, (BPF_LDX | BPF_MSH | BPF_B) is not supported by BPF program.
>>
>>> 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?
> Thanks for confirming. I think the doc is ok as is for this part.
>
>>> What about DW and LDX variants of BPF_IND and BPF_ABS?
> What about this question?
I don't know how to do proper wording in the standard. But
DW and LDX variants of BPF_IND/BPF_ABS are not supported
by verifier for now and they are considered illegal insns.
>
> Dave
>
WARNING: multiple messages have this Message-ID (diff)
From: Yonghong Song <yonghong.song@linux.dev>
To: dthaler1968@googlemail.com
Cc: bpf@ietf.org, bpf@vger.kernel.org
Subject: Re: [Bpf] ISA: BPF_MSH and deprecated packet access instructions
Date: Sat, 27 Jan 2024 17:24:17 -0800 [thread overview]
Message-ID: <110aad7a-f8a3-46ed-9fda-2f8ee54dcb89@linux.dev> (raw)
Message-ID: <20240128012417.KUqx-hPgPpF3kpIdtntYFTHgegrB1R7F3mfYZ8a18aA@z> (raw)
In-Reply-To: <018901da5184$647f7ae0$2d7e70a0$@gmail.com>
On 1/27/24 4:53 PM, dthaler1968@googlemail.com wrote:
>> -----Original Message-----
>> From: Yonghong Song <yonghong.song@linux.dev>
>> Sent: Saturday, January 27, 2024 4:27 PM
>> To: dthaler1968@googlemail.com
>> Cc: bpf@ietf.org; bpf@vger.kernel.org
>> Subject: Re: ISA: BPF_MSH and deprecated packet access instructions
>>
>>
>> On 1/27/24 10:50 AM, dthaler1968@googlemail.com wrote:
>>> 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_Un
>>> covere
>>>
>> d/yqHVAwAAQBAJ?hl=en&gbpv=1&dq=%22BPF_MSH%22&pg=PA129&printsec
>> =frontco
>>> ver
>>>
>>> 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
>> From kernel source code (net/core/filter.c), the only supported format is
>> BPF_LDX | BPF_MSH | BPF_B
>>
>> The insn (BPF_LDX | BPF_MSH | BPF_B) is only used when cBPF (classic BPF) is
>> converted to BPF insn set. If the current BPF program has this insn, verifier will
>> reject it and bpf kernel interpreter does not support this insn either. So
>> technically, (BPF_LDX | BPF_MSH | BPF_B) is not supported by BPF program.
>>
>>> 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?
> Thanks for confirming. I think the doc is ok as is for this part.
>
>>> What about DW and LDX variants of BPF_IND and BPF_ABS?
> What about this question?
I don't know how to do proper wording in the standard. But
DW and LDX variants of BPF_IND/BPF_ABS are not supported
by verifier for now and they are considered illegal insns.
>
> Dave
>
--
Bpf mailing list
Bpf@ietf.org
https://www.ietf.org/mailman/listinfo/bpf
next prev parent reply other threads:[~2024-01-28 1:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-27 18:50 ISA: BPF_MSH and deprecated packet access instructions dthaler1968
2024-01-27 18:50 ` [Bpf] " dthaler1968=40googlemail.com
2024-01-27 18:59 ` Jose E. Marchesi
2024-01-27 18:59 ` Jose E. Marchesi
2024-01-27 19:06 ` Jose E. Marchesi
2024-01-27 19:06 ` Jose E. Marchesi
2024-01-28 6:59 ` dthaler1968
2024-01-28 6:59 ` dthaler1968=40googlemail.com
2024-01-28 23:59 ` Alexei Starovoitov
2024-01-28 23:59 ` Alexei Starovoitov
2024-01-29 12:07 ` Jose E. Marchesi
2024-01-29 12:07 ` Jose E. Marchesi
2024-01-30 12:13 ` Jose E. Marchesi
2024-01-30 12:13 ` Jose E. Marchesi
2024-01-30 15:51 ` dthaler1968
2024-01-30 15:51 ` dthaler1968=40googlemail.com
2024-01-30 16:22 ` Alexei Starovoitov
2024-01-30 16:22 ` Alexei Starovoitov
2024-01-30 16:42 ` dthaler1968
2024-01-30 16:42 ` dthaler1968=40googlemail.com
2024-01-30 16:39 ` dthaler1968
2024-01-30 16:39 ` dthaler1968=40googlemail.com
2024-01-30 18:39 ` Yonghong Song
2024-01-30 18:39 ` Yonghong Song
2024-01-30 19:40 ` Alexei Starovoitov
2024-01-30 19:40 ` Alexei Starovoitov
2024-01-28 0:26 ` Yonghong Song
2024-01-28 0:26 ` [Bpf] " Yonghong Song
2024-01-28 0:53 ` dthaler1968
2024-01-28 0:53 ` [Bpf] " dthaler1968=40googlemail.com
2024-01-28 1:24 ` Yonghong Song [this message]
2024-01-28 1:24 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=110aad7a-f8a3-46ed-9fda-2f8ee54dcb89@linux.dev \
--to=yonghong.song@linux.dev \
--cc=bpf@ietf.org \
--cc=bpf@vger.kernel.org \
--cc=dthaler1968@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.