* [PATCH iproute2/master] bpf: initialize the verifier log
@ 2017-11-23 1:00 Jakub Kicinski
2017-11-23 9:31 ` Daniel Borkmann
2017-11-24 4:48 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2017-11-23 1:00 UTC (permalink / raw)
To: netdev; +Cc: oss-drivers, daniel, Jakub Kicinski
If program loading fails before verifier prints its first
message, the verifier log will not be initialized. Always
set the first character of the log buffer to zero to make
sure we don't dump non-printable characters to the terminal.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
lib/bpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/bpf.c b/lib/bpf.c
index 10ea23a471ef..fdc28772fb71 100644
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -1153,7 +1153,7 @@ static int bpf_log_realloc(struct bpf_elf_ctx *ctx)
{
const size_t log_max = UINT_MAX >> 8;
size_t log_size = ctx->log_size;
- void *ptr;
+ char *ptr;
if (!ctx->log) {
log_size = 65536;
@@ -1169,6 +1169,7 @@ static int bpf_log_realloc(struct bpf_elf_ctx *ctx)
if (!ptr)
return -ENOMEM;
+ ptr[0] = 0;
ctx->log = ptr;
ctx->log_size = log_size;
--
2.14.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2/master] bpf: initialize the verifier log
2017-11-23 1:00 [PATCH iproute2/master] bpf: initialize the verifier log Jakub Kicinski
@ 2017-11-23 9:31 ` Daniel Borkmann
2017-11-24 4:48 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2017-11-23 9:31 UTC (permalink / raw)
To: Jakub Kicinski, netdev; +Cc: oss-drivers
On 11/23/2017 02:00 AM, Jakub Kicinski wrote:
> If program loading fails before verifier prints its first
> message, the verifier log will not be initialized. Always
> set the first character of the log buffer to zero to make
> sure we don't dump non-printable characters to the terminal.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2/master] bpf: initialize the verifier log
2017-11-23 1:00 [PATCH iproute2/master] bpf: initialize the verifier log Jakub Kicinski
2017-11-23 9:31 ` Daniel Borkmann
@ 2017-11-24 4:48 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2017-11-24 4:48 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, oss-drivers, daniel
On Wed, 22 Nov 2017 17:00:53 -0800
Jakub Kicinski <jakub.kicinski@netronome.com> wrote:
> If program loading fails before verifier prints its first
> message, the verifier log will not be initialized. Always
> set the first character of the log buffer to zero to make
> sure we don't dump non-printable characters to the terminal.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Applied thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-24 4:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-23 1:00 [PATCH iproute2/master] bpf: initialize the verifier log Jakub Kicinski
2017-11-23 9:31 ` Daniel Borkmann
2017-11-24 4:48 ` Stephen Hemminger
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).