[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210423011517.4069221-1-revest@chromium.org>
Date: Fri, 23 Apr 2021 03:15:15 +0200
From: Florent Revest <revest@...omium.org>
To: bpf@...r.kernel.org
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
kpsingh@...nel.org, jackmanb@...gle.com, linux@...musvillemoes.dk,
linux-kernel@...r.kernel.org, Florent Revest <revest@...omium.org>
Subject: [PATCH bpf-next 0/2] Implement BPF formatted output helpers with bstr_printf
Our formatted output helpers are currently implemented with
snprintf-like functions which take arguments as va_list but the types
stored in a va_list need to be known at compilation time which causes
problems when dealing with arguments from the BPF world that are always
u64 but considered differently depending on the format specifiers they
are associated with at runtime.
This series replaces snprintf usages with bstr_printf calls. This lets
us construct a binary representation of arguments in bpf_printf_prepare
at runtime that matches an ABI that is neither arch nor compiler
specific.
This solves a bug reported by Rasmus Villemoes that would mangle
arguments on 32 bit machines.
Florent Revest (2):
seq_file: Add a seq_bprintf function
bpf: Implement formatted output helpers with bstr_printf
fs/seq_file.c | 18 ++++
include/linux/bpf.h | 22 +----
include/linux/seq_file.h | 4 +
init/Kconfig | 1 +
kernel/bpf/helpers.c | 188 +++++++++++++++++++++------------------
kernel/bpf/verifier.c | 2 +-
kernel/trace/bpf_trace.c | 34 +++----
7 files changed, 137 insertions(+), 132 deletions(-)
--
2.31.1.498.g6c1eba8ee3d-goog
Powered by blists - more mailing lists