* [PATCH 1/1] [bpf-next] libbpf: fix off-by-one error for BPF_LOG_BUF_SIZE
@ 2019-04-19 14:55 McCabe, Robert J
0 siblings, 0 replies; 3+ messages in thread
From: McCabe, Robert J @ 2019-04-19 14:55 UTC (permalink / raw)
To: netdev; +Cc: robert.mccabe
The BPF_PROG_LOAD condition for kernel version <= 5.1 is
log->len_total > UINT_MAX >> 8 /* (16 * 1024 * 1024) - 1 */
Signed-off-by: McCabe, Robert J <Robert.McCabe@rockwellcollins.com>
---
tools/lib/bpf/bpf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index bc30783d1403..62d67caa7aea 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -92,7 +92,7 @@ struct bpf_load_program_attr {
#define MAPS_RELAX_COMPAT 0x01
/* Recommend log buffer size */
-#define BPF_LOG_BUF_SIZE (16 * 1024 * 1024) /* verifier maximum in kernels <= 5.1 */
+#define BPF_LOG_BUF_SIZE ((16 * 1024 * 1024) - 1) /* verifier maximum in kernels <= 5.1 */
LIBBPF_API int
bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
char *log_buf, size_t log_buf_sz);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] [bpf-next] libbpf: fix off-by-one error for BPF_LOG_BUF_SIZE
2019-04-19 15:08 rjmccabe3701
@ 2019-04-19 20:11 ` Y Song
0 siblings, 0 replies; 3+ messages in thread
From: Y Song @ 2019-04-19 20:11 UTC (permalink / raw)
To: rjmccabe3701; +Cc: netdev, McCabe
On Fri, Apr 19, 2019 at 12:32 PM rjmccabe3701
<robert.mccabe@rockwellcollins.com> wrote:
>
> From: "McCabe, Robert J" <Robert.McCabe@rockwellcollins.com>
>
> The BPF_PROG_LOAD condition for kernel version <= 5.1 is
>
> log->len_total > UINT_MAX >> 8 /* (16 * 1024 * 1024) - 1 */
>
> Signed-off-by: McCabe, Robert J <Robert.McCabe@rockwellcollins.com>
Acked-by: Yonghong Song <yhs@fb.com>
> ---
> tools/lib/bpf/bpf.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
> index bc30783d1403..62d67caa7aea 100644
> --- a/tools/lib/bpf/bpf.h
> +++ b/tools/lib/bpf/bpf.h
> @@ -92,7 +92,7 @@ struct bpf_load_program_attr {
> #define MAPS_RELAX_COMPAT 0x01
>
> /* Recommend log buffer size */
> -#define BPF_LOG_BUF_SIZE (16 * 1024 * 1024) /* verifier maximum in kernels <= 5.1 */
> +#define BPF_LOG_BUF_SIZE ((16 * 1024 * 1024) - 1) /* verifier maximum in kernels <= 5.1 */
> LIBBPF_API int
> bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
> char *log_buf, size_t log_buf_sz);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] [bpf-next] libbpf: fix off-by-one error for BPF_LOG_BUF_SIZE
@ 2019-04-19 15:08 rjmccabe3701
2019-04-19 20:11 ` Y Song
0 siblings, 1 reply; 3+ messages in thread
From: rjmccabe3701 @ 2019-04-19 15:08 UTC (permalink / raw)
To: netdev; +Cc: robert.mccabe, McCabe, Robert J, McCabe
From: "McCabe, Robert J" <Robert.McCabe@rockwellcollins.com>
The BPF_PROG_LOAD condition for kernel version <= 5.1 is
log->len_total > UINT_MAX >> 8 /* (16 * 1024 * 1024) - 1 */
Signed-off-by: McCabe, Robert J <Robert.McCabe@rockwellcollins.com>
---
tools/lib/bpf/bpf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index bc30783d1403..62d67caa7aea 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -92,7 +92,7 @@ struct bpf_load_program_attr {
#define MAPS_RELAX_COMPAT 0x01
/* Recommend log buffer size */
-#define BPF_LOG_BUF_SIZE (16 * 1024 * 1024) /* verifier maximum in kernels <= 5.1 */
+#define BPF_LOG_BUF_SIZE ((16 * 1024 * 1024) - 1) /* verifier maximum in kernels <= 5.1 */
LIBBPF_API int
bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
char *log_buf, size_t log_buf_sz);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-19 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19 14:55 [PATCH 1/1] [bpf-next] libbpf: fix off-by-one error for BPF_LOG_BUF_SIZE McCabe, Robert J
2019-04-19 15:08 rjmccabe3701
2019-04-19 20:11 ` Y Song
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).