Message ID | 20201117205902.405316-1-samitolvanen@google.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] cfg80211: fix callback type mismatches in wext-compat | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | fail | Series targets non-next tree, but doesn't contain any Fixes tags |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | fail | ERROR: spaces required around that '=' (ctx:VxW) |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote: > Instead of casting callback functions to type iw_handler, which trips > indirect call checking with Clang's Control-Flow Integrity (CFI), add > stub functions with the correct function type for the callbacks. Oh, wow. iw_handler with union iwreq_data look like really nasty hacks. Aren't those just totally bypassing type checking? Where do the callbacks actually happen? I couldn't find them... > > Reported-by: Sedat Dilek <sedat.dilek@gmail.com> > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > --- > net/wireless/wext-compat.c | 103 +++++++++++++++++++++++++------------ > 1 file changed, 71 insertions(+), 32 deletions(-) > > diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c > index 78f2927ead7f..cf54c6e5b397 100644 > --- a/net/wireless/wext-compat.c > +++ b/net/wireless/wext-compat.c > @@ -1472,39 +1472,78 @@ static int cfg80211_wext_siwpmksa(struct net_device *dev, > } > } > > +#define DEFINE_WEXT_COMPAT_STUB(func, type) \ > + static int __ ## func(struct net_device *dev, \ > + struct iw_request_info *info, \ > + union iwreq_data *wrqu, \ > + char *extra) \ > + { \ > + return func(dev, info, (type *)wrqu, extra); \ > + } > + > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwname, char) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfreq, struct iw_freq) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfreq, struct iw_freq) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmode, u32) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwmode, u32) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrange, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwap, struct sockaddr) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwap, struct sockaddr) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmlme, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwscan, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwessid, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwessid, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrate, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrate, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrts, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrts, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfrag, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfrag, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwretry, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwretry, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencode, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwencode, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwpower, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpower, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwgenie, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwauth, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwauth, struct iw_param) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencodeext, struct iw_point) > +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpmksa, struct iw_point) > + > static const iw_handler cfg80211_handlers[] = { > - [IW_IOCTL_IDX(SIOCGIWNAME)] = (iw_handler) cfg80211_wext_giwname, > - [IW_IOCTL_IDX(SIOCSIWFREQ)] = (iw_handler) cfg80211_wext_siwfreq, > - [IW_IOCTL_IDX(SIOCGIWFREQ)] = (iw_handler) cfg80211_wext_giwfreq, > - [IW_IOCTL_IDX(SIOCSIWMODE)] = (iw_handler) cfg80211_wext_siwmode, > - [IW_IOCTL_IDX(SIOCGIWMODE)] = (iw_handler) cfg80211_wext_giwmode, > - [IW_IOCTL_IDX(SIOCGIWRANGE)] = (iw_handler) cfg80211_wext_giwrange, > - [IW_IOCTL_IDX(SIOCSIWAP)] = (iw_handler) cfg80211_wext_siwap, > - [IW_IOCTL_IDX(SIOCGIWAP)] = (iw_handler) cfg80211_wext_giwap, > - [IW_IOCTL_IDX(SIOCSIWMLME)] = (iw_handler) cfg80211_wext_siwmlme, > - [IW_IOCTL_IDX(SIOCSIWSCAN)] = (iw_handler) cfg80211_wext_siwscan, > - [IW_IOCTL_IDX(SIOCGIWSCAN)] = (iw_handler) cfg80211_wext_giwscan, > - [IW_IOCTL_IDX(SIOCSIWESSID)] = (iw_handler) cfg80211_wext_siwessid, > - [IW_IOCTL_IDX(SIOCGIWESSID)] = (iw_handler) cfg80211_wext_giwessid, > - [IW_IOCTL_IDX(SIOCSIWRATE)] = (iw_handler) cfg80211_wext_siwrate, > - [IW_IOCTL_IDX(SIOCGIWRATE)] = (iw_handler) cfg80211_wext_giwrate, > - [IW_IOCTL_IDX(SIOCSIWRTS)] = (iw_handler) cfg80211_wext_siwrts, > - [IW_IOCTL_IDX(SIOCGIWRTS)] = (iw_handler) cfg80211_wext_giwrts, > - [IW_IOCTL_IDX(SIOCSIWFRAG)] = (iw_handler) cfg80211_wext_siwfrag, > - [IW_IOCTL_IDX(SIOCGIWFRAG)] = (iw_handler) cfg80211_wext_giwfrag, > - [IW_IOCTL_IDX(SIOCSIWTXPOW)] = (iw_handler) cfg80211_wext_siwtxpower, > - [IW_IOCTL_IDX(SIOCGIWTXPOW)] = (iw_handler) cfg80211_wext_giwtxpower, > - [IW_IOCTL_IDX(SIOCSIWRETRY)] = (iw_handler) cfg80211_wext_siwretry, > - [IW_IOCTL_IDX(SIOCGIWRETRY)] = (iw_handler) cfg80211_wext_giwretry, > - [IW_IOCTL_IDX(SIOCSIWENCODE)] = (iw_handler) cfg80211_wext_siwencode, > - [IW_IOCTL_IDX(SIOCGIWENCODE)] = (iw_handler) cfg80211_wext_giwencode, > - [IW_IOCTL_IDX(SIOCSIWPOWER)] = (iw_handler) cfg80211_wext_siwpower, > - [IW_IOCTL_IDX(SIOCGIWPOWER)] = (iw_handler) cfg80211_wext_giwpower, > - [IW_IOCTL_IDX(SIOCSIWGENIE)] = (iw_handler) cfg80211_wext_siwgenie, > - [IW_IOCTL_IDX(SIOCSIWAUTH)] = (iw_handler) cfg80211_wext_siwauth, > - [IW_IOCTL_IDX(SIOCGIWAUTH)] = (iw_handler) cfg80211_wext_giwauth, > - [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= (iw_handler) cfg80211_wext_siwencodeext, > - [IW_IOCTL_IDX(SIOCSIWPMKSA)] = (iw_handler) cfg80211_wext_siwpmksa, > + [IW_IOCTL_IDX(SIOCGIWNAME)] = __cfg80211_wext_giwname, > + [IW_IOCTL_IDX(SIOCSIWFREQ)] = __cfg80211_wext_siwfreq, > + [IW_IOCTL_IDX(SIOCGIWFREQ)] = __cfg80211_wext_giwfreq, > + [IW_IOCTL_IDX(SIOCSIWMODE)] = __cfg80211_wext_siwmode, > + [IW_IOCTL_IDX(SIOCGIWMODE)] = __cfg80211_wext_giwmode, > + [IW_IOCTL_IDX(SIOCGIWRANGE)] = __cfg80211_wext_giwrange, > + [IW_IOCTL_IDX(SIOCSIWAP)] = __cfg80211_wext_siwap, > + [IW_IOCTL_IDX(SIOCGIWAP)] = __cfg80211_wext_giwap, > + [IW_IOCTL_IDX(SIOCSIWMLME)] = __cfg80211_wext_siwmlme, > + [IW_IOCTL_IDX(SIOCSIWSCAN)] = cfg80211_wext_siwscan, > + [IW_IOCTL_IDX(SIOCGIWSCAN)] = __cfg80211_wext_giwscan, > + [IW_IOCTL_IDX(SIOCSIWESSID)] = __cfg80211_wext_siwessid, > + [IW_IOCTL_IDX(SIOCGIWESSID)] = __cfg80211_wext_giwessid, > + [IW_IOCTL_IDX(SIOCSIWRATE)] = __cfg80211_wext_siwrate, > + [IW_IOCTL_IDX(SIOCGIWRATE)] = __cfg80211_wext_giwrate, > + [IW_IOCTL_IDX(SIOCSIWRTS)] = __cfg80211_wext_siwrts, > + [IW_IOCTL_IDX(SIOCGIWRTS)] = __cfg80211_wext_giwrts, > + [IW_IOCTL_IDX(SIOCSIWFRAG)] = __cfg80211_wext_siwfrag, > + [IW_IOCTL_IDX(SIOCGIWFRAG)] = __cfg80211_wext_giwfrag, > + [IW_IOCTL_IDX(SIOCSIWTXPOW)] = cfg80211_wext_siwtxpower, > + [IW_IOCTL_IDX(SIOCGIWTXPOW)] = cfg80211_wext_giwtxpower, > + [IW_IOCTL_IDX(SIOCSIWRETRY)] = __cfg80211_wext_siwretry, > + [IW_IOCTL_IDX(SIOCGIWRETRY)] = __cfg80211_wext_giwretry, > + [IW_IOCTL_IDX(SIOCSIWENCODE)] = __cfg80211_wext_siwencode, > + [IW_IOCTL_IDX(SIOCGIWENCODE)] = __cfg80211_wext_giwencode, > + [IW_IOCTL_IDX(SIOCSIWPOWER)] = __cfg80211_wext_siwpower, > + [IW_IOCTL_IDX(SIOCGIWPOWER)] = __cfg80211_wext_giwpower, > + [IW_IOCTL_IDX(SIOCSIWGENIE)] = __cfg80211_wext_siwgenie, > + [IW_IOCTL_IDX(SIOCSIWAUTH)] = __cfg80211_wext_siwauth, > + [IW_IOCTL_IDX(SIOCGIWAUTH)] = __cfg80211_wext_giwauth, > + [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= __cfg80211_wext_siwencodeext, > + [IW_IOCTL_IDX(SIOCSIWPMKSA)] = __cfg80211_wext_siwpmksa, > }; > > const struct iw_handler_def cfg80211_wext_handler = { > > base-commit: 9c87c9f41245baa3fc4716cf39141439cf405b01 > -- > 2.29.2.299.gdc1121823c-goog >
On Tue, Nov 17, 2020 at 1:45 PM Kees Cook <keescook@chromium.org> wrote: > > On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote: > > Instead of casting callback functions to type iw_handler, which trips > > indirect call checking with Clang's Control-Flow Integrity (CFI), add > > stub functions with the correct function type for the callbacks. > > Oh, wow. iw_handler with union iwreq_data look like really nasty hacks. > Aren't those just totally bypassing type checking? Where do the > callbacks actually happen? I couldn't find them... The callbacks to these happen in ioctl_standard_call in wext-core.c. Sami
On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote: > Instead of casting callback functions to type iw_handler, which trips > indirect call checking with Clang's Control-Flow Integrity (CFI), add > stub functions with the correct function type for the callbacks. > > Reported-by: Sedat Dilek <sedat.dilek@gmail.com> > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org>
On Tue, Nov 17, 2020 at 02:07:43PM -0800, Sami Tolvanen wrote: > On Tue, Nov 17, 2020 at 1:45 PM Kees Cook <keescook@chromium.org> wrote: > > > > On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote: > > > Instead of casting callback functions to type iw_handler, which trips > > > indirect call checking with Clang's Control-Flow Integrity (CFI), add > > > stub functions with the correct function type for the callbacks. > > > > Oh, wow. iw_handler with union iwreq_data look like really nasty hacks. > > Aren't those just totally bypassing type checking? Where do the > > callbacks actually happen? I couldn't find them... > > The callbacks to these happen in ioctl_standard_call in wext-core.c. Thanks! If this is all the 'old compat' code, this patch looks fine. I think new stuff should probably encode types in some fashion (rather than via wrappers).
On Fri, 2020-11-20 at 11:26 -0800, Kees Cook wrote: > On Tue, Nov 17, 2020 at 02:07:43PM -0800, Sami Tolvanen wrote: > > On Tue, Nov 17, 2020 at 1:45 PM Kees Cook <keescook@chromium.org> wrote: > > > On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote: > > > > Instead of casting callback functions to type iw_handler, which trips > > > > indirect call checking with Clang's Control-Flow Integrity (CFI), add > > > > stub functions with the correct function type for the callbacks. > > > > > > Oh, wow. iw_handler with union iwreq_data look like really nasty hacks. > > > Aren't those just totally bypassing type checking? Where do the > > > callbacks actually happen? I couldn't find them... > > > > The callbacks to these happen in ioctl_standard_call in wext-core.c. > > Thanks! If this is all the 'old compat' code, this patch looks fine. I > think new stuff should probably encode types in some fashion (rather > than via wrappers). Everything mentioning wext has been deprecated for something like 15 years ... so yeah. But people still use it :( johannes
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 78f2927ead7f..cf54c6e5b397 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -1472,39 +1472,78 @@ static int cfg80211_wext_siwpmksa(struct net_device *dev, } } +#define DEFINE_WEXT_COMPAT_STUB(func, type) \ + static int __ ## func(struct net_device *dev, \ + struct iw_request_info *info, \ + union iwreq_data *wrqu, \ + char *extra) \ + { \ + return func(dev, info, (type *)wrqu, extra); \ + } + +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwname, char) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfreq, struct iw_freq) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfreq, struct iw_freq) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmode, u32) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwmode, u32) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrange, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwap, struct sockaddr) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwap, struct sockaddr) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmlme, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwscan, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwessid, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwessid, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrate, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrate, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrts, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrts, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfrag, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfrag, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwretry, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwretry, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencode, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwencode, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwpower, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpower, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwgenie, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwauth, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwauth, struct iw_param) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencodeext, struct iw_point) +DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpmksa, struct iw_point) + static const iw_handler cfg80211_handlers[] = { - [IW_IOCTL_IDX(SIOCGIWNAME)] = (iw_handler) cfg80211_wext_giwname, - [IW_IOCTL_IDX(SIOCSIWFREQ)] = (iw_handler) cfg80211_wext_siwfreq, - [IW_IOCTL_IDX(SIOCGIWFREQ)] = (iw_handler) cfg80211_wext_giwfreq, - [IW_IOCTL_IDX(SIOCSIWMODE)] = (iw_handler) cfg80211_wext_siwmode, - [IW_IOCTL_IDX(SIOCGIWMODE)] = (iw_handler) cfg80211_wext_giwmode, - [IW_IOCTL_IDX(SIOCGIWRANGE)] = (iw_handler) cfg80211_wext_giwrange, - [IW_IOCTL_IDX(SIOCSIWAP)] = (iw_handler) cfg80211_wext_siwap, - [IW_IOCTL_IDX(SIOCGIWAP)] = (iw_handler) cfg80211_wext_giwap, - [IW_IOCTL_IDX(SIOCSIWMLME)] = (iw_handler) cfg80211_wext_siwmlme, - [IW_IOCTL_IDX(SIOCSIWSCAN)] = (iw_handler) cfg80211_wext_siwscan, - [IW_IOCTL_IDX(SIOCGIWSCAN)] = (iw_handler) cfg80211_wext_giwscan, - [IW_IOCTL_IDX(SIOCSIWESSID)] = (iw_handler) cfg80211_wext_siwessid, - [IW_IOCTL_IDX(SIOCGIWESSID)] = (iw_handler) cfg80211_wext_giwessid, - [IW_IOCTL_IDX(SIOCSIWRATE)] = (iw_handler) cfg80211_wext_siwrate, - [IW_IOCTL_IDX(SIOCGIWRATE)] = (iw_handler) cfg80211_wext_giwrate, - [IW_IOCTL_IDX(SIOCSIWRTS)] = (iw_handler) cfg80211_wext_siwrts, - [IW_IOCTL_IDX(SIOCGIWRTS)] = (iw_handler) cfg80211_wext_giwrts, - [IW_IOCTL_IDX(SIOCSIWFRAG)] = (iw_handler) cfg80211_wext_siwfrag, - [IW_IOCTL_IDX(SIOCGIWFRAG)] = (iw_handler) cfg80211_wext_giwfrag, - [IW_IOCTL_IDX(SIOCSIWTXPOW)] = (iw_handler) cfg80211_wext_siwtxpower, - [IW_IOCTL_IDX(SIOCGIWTXPOW)] = (iw_handler) cfg80211_wext_giwtxpower, - [IW_IOCTL_IDX(SIOCSIWRETRY)] = (iw_handler) cfg80211_wext_siwretry, - [IW_IOCTL_IDX(SIOCGIWRETRY)] = (iw_handler) cfg80211_wext_giwretry, - [IW_IOCTL_IDX(SIOCSIWENCODE)] = (iw_handler) cfg80211_wext_siwencode, - [IW_IOCTL_IDX(SIOCGIWENCODE)] = (iw_handler) cfg80211_wext_giwencode, - [IW_IOCTL_IDX(SIOCSIWPOWER)] = (iw_handler) cfg80211_wext_siwpower, - [IW_IOCTL_IDX(SIOCGIWPOWER)] = (iw_handler) cfg80211_wext_giwpower, - [IW_IOCTL_IDX(SIOCSIWGENIE)] = (iw_handler) cfg80211_wext_siwgenie, - [IW_IOCTL_IDX(SIOCSIWAUTH)] = (iw_handler) cfg80211_wext_siwauth, - [IW_IOCTL_IDX(SIOCGIWAUTH)] = (iw_handler) cfg80211_wext_giwauth, - [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= (iw_handler) cfg80211_wext_siwencodeext, - [IW_IOCTL_IDX(SIOCSIWPMKSA)] = (iw_handler) cfg80211_wext_siwpmksa, + [IW_IOCTL_IDX(SIOCGIWNAME)] = __cfg80211_wext_giwname, + [IW_IOCTL_IDX(SIOCSIWFREQ)] = __cfg80211_wext_siwfreq, + [IW_IOCTL_IDX(SIOCGIWFREQ)] = __cfg80211_wext_giwfreq, + [IW_IOCTL_IDX(SIOCSIWMODE)] = __cfg80211_wext_siwmode, + [IW_IOCTL_IDX(SIOCGIWMODE)] = __cfg80211_wext_giwmode, + [IW_IOCTL_IDX(SIOCGIWRANGE)] = __cfg80211_wext_giwrange, + [IW_IOCTL_IDX(SIOCSIWAP)] = __cfg80211_wext_siwap, + [IW_IOCTL_IDX(SIOCGIWAP)] = __cfg80211_wext_giwap, + [IW_IOCTL_IDX(SIOCSIWMLME)] = __cfg80211_wext_siwmlme, + [IW_IOCTL_IDX(SIOCSIWSCAN)] = cfg80211_wext_siwscan, + [IW_IOCTL_IDX(SIOCGIWSCAN)] = __cfg80211_wext_giwscan, + [IW_IOCTL_IDX(SIOCSIWESSID)] = __cfg80211_wext_siwessid, + [IW_IOCTL_IDX(SIOCGIWESSID)] = __cfg80211_wext_giwessid, + [IW_IOCTL_IDX(SIOCSIWRATE)] = __cfg80211_wext_siwrate, + [IW_IOCTL_IDX(SIOCGIWRATE)] = __cfg80211_wext_giwrate, + [IW_IOCTL_IDX(SIOCSIWRTS)] = __cfg80211_wext_siwrts, + [IW_IOCTL_IDX(SIOCGIWRTS)] = __cfg80211_wext_giwrts, + [IW_IOCTL_IDX(SIOCSIWFRAG)] = __cfg80211_wext_siwfrag, + [IW_IOCTL_IDX(SIOCGIWFRAG)] = __cfg80211_wext_giwfrag, + [IW_IOCTL_IDX(SIOCSIWTXPOW)] = cfg80211_wext_siwtxpower, + [IW_IOCTL_IDX(SIOCGIWTXPOW)] = cfg80211_wext_giwtxpower, + [IW_IOCTL_IDX(SIOCSIWRETRY)] = __cfg80211_wext_siwretry, + [IW_IOCTL_IDX(SIOCGIWRETRY)] = __cfg80211_wext_giwretry, + [IW_IOCTL_IDX(SIOCSIWENCODE)] = __cfg80211_wext_siwencode, + [IW_IOCTL_IDX(SIOCGIWENCODE)] = __cfg80211_wext_giwencode, + [IW_IOCTL_IDX(SIOCSIWPOWER)] = __cfg80211_wext_siwpower, + [IW_IOCTL_IDX(SIOCGIWPOWER)] = __cfg80211_wext_giwpower, + [IW_IOCTL_IDX(SIOCSIWGENIE)] = __cfg80211_wext_siwgenie, + [IW_IOCTL_IDX(SIOCSIWAUTH)] = __cfg80211_wext_siwauth, + [IW_IOCTL_IDX(SIOCGIWAUTH)] = __cfg80211_wext_giwauth, + [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= __cfg80211_wext_siwencodeext, + [IW_IOCTL_IDX(SIOCSIWPMKSA)] = __cfg80211_wext_siwpmksa, }; const struct iw_handler_def cfg80211_wext_handler = {
Instead of casting callback functions to type iw_handler, which trips indirect call checking with Clang's Control-Flow Integrity (CFI), add stub functions with the correct function type for the callbacks. Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> --- net/wireless/wext-compat.c | 103 +++++++++++++++++++++++++------------ 1 file changed, 71 insertions(+), 32 deletions(-) base-commit: 9c87c9f41245baa3fc4716cf39141439cf405b01