From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Wenbo Zhang <ethercflow@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andriin@fb.com>, Sasha Levin <sashal@kernel.org>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH AUTOSEL 5.8 40/64] bpf: Fix fds_example SIGSEGV error
Date: Mon, 10 Aug 2020 15:08:35 -0400 [thread overview]
Message-ID: <20200810190859.3793319-40-sashal@kernel.org> (raw)
In-Reply-To: <20200810190859.3793319-1-sashal@kernel.org>
From: Wenbo Zhang <ethercflow@gmail.com>
[ Upstream commit eef8a42d6ce087d1c81c960ae0d14f955b742feb ]
The `BPF_LOG_BUF_SIZE`'s value is `UINT32_MAX >> 8`, so define an array
with it on stack caused an overflow.
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200710092035.28919-1-ethercflow@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
samples/bpf/fds_example.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c
index d5992f7872328..59f45fef51109 100644
--- a/samples/bpf/fds_example.c
+++ b/samples/bpf/fds_example.c
@@ -30,6 +30,8 @@
#define BPF_M_MAP 1
#define BPF_M_PROG 2
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
static void usage(void)
{
printf("Usage: fds_example [...]\n");
@@ -57,7 +59,6 @@ static int bpf_prog_create(const char *object)
BPF_EXIT_INSN(),
};
size_t insns_cnt = sizeof(insns) / sizeof(struct bpf_insn);
- char bpf_log_buf[BPF_LOG_BUF_SIZE];
struct bpf_object *obj;
int prog_fd;
--
2.25.1
next prev parent reply other threads:[~2020-08-10 19:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200810190859.3793319-1-sashal@kernel.org>
2020-08-10 19:07 ` [PATCH AUTOSEL 5.8 03/64] net: mscc: ocelot: fix encoding destination ports into multicast IPv4 address Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 05/64] Bluetooth: add a mutex lock to avoid UAF in do_enale_set Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 16/64] rtw88: 8822ce: add support for device ID 0xc82f Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 20/64] ionic: rearrange reset and bus-master control Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 31/64] net: phy: mscc: restore the base page in vsc8514/8584_config_init Sasha Levin
2020-08-10 19:08 ` Sasha Levin [this message]
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 42/64] brcmfmac: keep SDIO watchdog running when console_interval is non-zero Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 43/64] brcmfmac: To fix Bss Info flag definition Bug Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 44/64] brcmfmac: set state of hanger slot to FREE when flushing PSQ Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 46/64] iwlegacy: Check the return value of pcie_capability_read_*() Sasha Levin
2020-08-10 19:08 ` [PATCH AUTOSEL 5.8 49/64] ionic: update eid test for overflow Sasha Levin
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=20200810190859.3793319-40-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andriin@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ethercflow@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).