All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Brendan Jackman <jackmanb@google.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Florent Revest <revest@chromium.org>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PATCH v2 bpf-next] bpf: x86: Fix BPF_FETCH atomic and/or/xor with r0 as src
Date: Wed, 17 Feb 2021 23:27:32 +0100	[thread overview]
Message-ID: <d7befe74-f340-2b3d-1ea4-05cc21b8dc4e@iogearbox.net> (raw)
In-Reply-To: <20210216125307.1406237-1-jackmanb@google.com>

On 2/16/21 1:53 PM, Brendan Jackman wrote:
> This code generates a CMPXCHG loop in order to implement atomic_fetch
> bitwise operations. Because CMPXCHG is hard-coded to use rax (which
> holds the BPF r0 value), it saves the _real_ r0 value into the
> internal "ax" temporary register and restores it once the loop is
> complete.
> 
> In the middle of the loop, the actual bitwise operation is performed
> using src_reg. The bug occurs when src_reg is r0: as described above,
> r0 has been clobbered and the real r0 value is in the ax register.
> 
> Therefore, perform this operation on the ax register instead, when
> src_reg is r0.
> 
> Fixes: 981f94c3e921 ("bpf: Add bitwise atomic instructions")
> Signed-off-by: Brendan Jackman <jackmanb@google.com>

Applied, thanks!

      parent reply	other threads:[~2021-02-17 22:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 12:53 [PATCH v2 bpf-next] bpf: x86: Fix BPF_FETCH atomic and/or/xor with r0 as src Brendan Jackman
2021-02-16 16:32 ` KP Singh
2021-02-17 22:27 ` Daniel Borkmann [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=d7befe74-f340-2b3d-1ea4-05cc21b8dc4e@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=iii@linux.ibm.com \
    --cc=jackmanb@google.com \
    --cc=kpsingh@chromium.org \
    --cc=revest@chromium.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.