Patch "libbpf: Add explicit padding to btf_dump_emit_type_decl_opts" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    libbpf: Add explicit padding to btf_dump_emit_type_decl_opts

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     libbpf-add-explicit-padding-to-btf_dump_emit_type_de.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 11b9d81e0c928392757cc854d4c2cfa88cc58a99
Author: KP Singh <kpsingh@xxxxxxxxxx>
Date:   Fri Mar 19 19:21:17 2021 +0000

    libbpf: Add explicit padding to btf_dump_emit_type_decl_opts
    
    [ Upstream commit ea24b19562fe5f72c78319dbb347b701818956d9 ]
    
    Similar to
    https://lore.kernel.org/bpf/20210313210920.1959628-2-andrii@xxxxxxxxxx/
    
    When DECLARE_LIBBPF_OPTS is used with inline field initialization, e.g:
    
      DECLARE_LIBBPF_OPTS(btf_dump_emit_type_decl_opts, opts,
        .field_name = var_ident,
        .indent_level = 2,
        .strip_mods = strip_mods,
      );
    
    and compiled in debug mode, the compiler generates code which
    leaves the padding uninitialized and triggers errors within libbpf APIs
    which require strict zero initialization of OPTS structs.
    
    Adding anonymous padding field fixes the issue.
    
    Fixes: 9f81654eebe8 ("libbpf: Expose BTF-to-C type declaration emitting API")
    Suggested-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Signed-off-by: KP Singh <kpsingh@xxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20210319192117.2310658-1-kpsingh@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 57247240a20a..9cabc8b620e3 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -164,6 +164,7 @@ struct btf_dump_emit_type_decl_opts {
 	int indent_level;
 	/* strip all the const/volatile/restrict mods */
 	bool strip_mods;
+	size_t :0;
 };
 #define btf_dump_emit_type_decl_opts__last_field strip_mods
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux