Merge ~vicamo/ubuntu/+source/broadcom-sta:bug-2030978/ubsan/jammy into ubuntu/+source/broadcom-sta:ubuntu/jammy-devel

Proposed by You-Sheng Yang
Status: Merged
Merged at revision: ab00da77596845abd3ef1200b62389e2ebf5d5ef
Proposed branch: ~vicamo/ubuntu/+source/broadcom-sta:bug-2030978/ubsan/jammy
Merge into: ubuntu/+source/broadcom-sta:ubuntu/jammy-devel
Diff against target: 224 lines (+202/-0)
3 files modified
debian/changelog (+9/-0)
debian/patches/43-broadcom-wl-fix-linux-6.5.patch (+192/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Vladimir Petko (community) Approve
Ubuntu Kernel DKMS Uploaders Pending
git-ubuntu import Pending
Review via email: mp+490933@code.launchpad.net

Commit message

[ Joan Bruguera Micó ]

* UBSAN: array-index-out-of-bounds (LP: #2030978)
  - 43-broadcom-wl-fix-linux-6.5.patch

To post a comment you must log in.
Revision history for this message
You-Sheng Yang (vicamo) wrote :
Download full text (3.8 KiB)

Build test against following kernels:
* 5.15.0-25-generic
* 5.15.0-72-generic
* 5.15.0-73-generic
* 5.15.0-75-generic
* 5.15.0-77-generic
* 5.15.0-78-generic
* 5.15.0-79-generic
* 5.15.0-82-generic
* 5.15.0-83-generic
* 5.15.0-84-generic
* 5.15.0-85-generic
* 5.15.0-86-generic
* 5.15.0-87-generic
* 5.15.0-88-generic
* 5.15.0-89-generic
* 5.15.0-90-generic
* 5.15.0-91-generic
* 5.15.0-92-generic
* 5.15.0-93-generic
* 5.15.0-94-generic
* 5.15.0-97-generic
* 5.15.0-100-generic
* 5.15.0-101-generic
* 5.15.0-102-generic
* 5.15.0-104-generic
* 5.15.0-105-generic
* 5.15.0-106-generic
* 5.15.0-107-generic
* 5.15.0-111-generic
* 5.15.0-112-generic
* 5.15.0-113-generic
* 5.15.0-115-generic
* 5.15.0-116-generic
* 5.15.0-117-generic
* 5.15.0-118-generic
* 5.15.0-119-generic
* 5.15.0-120-generic
* 5.15.0-121-generic
* 5.15.0-122-generic
* 5.15.0-124-generic
* 5.15.0-125-generic
* 5.15.0-126-generic
* 5.15.0-127-generic
* 5.15.0-128-generic
* 5.15.0-130-generic
* 5.15.0-131-generic
* 5.15.0-132-generic
* 5.15.0-133-generic
* 5.15.0-134-generic
* 5.15.0-135-generic
* 5.15.0-138-generic
* 5.15.0-139-generic
* 5.15.0-140-generic
* 5.15.0-141-generic
* 5.15.0-142-generic
* 5.15.0-143-generic
* 5.15.0-144-generic
* 5.15.0-150-generic
* 5.15.0-151-generic
* 5.15.0-152-generic
* 5.15.0-156-generic
* 5.17.0-1003-oem
* 5.17.0-1031-oem
* 5.17.0-1032-oem
* 5.17.0-1033-oem
* 5.17.0-1034-oem
* 5.17.0-1035-oem
* 5.17.0-15-generic
* 5.19.0-41-generic
* 5.19.0-42-generic
* 5.19.0-43-generic
* 5.19.0-45-generic
* 5.19.0-46-generic
* 5.19.0-50-generic
* 6.0.0-1016-oem
* 6.0.0-1017-oem
* 6.0.0-1018-oem
* 6.0.0-1019-oem
* 6.0.0-1020-oem
* 6.0.0-1021-oem
* 6.1.0-1012-oem
* 6.1.0-1013-oem
* 6.1.0-1014-oem
* 6.1.0-1015-oem
* 6.1.0-1016-oem
* 6.1.0-1017-oem
* 6.1.0-1018-oem
* 6.1.0-1019-oem
* 6.1.0-1020-oem
* 6.1.0-1021-oem
* 6.1.0-1022-oem
* 6.1.0-1023-oem
* 6.1.0-1024-oem
* 6.1.0-1025-oem
* 6.1.0-1026-oem
* 6.1.0-1027-oem
* 6.1.0-1028-oem
* 6.1.0-1029-oem
* 6.1.0-1032-oem
* 6.1.0-1033-oem
* 6.1.0-1034-oem
* 6.1.0-1035-oem
* 6.1.0-1036-oem
* 6.2.0-23-generic
* 6.2.0-25-generic
* 6.2.0-26-generic
* 6.2.0-31-generic
* 6.2.0-32-generic
* 6.2.0-33-generic
* 6.2.0-34-generic
* 6.2.0-35-generic
* 6.2.0-36-generic
* 6.2.0-37-generic
* 6.2.0-39-generic
* 6.5.0-1001-oem
* 6.5.0-1002-oem
* 6.5.0-1003-oem
* 6.5.0-1004-oem
* 6.5.0-1005-oem
* 6.5.0-1006-oem
* 6.5.0-1007-oem
* 6.5.0-1008-oem
* 6.5.0-1009-oem
* 6.5.0-1010-oem
* 6.5.0-1011-oem
* 6.5.0-1013-oem
* 6.5.0-1014-oem
* 6.5.0-1015-oem
* 6.5.0-1016-oem
* 6.5.0-1018-oem
* 6.5.0-1019-oem
* 6.5.0-1020-oem
* 6.5.0-1021-oem
* 6.5.0-1022-oem
* 6.5.0-1023-oem
* 6.5....

Read more...

Revision history for this message
You-Sheng Yang (vicamo) wrote :

Pushed to https://launchpad.net/~vicamo/+archive/ubuntu/ppa-2120508 for verification and review.

Revision history for this message
Vladimir Petko (vpa1977) wrote :

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading broadcom-sta_6.30.223.271-23~22.04.2.dsc: done.
  Uploading broadcom-sta_6.30.223.271-23~22.04.2.debian.tar.xz: done.
  Uploading broadcom-sta_6.30.223.271-23~22.04.2_source.buildinfo: done.
  Uploading broadcom-sta_6.30.223.271-23~22.04.2_source.changes: done.
Successfully uploaded packages.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 764b1ca..97c5123 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+broadcom-sta (6.30.223.271-23~22.04.2) jammy; urgency=medium
7+
8+ [ Joan Bruguera Micó ]
9+
10+ * UBSAN: array-index-out-of-bounds (LP: #2030978)
11+ - 43-broadcom-wl-fix-linux-6.5.patch
12+
13+ -- You-Sheng Yang <vicamo@gmail.com> Sun, 17 Aug 2025 23:37:22 +0800
14+
15 broadcom-sta (6.30.223.271-23~22.04.1) jammy; urgency=medium
16
17 * Lunar import, remove dh-dkms from Build-dep (LP: #2002636).
18diff --git a/debian/patches/43-broadcom-wl-fix-linux-6.5.patch b/debian/patches/43-broadcom-wl-fix-linux-6.5.patch
19new file mode 100644
20index 0000000..2a86027
21--- /dev/null
22+++ b/debian/patches/43-broadcom-wl-fix-linux-6.5.patch
23@@ -0,0 +1,192 @@
24+From: =?utf-8?q?Joan_Bruguera_Mic=C3=B3?= <joanbrugue...@gmail.com>
25+Date: Sat, 5 Aug 2023 20:54:12 +0000
26+Subject: Tentative patch for broadcom-wl 6.30.223.271 driver for Linux
27+ 6.5-rc1
28+
29+Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-36 on Arch Linux
30+
31+On Linux 6.5, due to commit 2d47c6956ab3 ("ubsan: Tighten UBSAN_BOUNDS
32+on GCC"), flexible trailing arrays declared like `whatever_t foo[1];`
33+will generate warnings when CONFIG_UBSAN & co. is enabled, such as:
34+
35+ UBSAN: array-index-out-of-bounds in /var/lib/dkms/broadcom-wl/6.30.223.271/build/amd64/src/wl/sys/wl_linux.c:1919:4
36+ index 2 is out of range for type 'ether_addr [1]'
37+ CPU: 8 PID: 131 Comm: kworker/8:1 Tainted: P OE [...]
38+ Hardware name: [...]
39+ Workqueue: ipv6_addrconf addrconf_dad_work
40+ Call Trace:
41+ <TASK>
42+ dump_stack_lvl+0x47/0x60
43+ __ubsan_handle_out_of_bounds+0xc7/0x100
44+ _wl_set_multicast_list+0x372/0x710 [wl b2d4dadbf09aee67f0822b96bf7f4b96338be49b]
45+ ? __dev_mc_add+0xb3/0x150
46+ [...]
47+
48+This was technically always wrong, but was detected now because of the
49+commit above, and because Ubuntu 23.04 enables CONFIG_UBSAN by default.
50+Thanks to Satadru Pramanik for the heads-up & report.
51+
52+Migrate them to the standard C99 syntax `whatever_t foo[];` to fix it.
53+(Quite a few trailing one-element arrays remain unchanged, either
54+because they are never used, or never accessed past the first element)
55+
56+Reported-by: Satadru Pramanik <sata...@gmail.com>
57+Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d47c6956ab3c8b580a59d7704aab3e2a4882b6c
58+Link: https://lwn.net/Articles/936728/
59+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2030978
60+Origin: backport, https://bugs.launchpad.net/ubuntu/+source/broadcom-sta/+bug/2030978/+attachment/5691493/+files/broadcom-wl-fix-linux-6.5.patch
61+Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
62+---
63+ amd64/src/include/bcmutils.h | 2 +-
64+ amd64/src/include/wlioctl.h | 10 +++++-----
65+ amd64/src/wl/sys/wl_cfg80211_hybrid.c | 4 ++--
66+ amd64/src/wl/sys/wl_cfg80211_hybrid.h | 8 ++++----
67+ amd64/src/wl/sys/wl_iw.c | 4 ++--
68+ 5 files changed, 14 insertions(+), 14 deletions(-)
69+
70+diff --git a/amd64/src/include/bcmutils.h b/amd64/src/include/bcmutils.h
71+index 5fafe3d..7ad55ae 100644
72+--- a/amd64/src/include/bcmutils.h
73++++ b/amd64/src/include/bcmutils.h
74+@@ -558,7 +558,7 @@ typedef struct bcm_bit_desc_ex {
75+ typedef struct bcm_tlv {
76+ uint8 id;
77+ uint8 len;
78+- uint8 data[1];
79++ uint8 data[];
80+ } bcm_tlv_t;
81+
82+ #define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (int)(buflen) >= (int)(2 + (elt)->len))
83+diff --git a/amd64/src/include/wlioctl.h b/amd64/src/include/wlioctl.h
84+index 2c05c7c..d47ce17 100644
85+--- a/amd64/src/include/wlioctl.h
86++++ b/amd64/src/include/wlioctl.h
87+@@ -91,7 +91,7 @@ typedef struct wl_scan_results {
88+ uint32 buflen;
89+ uint32 version;
90+ uint32 count;
91+- wl_bss_info_t bss_info[1];
92++ wl_bss_info_t bss_info[];
93+ } wl_scan_results_t;
94+
95+ #define WL_MAXRATES_IN_SET 16
96+@@ -129,7 +129,7 @@ typedef struct wl_uint32_list {
97+
98+ uint32 count;
99+
100+- uint32 element[1];
101++ uint32 element[];
102+ } wl_uint32_list_t;
103+
104+ typedef struct wl_assoc_params {
105+@@ -247,7 +247,7 @@ typedef struct _pmkid {
106+
107+ typedef struct _pmkid_list {
108+ uint32 npmkid;
109+- pmkid_t pmkid[1];
110++ pmkid_t pmkid[];
111+ } pmkid_list_t;
112+
113+ typedef struct _pmkid_cand {
114+@@ -257,7 +257,7 @@ typedef struct _pmkid_cand {
115+
116+ typedef struct _pmkid_cand_list {
117+ uint32 npmkid_cand;
118+- pmkid_cand_t pmkid_cand[1];
119++ pmkid_cand_t pmkid_cand[];
120+ } pmkid_cand_list_t;
121+
122+ typedef struct {
123+@@ -278,7 +278,7 @@ typedef struct channel_info {
124+
125+ struct maclist {
126+ uint count;
127+- struct ether_addr ea[1];
128++ struct ether_addr ea[];
129+ };
130+
131+ typedef struct wl_ioctl {
132+diff --git a/amd64/src/wl/sys/wl_cfg80211_hybrid.c b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
133+index b4f1e55..030028a 100644
134+--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.c
135++++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
136+@@ -1613,7 +1613,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
137+ struct cfg80211_pmksa *pmksa)
138+ {
139+ struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
140+- struct _pmkid_list pmkid;
141++ struct { pmkid_t pmkid[1]; } pmkid;
142+ s32 err = 0;
143+ int i;
144+
145+@@ -2021,7 +2021,7 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info
146+ WL_DBG(("Beacon is larger than buffer. Discarding\n"));
147+ return -E2BIG;
148+ }
149+- notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) +
150++ notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) +
151+ WL_BSS_INFO_MAX, GFP_KERNEL);
152+ if (!notif_bss_info) {
153+ WL_ERR(("notif_bss_info alloc failed\n"));
154+diff --git a/amd64/src/wl/sys/wl_cfg80211_hybrid.h b/amd64/src/wl/sys/wl_cfg80211_hybrid.h
155+index bc6f3ad..35674ea 100644
156+--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.h
157++++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.h
158+@@ -103,7 +103,7 @@ struct beacon_proberesp {
159+ __le64 timestamp;
160+ __le16 beacon_int;
161+ __le16 capab_info;
162+- u8 variable[0];
163++ u8 variable[];
164+ } __attribute__ ((packed));
165+
166+ struct wl_cfg80211_conf {
167+@@ -126,7 +126,7 @@ struct wl_cfg80211_bss_info {
168+ u16 channel;
169+ s16 rssi;
170+ u16 frame_len;
171+- u8 frame_buf[1];
172++ u8 frame_buf[];
173+ };
174+
175+ struct wl_cfg80211_scan_req {
176+@@ -142,7 +142,7 @@ struct wl_cfg80211_event_q {
177+ struct list_head eq_list;
178+ u32 etype;
179+ wl_event_msg_t emsg;
180+- s8 edata[1];
181++ s8 edata[];
182+ };
183+
184+ struct wl_cfg80211_security {
185+@@ -174,7 +174,7 @@ struct wl_cfg80211_assoc_ielen {
186+
187+ struct wl_cfg80211_pmk_list {
188+ pmkid_list_t pmkids;
189+- pmkid_t foo[MAXPMKID - 1];
190++ pmkid_t foo[MAXPMKID];
191+ };
192+
193+ struct wl_cfg80211_priv {
194+diff --git a/amd64/src/wl/sys/wl_iw.c b/amd64/src/wl/sys/wl_iw.c
195+index e346b15..e28de40 100644
196+--- a/amd64/src/wl/sys/wl_iw.c
197++++ b/amd64/src/wl/sys/wl_iw.c
198+@@ -1875,7 +1875,7 @@ wl_iw_set_encodeext(
199+ #if WIRELESS_EXT > 17
200+ struct {
201+ pmkid_list_t pmkids;
202+- pmkid_t foo[MAXPMKID-1];
203++ pmkid_t foo[MAXPMKID];
204+ } pmkid_list;
205+ static int
206+ wl_iw_set_pmksa(
207+@@ -1898,7 +1898,7 @@ wl_iw_set_pmksa(
208+ bzero((char *)&pmkid_list, sizeof(pmkid_list));
209+ }
210+ if (iwpmksa->cmd == IW_PMKSA_REMOVE) {
211+- pmkid_list_t pmkid, *pmkidptr;
212++ struct { pmkid_t pmkid[1]; } pmkid, *pmkidptr;
213+ pmkidptr = &pmkid;
214+ bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, ETHER_ADDR_LEN);
215+ bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID, WPA2_PMKID_LEN);
216diff --git a/debian/patches/series b/debian/patches/series
217index ad2880d..493e478 100644
218--- a/debian/patches/series
219+++ b/debian/patches/series
220@@ -26,3 +26,4 @@
221 27-linux600.patch
222 28-wl-Update-for-linux-5.17-deprecations.patch
223 29-linux601.patch
224+43-broadcom-wl-fix-linux-6.5.patch

Subscribers

People subscribed via source and target branches