Patch "bpf: Pack struct bpf_fib_lookup" has been added to the 6.1-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: Pack struct bpf_fib_lookup

to the 6.1-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-pack-struct-bpf_fib_lookup.patch
and it can be found in the queue-6.1 subdirectory.

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



commit ef6f302521566a62b0a431cbce99ac60b4640229
Author: Anton Protopopov <aspsk@xxxxxxxxxxxxx>
Date:   Wed Apr 3 14:33:03 2024 +0200

    bpf: Pack struct bpf_fib_lookup
    
    [ Upstream commit f91717007217d975aa975ddabd91ae1a107b9bff ]
    
    The struct bpf_fib_lookup is supposed to be of size 64. A recent commit
    59b418c7063d ("bpf: Add a check for struct bpf_fib_lookup size") added
    a static assertion to check this property so that future changes to the
    structure will not accidentally break this assumption.
    
    As it immediately turned out, on some 32-bit arm systems, when AEABI=n,
    the total size of the structure was equal to 68, see [1]. This happened
    because the bpf_fib_lookup structure contains a union of two 16-bit
    fields:
    
        union {
                __u16 tot_len;
                __u16 mtu_result;
        };
    
    which was supposed to compile to a 16-bit-aligned 16-bit field. On the
    aforementioned setups it was instead both aligned and padded to 32-bits.
    
    Declare this inner union as __attribute__((packed, aligned(2))) such
    that it always is of size 2 and is aligned to 16 bits.
    
      [1] https://lore.kernel.org/all/CA+G9fYtsoP51f-oP_Sp5MOq-Ffv8La2RztNpwvE6+R1VtFiLrw@xxxxxxxxxxxxxx/#t
    
    Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx>
    Fixes: e1850ea9bd9e ("bpf: bpf_fib_lookup return MTU value as output when looked up")
    Signed-off-by: Anton Protopopov <aspsk@xxxxxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Reviewed-by: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx>
    Acked-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20240403123303.1452184-1-aspsk@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index d5d2183730b9f..a17688011440e 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -6730,7 +6730,7 @@ struct bpf_fib_lookup {
 
 		/* output: MTU value */
 		__u16	mtu_result;
-	};
+	} __attribute__((packed, aligned(2)));
 	/* input: L3 device index for lookup
 	 * output: device index from FIB lookup
 	 */
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index d5d2183730b9f..a17688011440e 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -6730,7 +6730,7 @@ struct bpf_fib_lookup {
 
 		/* output: MTU value */
 		__u16	mtu_result;
-	};
+	} __attribute__((packed, aligned(2)));
 	/* input: L3 device index for lookup
 	 * output: device index from FIB lookup
 	 */




[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