Unverified Commit 95bd470a authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6546 v2 CVE-2024-26907

Merge Pull Request from: @ci-robot 
 
PR sync from: Ziyang Xuan <william.xuanziyang@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/QY2NN5RGVCTJQN63KR46ADNEG7TZK6QG/ 
Patchset of CVE-2024-26907.

v2:
  - Add new bugfix patch for patch 1.

Alexey Dobriyan (1):
  uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++

Kees Cook (1):
  [Backport] stddef: Introduce DECLARE_FLEX_ARRAY() helper

Leon Romanovsky (1):
  RDMA/mlx5: Fix fortify source warning while accessing Eth segment


-- 
2.25.1
 
https://gitee.com/src-openeuler/kernel/issues/I9HK6L 
 
Link:https://gitee.com/openeuler/kernel/pulls/6546

 

Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents cabbfee6 bbf46e26
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ static void set_eth_seg(const struct ib_send_wr *wr, struct mlx5_ib_qp *qp,
		 */
		copysz = min_t(u64, *cur_edge - (void *)eseg->inline_hdr.start,
			       left);
		memcpy(eseg->inline_hdr.start, pdata, copysz);
		memcpy(eseg->inline_hdr.data, pdata, copysz);
		stride = ALIGN(sizeof(struct mlx5_wqe_eth_seg) -
			       sizeof(eseg->inline_hdr.start) + copysz, 16);
		*size += stride / 16;
+4 −1
Original line number Diff line number Diff line
@@ -261,7 +261,10 @@ struct mlx5_wqe_eth_seg {
	union {
		struct {
			__be16 sz;
			union {
				u8     start[2];
				DECLARE_FLEX_ARRAY(u8, data);
			};
		} inline_hdr;
		struct {
			__be16 type;
+13 −0
Original line number Diff line number Diff line
@@ -84,4 +84,17 @@ enum {
#define struct_group_tagged(TAG, NAME, MEMBERS...) \
	__struct_group(TAG, NAME, /* no attrs */, MEMBERS)

/**
 * DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
 *
 * @TYPE: The type of each flexible array element
 * @NAME: The name of the flexible array member
 *
 * In order to have a flexible array member in a union or alone in a
 * struct, it needs to be wrapped in an anonymous struct with at least 1
 * named member, but that member can be empty.
 */
#define DECLARE_FLEX_ARRAY(TYPE, NAME) \
	__DECLARE_FLEX_ARRAY(TYPE, NAME)

#endif
+23 −0
Original line number Diff line number Diff line
@@ -28,4 +28,27 @@
		struct { MEMBERS } ATTRS; \
		struct TAG { MEMBERS } ATTRS NAME; \
	}

#ifdef __cplusplus
/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
#define __DECLARE_FLEX_ARRAY(T, member)	\
	T member[0]
#else
/**
 * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
 *
 * @TYPE: The type of each flexible array element
 * @NAME: The name of the flexible array member
 *
 * In order to have a flexible array member in a union or alone in a
 * struct, it needs to be wrapped in an anonymous struct with at least 1
 * named member, but that member can be empty.
 */
#define __DECLARE_FLEX_ARRAY(TYPE, NAME)	\
	struct { \
		struct { } __empty_ ## NAME; \
		TYPE NAME[]; \
	}
#endif

#endif
+2 −1
Original line number Diff line number Diff line
@@ -1232,7 +1232,8 @@ sub dump_struct($$) {
	$members =~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
	# replace DECLARE_KFIFO_PTR
	$members =~ s/DECLARE_KFIFO_PTR\s*\(([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;

	# replace DECLARE_FLEX_ARRAY
	$members =~ s/(?:__)?DECLARE_FLEX_ARRAY\s*\($args,\s*$args\)/$1 $2\[\]/gos;
	my $declaration = $members;

	# Split nested struct/union elements as newer ones