Patch "bpf: btf: fix truncated last_member_type_id in btf_struct_resolve" has been added to the 4.19-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

    bpf: btf: fix truncated last_member_type_id in btf_struct_resolve

to the 4.19-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:
     bpf-btf-fix-truncated-last_member_type_id-in-btf_str.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 75c0fefd0e218e196ba3393e13eb683f81dd358b
Author: Lorenz Bauer <oss@xxxxxx>
Date:   Sat Sep 10 11:01:20 2022 +0000

    bpf: btf: fix truncated last_member_type_id in btf_struct_resolve
    
    [ Upstream commit a37a32583e282d8d815e22add29bc1e91e19951a ]
    
    When trying to finish resolving a struct member, btf_struct_resolve
    saves the member type id in a u16 temporary variable. This truncates
    the 32 bit type id value if it exceeds UINT16_MAX.
    
    As a result, structs that have members with type ids > UINT16_MAX and
    which need resolution will fail with a message like this:
    
        [67414] STRUCT ff_device size=120 vlen=12
            effect_owners type_id=67434 bits_offset=960 Member exceeds struct_size
    
    Fix this by changing the type of last_member_type_id to u32.
    
    Fixes: a0791f0df7d2 ("bpf: fix BTF limits")
    Reviewed-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
    Signed-off-by: Lorenz Bauer <oss@xxxxxx>
    Link: https://lore.kernel.org/r/20220910110120.339242-1-oss@xxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 471cc5c117a5..62e05b6283c0 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -1660,7 +1660,7 @@ static int btf_struct_resolve(struct btf_verifier_env *env,
 	if (v->next_member) {
 		const struct btf_type *last_member_type;
 		const struct btf_member *last_member;
-		u16 last_member_type_id;
+		u32 last_member_type_id;
 
 		last_member = btf_type_member(v->t) + v->next_member - 1;
 		last_member_type_id = last_member->type;



[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