From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: lukenels@cs.washington.edu, ast@kernel.org,
luke.r.nels@gmail.com, xi.wang@gmail.com, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX" failed to apply to 5.4-stable tree
Date: Thu, 30 Apr 2020 19:03:33 -0400 [thread overview]
Message-ID: <20200430230333.GZ13035@sasha-vm> (raw)
In-Reply-To: <1588259178201116@kroah.com>
On Thu, Apr 30, 2020 at 05:06:18PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 5.4-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From aee194b14dd2b2bde6252b3acf57d36dccfc743a Mon Sep 17 00:00:00 2001
>From: Luke Nelson <lukenels@cs.washington.edu>
>Date: Sat, 18 Apr 2020 16:26:53 -0700
>Subject: [PATCH] bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX
> BPF_B
>
>This patch fixes an encoding bug in emit_stx for BPF_B when the source
>register is BPF_REG_FP.
>
>The current implementation for BPF_STX BPF_B in emit_stx saves one REX
>byte when the operands can be encoded using Mod-R/M alone. The lower 8
>bits of registers %rax, %rbx, %rcx, and %rdx can be accessed without using
>a REX prefix via %al, %bl, %cl, and %dl, respectively. Other registers,
>(e.g., %rsi, %rdi, %rbp, %rsp) require a REX prefix to use their 8-bit
>equivalents (%sil, %dil, %bpl, %spl).
>
>The current code checks if the source for BPF_STX BPF_B is BPF_REG_1
>or BPF_REG_2 (which map to %rdi and %rsi), in which case it emits the
>required REX prefix. However, it misses the case when the source is
>BPF_REG_FP (mapped to %rbp).
>
>The result is that BPF_STX BPF_B with BPF_REG_FP as the source operand
>will read from register %ch instead of the correct %bpl. This patch fixes
>the problem by fixing and refactoring the check on which registers need
>the extra REX byte. Since no BPF registers map to %rsp, there is no need
>to handle %spl.
>
>Fixes: 622582786c9e0 ("net: filter: x86: internal BPF JIT")
>Signed-off-by: Xi Wang <xi.wang@gmail.com>
>Signed-off-by: Luke Nelson <luke.r.nels@gmail.com>
>Signed-off-by: Alexei Starovoitov <ast@kernel.org>
>Link: https://lore.kernel.org/bpf/20200418232655.23870-1-luke.r.nels@gmail.com
The code got shuffled around in 3b2744e66520 ("bpf: Refactor x86 JIT
into helpers"). I've fixed it and queued for all branches.
--
Thanks,
Sasha
prev parent reply other threads:[~2020-04-30 23:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 15:06 FAILED: patch "[PATCH] bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX" failed to apply to 5.4-stable tree gregkh
2020-04-30 23:03 ` Sasha Levin [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=20200430230333.GZ13035@sasha-vm \
--to=sashal@kernel.org \
--cc=ast@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=luke.r.nels@gmail.com \
--cc=lukenels@cs.washington.edu \
--cc=stable@vger.kernel.org \
--cc=xi.wang@gmail.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.