Netdev Archive on lore.kernel.org
 help / color / Atom feed
* More strict error checking in bpf_asm?
@ 2021-02-23 20:26 Ian Denhardt
  2021-02-23 20:47 ` Ilya Leoshkevich
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Denhardt @ 2021-02-23 20:26 UTC (permalink / raw)
  To: ast, daniel, bpf, netdev

Hi,

I'm using the `bpf_asm` tool to do some syscall filtering, and found out
the hard way that its error checking isn't very strict. In particular,
it issues a warning (not an error) when a jump offset overflows the
instruction's field. It really seems like this *ought* to be a hard
error, but I see from the commit message in
7e22077d0c73a68ff3fd8b3d2f6564fcbcf8cb23 that this was left as a warning
due to backwards compatibility concerns.

I'm skeptical of this trade-off, but would people at least be open to
adding a -Werror flag or the like, if changing it to a hard error
unconditionally is off the table?

Relatedly, while looking through the code I noticed there are several
places where an error occurs that does cause to tool to exit without
generating code, but it exits with 0 (success) status code. It seems
like this ought to report a failure to the caller?

-Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: More strict error checking in bpf_asm?
  2021-02-23 20:26 More strict error checking in bpf_asm? Ian Denhardt
@ 2021-02-23 20:47 ` Ilya Leoshkevich
  0 siblings, 0 replies; 2+ messages in thread
From: Ilya Leoshkevich @ 2021-02-23 20:47 UTC (permalink / raw)
  To: Ian Denhardt, ast, daniel, bpf, netdev

On Tue, 2021-02-23 at 15:26 -0500, Ian Denhardt wrote:
> Hi,
> 
> I'm using the `bpf_asm` tool to do some syscall filtering, and found
> out
> the hard way that its error checking isn't very strict. In particular,
> it issues a warning (not an error) when a jump offset overflows the
> instruction's field. It really seems like this *ought* to be a hard
> error, but I see from the commit message in
> 7e22077d0c73a68ff3fd8b3d2f6564fcbcf8cb23 that this was left as a
> warning
> due to backwards compatibility concerns.

My 2c: when I was writing that commit, I did not have any specific
examples of code that would break in mind - that was pure
speculation/paranoia. So it's OK from my perspective to convert this
fprintf to a hard error.

[...]


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 20:26 More strict error checking in bpf_asm? Ian Denhardt
2021-02-23 20:47 ` Ilya Leoshkevich

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git