From ecb0828fe9dba156308c2ff1b1bb5871dddd3d62 Mon Sep 17 00:00:00 2001 From: Alexander Miroshnichenko Date: Sun, 8 Aug 2021 19:40:13 +0300 Subject: [PATCH] sys-kernel/hardened-kernel: update kernel ath regd patche --- sys-kernel/hardened-kernel/Manifest | 3 +- .../files/linux-5.10/400-ath_regd.patch | 241 ++++++++++++++++++ .../linux-5.10/402-ath_regd_optional.patch | 84 ------ .../files/linux-5.10/405-ath_regd_us.patch | 26 -- 4 files changed, 242 insertions(+), 112 deletions(-) create mode 100644 sys-kernel/hardened-kernel/files/linux-5.10/400-ath_regd.patch delete mode 100644 sys-kernel/hardened-kernel/files/linux-5.10/402-ath_regd_optional.patch delete mode 100644 sys-kernel/hardened-kernel/files/linux-5.10/405-ath_regd_us.patch diff --git a/sys-kernel/hardened-kernel/Manifest b/sys-kernel/hardened-kernel/Manifest index 565f047..346a7f6 100644 --- a/sys-kernel/hardened-kernel/Manifest +++ b/sys-kernel/hardened-kernel/Manifest @@ -1,6 +1,5 @@ AUX linux-5.10.amd64.config 151819 BLAKE2B 4f0cf3a4eadc8c21bd66144c436431cf16993f6e984c50b93b5caaa1e5dc72cf9811c21df078c2ff08ef0ec6ef21e3a1c3da9d077f5cc7bb3818db0a10724535 SHA512 2b674f44ff35881dbac19d4f3ad229febe4c447ba7dd09554e909647d4574d4321402607021464f96f41eb4563f930e6a25f42e57c26f21eb645ab4b711c3857 -AUX linux-5.10/402-ath_regd_optional.patch 2220 BLAKE2B 34f749118fc101ad4d861b8d47db372f6e82f72555044bf8ba76c1126a924458632b8e5b455b2b6059646feace8c6d46d6f61cd935717984e4732f6760c29762 SHA512 85eddbe6fbd562e7af19b5430858f0186b2d676f7ebfddb92b7be309f7a7775d072cb77882a7a890fcc6e86aa361655ec8926029cc2adc97fd01369f9c6f3c5b -AUX linux-5.10/405-ath_regd_us.patch 947 BLAKE2B 6e01fccaf9ca1627309f01465e1dd7963e816174e43c9c1490d1b369a59db038b2cb513378ce2b3522608ee14e9be03b2588a9fe556b0704b3f8d40af5878596 SHA512 63d3ac537eb296de7de0d1d8aa566f7830431864254c28819cc0bb8551a58a94f9917c0193d9123169b05c1ec84d35e4c9a5db246b7cc97a9447647eb9fb607f +AUX linux-5.10/400-ath_regd.patch 6414 BLAKE2B 698c546f85e712feaa84ff3296bae2de35782676cf42677b8bb53b9f44314a25b1bd94b9ee6a66da12dbd016da1fe3bf0140c76eb61b37332294e637153fd31e SHA512 1db61a8d92ab35d7c72990e44c59039f60e356c67d693affcdb96cd0179b5e44abd3f029b4e6dd230b289451ac7d60daeaee0a5863fd344698d53cf3d3f1c618 AUX linux-5.10/beacon_timeout.patch 4047 BLAKE2B b182c326d5d750bec5f73b263124323f10fd452c839d540f21caa7fff46ffa0acb90433bece36efc29056362090cc2512ad116c135402056db557b601e41ab26 SHA512 3dd7e7b83b451ccfbb6285ea04ebcc11f6f1b08c6c676baba7942aa87f62e7118d4e4ad23fa4ddecf61968af5904084a7091712b6a67044b238f2a3f24a4701b DIST genpatches-4.19-124.base.tar.xz 3482680 BLAKE2B e8716be023f6512fb4613fab11a6ecf6472dd738cdb63669cfc6573e70030bfc5d3374c18672661867dd584d621cffdced21403a337af40b2428ff6703b6aa53 SHA512 dde38efe4b8e413b0aa1380c3fc4284b153b048a38cb8e05fdec34c14588d3e60092a20d247195389ceace0dc9e353caacaf9573c75a2327b4667dcad90c15fa DIST genpatches-4.19-124.extras.tar.xz 17516 BLAKE2B 1c7db2f9f888a9becf0dd891a3f9980431419af50552a4cda06c51f1a7b5d923698d6ce625c619b73386a300438f858a551ca53adc2a5bc110d6eda2a575a22d SHA512 4f29e993be982e272205c6d57e1828e7cc837abbde4a1e7b59e6b20eac648315bec135338b8f6e33df2b49d81e855a9f5c7eeebf6238fa8bc3bbd2215c324eff diff --git a/sys-kernel/hardened-kernel/files/linux-5.10/400-ath_regd.patch b/sys-kernel/hardened-kernel/files/linux-5.10/400-ath_regd.patch new file mode 100644 index 0000000..383e7d3 --- /dev/null +++ b/sys-kernel/hardened-kernel/files/linux-5.10/400-ath_regd.patch @@ -0,0 +1,241 @@ +diff -ur a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig +--- a/drivers/net/wireless/ath/Kconfig 2020-12-14 01:41:30.000000000 +0300 ++++ b/drivers/net/wireless/ath/Kconfig 2021-08-08 19:13:02.593510781 +0300 +@@ -23,6 +23,9 @@ + + if WLAN_VENDOR_ATH + ++config ATH_USER_REGD ++ bool "Do not enforce EEPROM regulatory restrictions" ++ + config ATH_DEBUG + bool "Atheros wireless debugging" + help +diff -ur a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c +--- a/drivers/net/wireless/ath/regd.c 2020-12-14 01:41:30.000000000 +0300 ++++ b/drivers/net/wireless/ath/regd.c 2021-08-08 19:33:31.943583458 +0300 +@@ -24,6 +24,7 @@ + #include "regd_common.h" + + static int __ath_regd_init(struct ath_regulatory *reg); ++static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn); + + /* + * This is a set of common rules used by our world regulatory domains. +@@ -43,7 +44,8 @@ + NL80211_RRF_NO_OFDM) + + /* We allow IBSS on these on a case by case basis by regulatory domain */ +-#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 80, 0, 30,\ ++#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\ ++ REG_RULE(5260-10, 5350+10, 80, 0, 30,\ + NL80211_RRF_NO_IR) + #define ATH_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\ + NL80211_RRF_NO_IR) +@@ -61,64 +63,79 @@ + #define ATH_5GHZ_NO_MIDBAND ATH_5GHZ_5150_5350, \ + ATH_5GHZ_5725_5850 + ++#define REGD_RULES(...) \ ++ .reg_rules = { __VA_ARGS__ }, \ ++ .n_reg_rules = ARRAY_SIZE(((struct ieee80211_reg_rule[]) { __VA_ARGS__ })) ++ + /* Can be used for: + * 0x60, 0x61, 0x62 */ + static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = { +- .n_reg_rules = 5, + .alpha2 = "99", +- .reg_rules = { ++ REGD_RULES( + ATH_2GHZ_ALL, + ATH_5GHZ_ALL, +- } ++ ) + }; + + /* Can be used by 0x63 and 0x65 */ + static const struct ieee80211_regdomain ath_world_regdom_63_65 = { +- .n_reg_rules = 4, + .alpha2 = "99", +- .reg_rules = { ++ REGD_RULES( + ATH_2GHZ_CH01_11, + ATH_2GHZ_CH12_13, + ATH_5GHZ_NO_MIDBAND, +- } ++ ) + }; + + /* Can be used by 0x64 only */ + static const struct ieee80211_regdomain ath_world_regdom_64 = { +- .n_reg_rules = 3, + .alpha2 = "99", +- .reg_rules = { ++ REGD_RULES( + ATH_2GHZ_CH01_11, + ATH_5GHZ_NO_MIDBAND, +- } ++ ) + }; + + /* Can be used by 0x66 and 0x69 */ + static const struct ieee80211_regdomain ath_world_regdom_66_69 = { +- .n_reg_rules = 3, + .alpha2 = "99", +- .reg_rules = { ++ REGD_RULES( + ATH_2GHZ_CH01_11, + ATH_5GHZ_ALL, +- } ++ ) + }; + + /* Can be used by 0x67, 0x68, 0x6A and 0x6C */ + static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = { +- .n_reg_rules = 4, + .alpha2 = "99", +- .reg_rules = { ++ REGD_RULES( + ATH_2GHZ_CH01_11, + ATH_2GHZ_CH12_13, + ATH_5GHZ_ALL, +- } ++ ) + }; + ++static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) ++{ ++ return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG; ++} ++ ++static bool is_default_regd(struct ath_regulatory *reg) ++{ ++ return ath_regd_get_eepromRD(reg) == CTRY_DEFAULT; ++} ++ + static bool dynamic_country_user_possible(struct ath_regulatory *reg) + { ++ if (IS_ENABLED(CONFIG_ATH_USER_REGD)) ++ return true; ++ + if (IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING)) + return true; + ++ if (is_default_regd(reg)) ++ return true; ++ + switch (reg->country_code) { + case CTRY_UNITED_STATES: + case CTRY_JAPAN1: +@@ -188,6 +205,8 @@ + + static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg) + { ++ if (IS_ENABLED(CONFIG_ATH_USER_REGD)) ++ return true; + if (!IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS)) + return false; + if (!dynamic_country_user_possible(reg)) +@@ -202,11 +221,6 @@ + (regd == WORLD)); + } + +-static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) +-{ +- return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG; +-} +- + bool ath_is_world_regd(struct ath_regulatory *reg) + { + return is_wwr_sku(ath_regd_get_eepromRD(reg)); +@@ -345,6 +359,9 @@ + struct ieee80211_channel *ch; + unsigned int i; + ++ if (IS_ENABLED(CONFIG_ATH_USER_REGD)) ++ return; ++ + for (band = 0; band < NUM_NL80211_BANDS; band++) { + if (!wiphy->bands[band]) + continue; +@@ -378,6 +395,9 @@ + { + struct ieee80211_supported_band *sband; + ++ if (IS_ENABLED(CONFIG_ATH_USER_REGD)) ++ return; ++ + sband = wiphy->bands[NL80211_BAND_2GHZ]; + if (!sband) + return; +@@ -407,6 +427,9 @@ + struct ieee80211_channel *ch; + unsigned int i; + ++ if (IS_ENABLED(CONFIG_ATH_USER_REGD)) ++ return; ++ + if (!wiphy->bands[NL80211_BAND_5GHZ]) + return; + +@@ -639,6 +662,13 @@ + const struct ieee80211_regdomain *regd; + + wiphy->reg_notifier = reg_notifier; ++ ++ if (IS_ENABLED(CONFIG_ATH_USER_REGD)) ++ return 0; ++ ++ if (is_default_regd(reg)) ++ return 0; ++ + wiphy->regulatory_flags |= REGULATORY_STRICT_REG | + REGULATORY_CUSTOM_REG; + +diff -ur a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h +--- a/drivers/net/wireless/ath/regd_common.h 2020-12-14 01:41:30.000000000 +0300 ++++ b/drivers/net/wireless/ath/regd_common.h 2021-08-08 19:24:22.943902679 +0300 +@@ -32,6 +32,7 @@ + FCC2_WORLD = 0x21, + FCC2_ETSIC = 0x22, + FCC6_WORLD = 0x23, ++ FCC3_FCCA_2 = 0x2A, + FRANCE_RES = 0x31, + FCC3_FCCA = 0x3A, + FCC3_WORLD = 0x3B, +@@ -172,6 +173,7 @@ + {FCC2_WORLD, CTL_FCC, CTL_ETSI}, + {FCC2_ETSIC, CTL_FCC, CTL_ETSI}, + {FCC3_FCCA, CTL_FCC, CTL_FCC}, ++ {FCC3_FCCA_2, CTL_FCC, CTL_FCC}, + {FCC3_WORLD, CTL_FCC, CTL_ETSI}, + {FCC3_ETSIC, CTL_FCC, CTL_ETSI}, + {FCC4_FCCA, CTL_FCC, CTL_FCC}, +@@ -483,6 +485,7 @@ + {CTRY_UAE, NULL1_WORLD, "AE"}, + {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, + {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, ++ {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"}, + {CTRY_UNITED_STATES2, FCC3_FCCA, "US"}, + {CTRY_UNITED_STATES3, FCC3_FCCA, "US"}, + /* This "PS" is for US public safety actually... to support this we +diff -ur a/net/wireless/reg.c b/net/wireless/reg.c +--- a/net/wireless/reg.c 2020-12-14 01:41:30.000000000 +0300 ++++ b/net/wireless/reg.c 2021-08-08 19:22:21.973240086 +0300 +@@ -3252,6 +3252,8 @@ + enum environment_cap env = ENVIRON_ANY; + struct regulatory_request *request = NULL, *lr; + ++ return; ++ + /* IE len must be evenly divisible by 2 */ + if (country_ie_len & 0x01) + return; +@@ -3503,6 +3505,7 @@ + + void regulatory_hint_disconnect(void) + { ++ return; + /* Restore of regulatory settings is not required when wiphy(s) + * ignore IE from connected access point but clearance of beacon hints + * is required when wiphy(s) supports beacon hints. diff --git a/sys-kernel/hardened-kernel/files/linux-5.10/402-ath_regd_optional.patch b/sys-kernel/hardened-kernel/files/linux-5.10/402-ath_regd_optional.patch deleted file mode 100644 index 2bff81c..0000000 --- a/sys-kernel/hardened-kernel/files/linux-5.10/402-ath_regd_optional.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -ur a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig ---- a/drivers/net/wireless/ath/Kconfig 2020-12-14 01:41:30.000000000 +0300 -+++ b/drivers/net/wireless/ath/Kconfig 2021-08-08 06:52:08.092139031 +0300 -@@ -23,6 +23,9 @@ - - if WLAN_VENDOR_ATH - -+config ATH_USER_REGD -+ bool "Do not enforce EEPROM regulatory restrictions" -+ - config ATH_DEBUG - bool "Atheros wireless debugging" - help -diff -ur a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c ---- a/drivers/net/wireless/ath/regd.c 2020-12-14 01:41:30.000000000 +0300 -+++ b/drivers/net/wireless/ath/regd.c 2021-08-08 06:50:55.891712802 +0300 -@@ -24,6 +24,7 @@ - #include "regd_common.h" - - static int __ath_regd_init(struct ath_regulatory *reg); -+static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn); - - /* - * This is a set of common rules used by our world regulatory domains. -@@ -116,6 +117,9 @@ - - static bool dynamic_country_user_possible(struct ath_regulatory *reg) - { -+ if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) -+ return true; -+ - if (IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING)) - return true; - -@@ -188,6 +192,8 @@ - - static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg) - { -+ if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) -+ return true; - if (!IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS)) - return false; - if (!dynamic_country_user_possible(reg)) -@@ -345,6 +351,9 @@ - struct ieee80211_channel *ch; - unsigned int i; - -+ if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) -+ return; -+ - for (band = 0; band < NUM_NL80211_BANDS; band++) { - if (!wiphy->bands[band]) - continue; -@@ -378,6 +387,9 @@ - { - struct ieee80211_supported_band *sband; - -+ if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) -+ return; -+ - sband = wiphy->bands[NL80211_BAND_2GHZ]; - if (!sband) - return; -@@ -407,6 +419,9 @@ - struct ieee80211_channel *ch; - unsigned int i; - -+ if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) -+ return; -+ - if (!wiphy->bands[NL80211_BAND_5GHZ]) - return; - -@@ -639,6 +654,10 @@ - const struct ieee80211_regdomain *regd; - - wiphy->reg_notifier = reg_notifier; -+ -+ if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) -+ return 0; -+ - wiphy->regulatory_flags |= REGULATORY_STRICT_REG | - REGULATORY_CUSTOM_REG; - diff --git a/sys-kernel/hardened-kernel/files/linux-5.10/405-ath_regd_us.patch b/sys-kernel/hardened-kernel/files/linux-5.10/405-ath_regd_us.patch deleted file mode 100644 index 0888331..0000000 --- a/sys-kernel/hardened-kernel/files/linux-5.10/405-ath_regd_us.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/net/wireless/ath/regd_common.h -+++ b/drivers/net/wireless/ath/regd_common.h -@@ -32,6 +32,7 @@ enum EnumRd { - FCC2_WORLD = 0x21, - FCC2_ETSIC = 0x22, - FCC6_WORLD = 0x23, -+ FCC3_FCCA_2 = 0x2A, - FRANCE_RES = 0x31, - FCC3_FCCA = 0x3A, - FCC3_WORLD = 0x3B, -@@ -172,6 +173,7 @@ static struct reg_dmn_pair_mapping regDo - {FCC2_WORLD, CTL_FCC, CTL_ETSI}, - {FCC2_ETSIC, CTL_FCC, CTL_ETSI}, - {FCC3_FCCA, CTL_FCC, CTL_FCC}, -+ {FCC3_FCCA_2, CTL_FCC, CTL_FCC}, - {FCC3_WORLD, CTL_FCC, CTL_ETSI}, - {FCC3_ETSIC, CTL_FCC, CTL_ETSI}, - {FCC4_FCCA, CTL_FCC, CTL_FCC}, -@@ -483,6 +485,7 @@ static struct country_code_to_enum_rd al - {CTRY_UAE, NULL1_WORLD, "AE"}, - {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, - {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, -+ {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"}, - {CTRY_UNITED_STATES2, FCC3_FCCA, "US"}, - {CTRY_UNITED_STATES3, FCC3_FCCA, "US"}, - /* This "PS" is for US public safety actually... to support this we