]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'Implement formatted output helpers with bstr_printf'
authorAlexei Starovoitov <ast@kernel.org>
Tue, 27 Apr 2021 22:50:15 +0000 (15:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 27 Apr 2021 22:56:39 +0000 (15:56 -0700)
commit5d5e55b5594de782ac5336f1c64d5ac39d1ea61d
tree2a9455b9328ad460e138774aaf5af191091a7605
parentb880467b428ef4054e57511aded63e0d1f7dd7f5
parentdb71a8fd6b46a63084b9437105e75fd4a07bc058
Merge branch 'Implement formatted output helpers with bstr_printf'

Florent Revest says:

====================

BPF's formatted output helpers are currently implemented with
snprintf-like functions which use variadic arguments. The types of all
arguments need to be known at compilation time. BPF_CAST_FMT_ARG casts
all arguments to the size they should be (known at runtime), but the C
type promotion rules cast them back to u64s. On 32 bit architectures,
this can cause misaligned va_lists and generate mangled output.

This series refactors these helpers to avoid variadic arguments. It uses
a "binary printf" instead, where arguments are passed in a buffer
constructed at runtime.
---
Changes in v2:
- Reworded the second patch's description to better describe how
  arguments get mangled on 32 bit architectures
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>