All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Christian Deacon <gamemann@gflclan.com>, xdp-newbies@vger.kernel.org
Subject: Re: XDP Software Issue - Payload Matching
Date: Tue, 14 Jul 2020 22:48:00 +0200	[thread overview]
Message-ID: <87o8ohg6wv.fsf@toke.dk> (raw)
In-Reply-To: <4581875c-d5af-3da5-bf01-ce3e404c94dc@gflclan.com>

Christian Deacon <gamemann@gflclan.com> writes:

> Hey Toke,
>
>
> I apologize for the long delay on this. A lot has been going on recently!
>
>
> I attempted to match payload data using the packet's payload as the BPF 
> map key. Unfortunately, I didn't have any success with this. I stored my 
> findings here from last month:
>
>
> https://github.com/gamemann/XDP-Dynamic-Payload-Matching#section-methodfour-fail
>
>
> I'd assume I may be missing something here, though.
>
>
> I saw another XDP mailing list thread pop up recently regarding matching 
> TCP payload data. I believe this may be what they're trying to achieve 
> (being able to match dynamic payload data with XDP).
>
>
> I was wondering if you had any other ideas on how we can match packet 
> payload data against a BPF map.

That error ("invalid stack type R2 off=-16 access_size=150") comes from
this check in the verifier:

	if (off >= 0 || off < -MAX_BPF_STACK || off + access_size > 0 ||
	    access_size < 0 || (access_size == 0 && !zero_size_allowed)) {
		if (tnum_is_const(reg->var_off)) {
			verbose(env, "invalid stack type R%d off=%d access_size=%d\n",
				regno, off, access_size);
		} else {
                ..
                }
                return -EACCESS;
        }

which I think means that you're trying to use a 10-byte value as a
lookup key for a map that has a 150-byte key, which would make the
map key read through the end of the stack.

So basically, if you change

uint8_t hashkey[10];

to

uint8_t hashkey[150];

I think it ought to work?

-Toke

      reply	other threads:[~2020-07-14 20:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 13:57 XDP Software Issue - Payload Matching Christian Deacon
2020-05-11 10:41 ` Toke Høiland-Jørgensen
2020-05-11 18:40   ` Christian Deacon
2020-05-12 14:28     ` Toke Høiland-Jørgensen
2020-05-13 13:25       ` Christian Deacon
2020-05-13 14:42         ` Toke Høiland-Jørgensen
2020-05-22 14:49           ` Christian Deacon
2020-05-22 15:12             ` Toke Høiland-Jørgensen
2020-07-14 15:58               ` Christian Deacon
2020-07-14 20:48                 ` Toke Høiland-Jørgensen [this message]

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=87o8ohg6wv.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=gamemann@gflclan.com \
    --cc=xdp-newbies@vger.kernel.org \
    /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.