Re: [OpenWrt-Devel] [PATCH v2 libubox 05/10] add assert.h component
On Thu, Nov 21, 2019 at 12:17 AM Petr Štetiar wrote: > Michael Jones [2019-11-20 18:12:14]: > > > You may need #include_next, to avoid recursion. > > Is this some theoretical experience? Or you can provide me with some build > breakage? Just wondering, because #include should work this out with "" and > <>. > > BTW I would rather rename that include file to assert_internal.h, then > using > include_next. Anyway, as this builds fine on gcc 4.8,6,7,8,9 and with > clang-7,8,9,10 I would say, that it should be fine as it is. > > -- ynezz > My experience with this was with MSVC in 2015 or so, and a heavily patched version of STLPort. It's not obvious to me that you would encounter the same problem with GCC / Clang. I'm personally instantly averse to possible recursion issues because of how tricky they can be to debug, but if no one is concerned about it, it's not really an issue. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 07/12] config/Config-kernel.in: add options to enable dm-verity related kernel features
The dm-verity support requires a number of kernel options to be enabled. This commit adds the corresponding options to config/Config-kernel.in, so that they can be selected by other OpenWrt options when needed. Signed-off-by: Thomas Petazzoni --- Note: I sometimes encounter an issue at build time where the kernel configuration system would prompt me for the values of the new options made visible as a result of enabling those MD, BLK_DEV_DM, DM_VERITY and DM_INIT options. Interestingly, I don't seem to encounter this at every build. I'm not sure why OpenWrt doesn't simply run a "make olddefconfig" to automatically accept the default values for unspecified options. What is the appropriate course of action to solve this problem ? --- config/Config-kernel.in | 15 +++ 1 file changed, 15 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index bdb6b91cbb..eae413eb29 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -860,3 +860,18 @@ config KERNEL_CC_OPTIMIZE_FOR_SIZE your compiler resulting in a smaller kernel. endchoice + +config KERNEL_MD + bool "Multiple devices driver support (RAID and LVM)" + +config KERNEL_BLK_DEV_DM + bool "Device mapper support" + depends on KERNEL_MD + +config KERNEL_DM_VERITY + bool "Verity target support" + depends on KERNEL_BLK_DEV_DM + +config KERNEL_DM_INIT + bool "DM \"dm-mod.create=\" parameter support" + depends on KERNEL_BLK_DEV_DM -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 08/12] include/image-commands.mk: extend Build/fit for U-Boot script integration
This commit extends the Build/fit macro so that if a ITS_UBOOT_SCRIPT variable is defined, it is pass to the mkits.sh script as "-s" argument. This allows the ITS_UBOOT_SCRIPT file to be integrated as a U-Boot script in the FIT image. This will be used as part of the dm-verity integration to add in the FIT image a U-Boot script that provides the details of the dm-verity volume (salt, root hash, number of data blocks, start of hash blocks, etc.). Signed-off-by: Thomas Petazzoni --- include/image-commands.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/image-commands.mk b/include/image-commands.mk index 5dfd6a2c2f..3662cb2821 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -155,6 +155,7 @@ define Build/fit $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \ + $(if $(ITS_UBOOT_SCRIPT),-s $(ITS_UBOOT_SCRIPT)) \ -A $(LINUX_KARCH) -v $(LINUX_VERSION) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new @mv $@.new $@ -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 06/12] scripts/mkits.sh: extend with -s option to include a U-Boot script
The mkits.sh prepares a .its file describing a FIT image. This commit extends it to support a -s option, that allows to pass a file that should be embedded as a U-Boot script in the FIT image. This will be used as part of the dm-verity integration to add in the FIT image a U-Boot script that provides the details of the dm-verity volume (salt, root hash, number of data blocks, start of hash blocks, etc.). Signed-off-by: Thomas Petazzoni --- scripts/mkits.sh | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/mkits.sh b/scripts/mkits.sh index 93c8cedaed..ce14f664d6 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -16,7 +16,8 @@ usage() { echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \ - "-v version -k kernel [-D name -d dtb] -o its_file" + "-v version -k kernel [-D name -d dtb] -o its_file" \ + "-s script" echo -e "\t-A ==> set architecture to 'arch'" echo -e "\t-C ==> set compression type 'comp'" echo -e "\t-c ==> set config name 'config'" @@ -27,10 +28,11 @@ usage() { echo -e "\t-D ==> human friendly Device Tree Blob 'name'" echo -e "\t-d ==> include Device Tree Blob 'dtb'" echo -e "\t-o ==> create output file 'its_file'" + echo -e "\t-s ==> include U-Boot script 'script'" exit 1 } -while getopts ":A:a:c:C:D:d:e:k:o:v:" OPTION +while getopts ":A:a:c:C:D:d:e:k:o:s:v:" OPTION do case $OPTION in A ) ARCH=$OPTARG;; @@ -42,6 +44,7 @@ do e ) ENTRY_ADDR=$OPTARG;; k ) KERNEL=$OPTARG;; o ) OUTPUT=$OPTARG;; + s ) SCRIPT=$OPTARG;; v ) VERSION=$OPTARG;; * ) echo "Invalid option passed to '$0' (options:$@)" usage;; @@ -77,6 +80,18 @@ if [ -n "${DTB}" ]; then FDT_PROP="fdt = \"fdt@1\";" fi +# Conditionally create script information +if [ -n "${SCRIPT}" ]; then + SCRIPT=" + script { + description = \"Script\"; + data = /incbin/(\"${SCRIPT}\"); + type = \"script\"; + compression = \"none\"; + }; +" +fi + # Create a default, fully populated DTS file DATA="/dts-v1/; @@ -102,6 +117,9 @@ DATA="/dts-v1/; }; }; ${FDT_NODE} + +${SCRIPT} + }; configurations { -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 04/12] tools/libjson-c: new package
libjson-c is needed to build cryptsetup. While the host variant of libjson-c is already packaged in package/libs/libjson-c, we apparently can't express a dependency of something packaged in "tools/" against a library in package/libs/, so we have to duplicate libjson-c's Makefile in tools/libjson-c/. Signed-off-by: Thomas Petazzoni --- tools/libjson-c/Makefile | 25 + 1 file changed, 25 insertions(+) create mode 100644 tools/libjson-c/Makefile diff --git a/tools/libjson-c/Makefile b/tools/libjson-c/Makefile new file mode 100644 index 00..244594debc --- /dev/null +++ b/tools/libjson-c/Makefile @@ -0,0 +1,25 @@ +# +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=json-c +PKG_VERSION:=0.13.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/ +PKG_HASH:=b87e608d4d3f7bfdd36ef78d56d53c74e66ab278d318b71e6002a369d36f4873 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=COPYING + +HOST_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/host-build.mk + +$(eval $(call HostBuild)) -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 11/12] target/linux/mvebu: enable UBI factory image on Armada XP GP
The Armada XP GP has a NAND storage device, so it makes sense to generate the UBI-based factory image for this platform. Signed-off-by: Thomas Petazzoni --- target/linux/mvebu/image/cortex-a9.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mvebu/image/cortex-a9.mk b/target/linux/mvebu/image/cortex-a9.mk index c2ada75c2d..cf70031b99 100644 --- a/target/linux/mvebu/image/cortex-a9.mk +++ b/target/linux/mvebu/image/cortex-a9.mk @@ -148,6 +148,7 @@ define Device/marvell_axp-gp DEVICE_MODEL := Armada Armada XP GP (DB-MV784MP-GP) DEVICE_DTS := armada-xp-gp SUPPORTED_DEVICES += armada-xp-gp + IMAGES += factory.img endef TARGET_DEVICES += marvell_axp-gp -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 01/12] tools/libaio: new package
libaio for the host will be needed as a dependency of lvm2, itself a dependency of cryptsetup. Signed-off-by: Thomas Petazzoni --- tools/libaio/Makefile | 30 ++ 1 file changed, 30 insertions(+) create mode 100644 tools/libaio/Makefile diff --git a/tools/libaio/Makefile b/tools/libaio/Makefile new file mode 100644 index 00..bb5b43a69c --- /dev/null +++ b/tools/libaio/Makefile @@ -0,0 +1,30 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libaio +PKG_VERSION:=0.3.111 +PKG_HASH:=62cf871ad8fd09eb3418f00aca7a7d449299b8e1de31c65f28bf6a2ef1fa502a +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://releases.pagure.org/libaio + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR) +endef + +define Host/Install + $(MAKE) -C $(HOST_BUILD_DIR) prefix=$(HOST_BUILD_PREFIX) install +endef + +$(eval $(call HostBuild)) -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 02/12] tools/lvm2: new package
lvm2 for the host will be needed as a dependency to build cryptsetup for the host. Signed-off-by: Thomas Petazzoni --- tools/Makefile | 1 + tools/lvm2/Makefile | 47 + 2 files changed, 48 insertions(+) create mode 100644 tools/lvm2/Makefile diff --git a/tools/Makefile b/tools/Makefile index 2f57d25525..26e2d19fee 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -78,6 +78,7 @@ $(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile $(curdir)/cbootimage/compile += $(curdir)/automake/compile +$(curdir)/lvm2/compile := $(curdir)/pkg-config/compile $(curdir)/libaio/compile ifneq ($(HOST_OS),Linux) $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile diff --git a/tools/lvm2/Makefile b/tools/lvm2/Makefile new file mode 100644 index 00..8b37cbaa6c --- /dev/null +++ b/tools/lvm2/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lvm2 +PKG_VERSION:=2.02.180 +PKG_HASH:=24997e26dfc916151707c9da504d38d0473bec3481a8230b676bc079041bead6 +PKG_RELEASE:=1 + +PKG_SOURCE:=LVM2.$(PKG_VERSION).tgz +PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2/old + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk + +HOST_CONFIGURE_ARGS += \ +--enable-write_install \ +--enable-pkgconfig \ +--disable-cmdlib \ +--disable-dmeventd \ +--disable-applib \ +--disable-fsadm \ +--disable-readline \ +--disable-selinux + +# lvm2 unpacks in the wrong folder +define Host/Prepare + $(call Host/Prepare/Default) + mv $(HOST_BUILD_DIR)/../LVM2.$(PKG_VERSION)/* $(HOST_BUILD_DIR)/ + rmdir $(HOST_BUILD_DIR)/../LVM2.$(PKG_VERSION) +endef + +define Host/Compile + $(call Host/Compile/Default,device-mapper) +endef + +define Host/Install + $(call Host/Compile/Default,install_device-mapper) +endef + +$(eval $(call HostBuild)) -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 00/12] dm-verity support
Hello, This is the second iteration of my patch series adding support for dm-verity in OpenWRT. See below for some introduction about the purpose of this series. Changes since v1 - Rebase the patch series on the latest master. - Make sure all patches have @bootlin.com as author, and not some stale @free-electrons.com - Switch to using the upstream kernel patches to set up a DM target at boot time using the kernel command line, rather than patches that were submitted years ago and not merged. - Make sure kernel patches are provided for both 4.14 and 4.19 - Drop the SOURCE_DATE_EPOCH usage when creating the mksquashfs image. - Format the cryptsetup patch properly. - Only build the host tools if CONFIG_TARGET_ROOTFS_SQUASHFS_HASHED is enabled - Instead of unconditionally enabling the necessary kernel options for dm-verity support, we now add the appropriate options to config/Config-kernel.in, and select them only when needed. - Drop empty Host/Configure rule in tools/libaio/Makefile Introduction dm-verity is a Linux kernel Device Mapper target that verifies that the data in a block device has not been tampered with, by checking it at runtime against a hash tree, itself verified by a root hash, which is passed from a trusted source. dm-verity only supports read operations, so we only support the read-only squashfs root filesystem in this series. This "hash tree" is a bunch of metadata that needs to be stored on non-volatile storage. It can be appended to the filesystem data, or stored on a separate block device/partition. We have chosen to support only the case where it is appended to the filesystem data. In the proposed series: - Patches 1-5 introduce new host packages. The first four are simply dependencies needed for cryptsetup, which is the tool used to generate the hash tree at build time. - Patch 6 extends the mkits.sh script so that a U-Boot script can be embedded in a FIT image. Indeed, to set up a dm-verity device at boot time, you need to pass a lot of details to the kernel that describe the dm-verity device, including the root hash. Those details need to be trusted: having them as part of the FIT image allows to leverage the signing capabilities of FIT images. - Patch 7 extends config/Config-kernel.in to be able to enable the appropriate kernel options for dm-verity support. - Patch 8 allows to create a FIT image with an embedded U-Boot script, leveraging the feature added in patch 6. - Patch 9 adds the code itself that generates the dm-verity capable squashfs image, and a script that produces the U-Boot script with the various parameters needed to setup the DM device at boot time. - Patch 10 adds two kernel patches that allow setting up a DM device at boot time, which have been backported from the upstream kernel, while patch 10 updates the kernel configuration to enable the appropriate option for dm-verity. - Patches 11 and 12 are just related to enabling this mechanism on Armada XP GP, which is the platform I used to work on this topic. This work was tested on Armada XP GP, with both MMC and NAND storage. One aspect that is not solved by this patch series is the logic in the fstools programs to set up the overlay at boot time. Indeed, when there is a squashfs filesystem, fstools assumes that it can use the space after the squashfs filesystem for its overlay (in the MMC storage case). It is not the case with dm-verity, because we have the hash tree after the squashfs filesystem. This is something I intend to work on. Thomas Petazzoni Thomas Petazzoni (12): tools/libaio: new package tools/lvm2: new package tools/popt: new package tools/libjson-c: new package tools/cryptsetup: new package scripts/mkits.sh: extend with -s option to include a U-Boot script config/Config-kernel.in: add options to enable dm-verity related kernel features include/image-commands.mk: extend Build/fit for U-Boot script integration include/image.mk: add support for building a dm-verity enabled squashfs image target/linux/generic: backport patches adding DM_INIT functionality target/linux/mvebu: enable UBI factory image on Armada XP GP target/linux/mvebu: generate a FIT image on Armada XP GP with dm-verity config/Config-images.in | 8 + config/Config-kernel.in | 15 + include/image-commands.mk | 1 + include/image.mk | 17 +- scripts/mkits.sh | 22 +- scripts/prepare-dm-verity-uboot-script.sh | 41 ++ ...-to-directly-boot-to-a-mapped-device.patch | 668 ++ ...-init-fix-max-devices-targets-checks.patch | 48 ++ ...hang-in-early-create-error-condition.patch | 49 ++ ...ion-dm-init-fix-multi-device-example.patch | 45 ++ ...-to-directly-boot-to-a-mapped-device.patch | 668 ++ ...-init-fix-max-devices-tar
[OpenWrt-Devel] [PATCH v2 12/12] target/linux/mvebu: generate a FIT image on Armada XP GP with dm-verity
When a dm-verity capable is selected, the user will most likely need the U-Boot script that contains the various dm-verity related configuration details, needed by U-Boot to build the kernel command line with the appropriate dm="..." argument. Therefore, for the Marvell Armada XP GP platform, make sure a FIT image containing the dm-verity related U-Boot script is produced when CONFIG_TARGET_ROOTFS_SQUASHFS_HASHED is enabled. Signed-off-by: Thomas Petazzoni --- target/linux/mvebu/image/cortex-a9.mk | 14 ++ 1 file changed, 14 insertions(+) diff --git a/target/linux/mvebu/image/cortex-a9.mk b/target/linux/mvebu/image/cortex-a9.mk index cf70031b99..1d3d37e987 100644 --- a/target/linux/mvebu/image/cortex-a9.mk +++ b/target/linux/mvebu/image/cortex-a9.mk @@ -142,6 +142,19 @@ define Device/marvell_axp-db endef TARGET_DEVICES += marvell_axp-db +ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS_HASHED),y) +define Device/armada-xp-gp/kernel + ITS_UBOOT_SCRIPT := $(KDIR)/root.squashfs-hashed-dm-verity-uboot-script.txt + KERNEL := kernel-bin | append-dtb | fit none + KERNEL_SIZE := 4096k +endef +else +define Device/armada-xp-gp/kernel + KERNEL := kernel-bin | append-dtb | uImage none + KERNEL_SIZE := 4096k +endef +endif + define Device/marvell_axp-gp $(Device/NAND-512K) DEVICE_VENDOR := Marvell @@ -149,6 +162,7 @@ define Device/marvell_axp-gp DEVICE_DTS := armada-xp-gp SUPPORTED_DEVICES += armada-xp-gp IMAGES += factory.img + $(Device/armada-xp-gp/kernel) endef TARGET_DEVICES += marvell_axp-gp -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 10/12] target/linux/generic: backport patches adding DM_INIT functionality
The new DM_INIT functionality, merged in upstream Linux 5.1, allows to setup a device mapper target at boot time. It avoids the need to use an initramfs to setup a device mapper target. This is useful in the context of supporting dm-verity in OpenWRT. Signed-off-by: Thomas Petazzoni --- ...-to-directly-boot-to-a-mapped-device.patch | 668 ++ ...-init-fix-max-devices-targets-checks.patch | 48 ++ ...hang-in-early-create-error-condition.patch | 49 ++ ...ion-dm-init-fix-multi-device-example.patch | 45 ++ ...-to-directly-boot-to-a-mapped-device.patch | 668 ++ ...-init-fix-max-devices-targets-checks.patch | 48 ++ ...hang-in-early-create-error-condition.patch | 49 ++ ...ion-dm-init-fix-multi-device-example.patch | 45 ++ 8 files changed, 1620 insertions(+) create mode 100644 target/linux/generic/backport-4.14/390-dm-add-support-to-directly-boot-to-a-mapped-device.patch create mode 100644 target/linux/generic/backport-4.14/391-dm-init-fix-max-devices-targets-checks.patch create mode 100644 target/linux/generic/backport-4.14/392-dm-ioctl-fix-hang-in-early-create-error-condition.patch create mode 100644 target/linux/generic/backport-4.14/393-Documentation-dm-init-fix-multi-device-example.patch create mode 100644 target/linux/generic/backport-4.19/400-dm-add-support-to-directly-boot-to-a-mapped-device.patch create mode 100644 target/linux/generic/backport-4.19/401-dm-init-fix-max-devices-targets-checks.patch create mode 100644 target/linux/generic/backport-4.19/402-dm-ioctl-fix-hang-in-early-create-error-condition.patch create mode 100644 target/linux/generic/backport-4.19/403-Documentation-dm-init-fix-multi-device-example.patch diff --git a/target/linux/generic/backport-4.14/390-dm-add-support-to-directly-boot-to-a-mapped-device.patch b/target/linux/generic/backport-4.14/390-dm-add-support-to-directly-boot-to-a-mapped-device.patch new file mode 100644 index 00..291dbd783d --- /dev/null +++ b/target/linux/generic/backport-4.14/390-dm-add-support-to-directly-boot-to-a-mapped-device.patch @@ -0,0 +1,668 @@ +From d2f5bf5f2df9c9993564e4a03187f6aa79b58cc4 Mon Sep 17 00:00:00 2001 +From: Helen Koike +Date: Thu, 21 Feb 2019 17:33:34 -0300 +Subject: [PATCH 1/4] dm: add support to directly boot to a mapped device + +Add a "create" module parameter, which allows device-mapper targets to +be configured at boot time. This enables early use of DM targets in the +boot process (as the root device or otherwise) without the need of an +initramfs. + +The syntax used in the boot param is based on the concise format from +the dmsetup tool to follow the rule of least surprise: + + dmsetup table --concise /dev/mapper/lroot + +Which is: + dm-mod.create=[,+][;[,+]+] + +Where, + ::= The device name. + ::= ---- | "" +::= The device minor number | "" +::= "ro" | "rw" +::= + ::= "verity" | "linear" | ... + +For example, the following could be added in the boot parameters: +dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0 + +Only the targets that were tested are allowed and the ones that don't +change any block device when the device is create as read-only. For +example, mirror and cache targets are not allowed. The rationale behind +this is that if the user makes a mistake, choosing the wrong device to +be the mirror or the cache can corrupt data. + +The only targets initially allowed are: +* crypt +* delay +* linear +* snapshot-origin +* striped +* verity + +Co-developed-by: Will Drewry +Co-developed-by: Kees Cook +Co-developed-by: Enric Balletbo i Serra +Signed-off-by: Helen Koike +Reviewed-by: Kees Cook +Signed-off-by: Mike Snitzer +--- + Documentation/device-mapper/dm-init.txt | 114 + + drivers/md/Kconfig | 12 + + drivers/md/Makefile | 4 + + drivers/md/dm-init.c| 303 + drivers/md/dm-ioctl.c | 103 + include/linux/device-mapper.h | 9 + + 6 files changed, 545 insertions(+) + create mode 100644 Documentation/device-mapper/dm-init.txt + create mode 100644 drivers/md/dm-init.c + +diff --git a/Documentation/device-mapper/dm-init.txt b/Documentation/device-mapper/dm-init.txt +new file mode 100644 +index ..8464ee7c01b8 +--- /dev/null b/Documentation/device-mapper/dm-init.txt +@@ -0,0 +1,114 @@ ++Early creation of mapped devices ++ ++ ++It is possible to configure a device-mapper device to act as the root device for ++your system in two ways. ++ ++The first is to build an initial ramdisk which boots to a minimal userspace ++which configures the device, then pivot_root(8) in to it. ++ ++The second is to create one or more device-mappers using the module parameter ++"dm-mod.create=" through the ke
[OpenWrt-Devel] [PATCH v2 03/12] tools/popt: new package
popt for the host will be needed as a dependency of cryptsetup for the host. Signed-off-by: Thomas Petazzoni --- tools/popt/Makefile | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 tools/popt/Makefile diff --git a/tools/popt/Makefile b/tools/popt/Makefile new file mode 100644 index 00..7a6de9fa02 --- /dev/null +++ b/tools/popt/Makefile @@ -0,0 +1,22 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=popt +PKG_VERSION:=1.16 +PKG_HASH:=e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://rpm5.org/files/popt + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk + +$(eval $(call HostBuild)) -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 05/12] tools/cryptsetup: new package
cryptsetup for the host will be needed to create the hash tree of a dm-verity volume. Signed-off-by: Thomas Petazzoni --- tools/Makefile| 1 + tools/cryptsetup/Makefile | 28 +++ .../patches/0001-dont-use-c89.patch | 11 3 files changed, 40 insertions(+) create mode 100644 tools/cryptsetup/Makefile create mode 100644 tools/cryptsetup/patches/0001-dont-use-c89.patch diff --git a/tools/Makefile b/tools/Makefile index 26e2d19fee..cf91f04100 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -79,6 +79,7 @@ $(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/lvm2/compile := $(curdir)/pkg-config/compile $(curdir)/libaio/compile +$(curdir)/cryptsetup/compile := $(curdir)/pkg-config/compile $(curdir)/libressl/compile $(curdir)/lvm2/compile $(curdir)/popt/compile $(curdir)/libjson-c/compile ifneq ($(HOST_OS),Linux) $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile diff --git a/tools/cryptsetup/Makefile b/tools/cryptsetup/Makefile new file mode 100644 index 00..3e500b81ea --- /dev/null +++ b/tools/cryptsetup/Makefile @@ -0,0 +1,28 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=cryptsetup +PKG_VERSION_MAJOR:=2.0 +PKG_VERSION:=$(PKG_VERSION_MAJOR).6 +PKG_HASH:=7c51fae0f0e7ea9af0f515b2ac77009fb2969a6619ebab47d097dca38b083d30 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/linux/utils/cryptsetup/v$(PKG_VERSION_MAJOR)/ + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk + +HOST_CONFIGURE_ARGS += \ + --with-crypto-backend=openssl \ + --disable-kernel_crypto \ + --disable-blkid + +$(eval $(call HostBuild)) diff --git a/tools/cryptsetup/patches/0001-dont-use-c89.patch b/tools/cryptsetup/patches/0001-dont-use-c89.patch new file mode 100644 index 00..84ee9c0ec2 --- /dev/null +++ b/tools/cryptsetup/patches/0001-dont-use-c89.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in b/Makefile.in +@@ -901,7 +901,7 @@ tmpfilesd_DATA = $(am__append_5) + @PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) $(PYTHON_INCLUDES) -fno-strict-aliasing + @PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_LDFLAGS = -avoid-version -module -shared -export-dynamic + @PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_LIBADD = libcryptsetup.la $(PYTHON_LIBS) +-@CRYPTO_INTERNAL_ARGON2_TRUE@libargon2_la_CFLAGS = $(AM_CFLAGS) -std=c89 -pthread -O3 ++@CRYPTO_INTERNAL_ARGON2_TRUE@libargon2_la_CFLAGS = $(AM_CFLAGS) -pthread -O3 + @CRYPTO_INTERNAL_ARGON2_TRUE@libargon2_la_CPPFLAGS = $(AM_CPPFLAGS) \ + @CRYPTO_INTERNAL_ARGON2_TRUE@ -I lib/crypto_backend/argon2 \ + @CRYPTO_INTERNAL_ARGON2_TRUE@ -I lib/crypto_backend/argon2/blake2 -- 2.23.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 09/12] include/image.mk: add support for building a dm-verity enabled squashfs image
This commit adds a new TARGET_ROOTFS_SQUASHFS_HASHED option that asks OpenWRT to generate a squashfs image suitable for usage with dm-verity. The squashfs image is produced, and then passed through "cryptsetup format" which appends the hash tree to the image. The output of "cryptsetup format" is passed to a custom script that parses that output and generates a U-Boot script that defines U-Boot variables describing the different aspects of the dm-verity volume. Such values are necessary to be able to build the kernel command line to mount the dm-verity volume as the root filesystem. We provide a common Image/mkfs/squashfs-common macro, which gets used by both the normal SquashFS filesystem generation and the verity-hashed SquashFS filesystem generation. There is one difference between the two: the normal SquashFS filesystem is generated with -nopad, but the one generated for dm-verity is generated without -no-pad, as it needs to be properly aligned to a block size. Signed-off-by: Thomas Petazzoni --- config/Config-images.in | 8 + include/image.mk | 17 -- scripts/prepare-dm-verity-uboot-script.sh | 41 +++ tools/Makefile| 1 + 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100755 scripts/prepare-dm-verity-uboot-script.sh diff --git a/config/Config-images.in b/config/Config-images.in index 4ee0273f63..37e7ad6cff 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -153,6 +153,14 @@ menu "Target Images" default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) default 256 + config TARGET_ROOTFS_SQUASHFS_HASHED + bool "hash with veritysetup" + select KERNEL_MD + select KERNEL_BLK_DEV_DM + select KERNEL_DM_VERITY + select KERNEL_DM_INIT + depends on TARGET_ROOTFS_SQUASHFS + menuconfig TARGET_ROOTFS_UBIFS bool "ubifs" default y if USES_UBIFS diff --git a/include/image.mk b/include/image.mk index 8592c19b99..e4e4dc456d 100644 --- a/include/image.mk +++ b/include/image.mk @@ -90,6 +90,7 @@ endif JFFS2_BLOCKSIZE ?= 64k 128k fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS) += squashfs +fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS_HASHED) += squashfs-hashed fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE)) fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BLOCKSIZE)) fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4 @@ -239,11 +240,21 @@ endef $(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S -define Image/mkfs/squashfs +define Image/mkfs/squashfs-common $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \ - -nopad -noappend -root-owned \ + -noappend -root-owned \ -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \ - -processors 1 + -processors 1 $(2) +endef + +define Image/mkfs/squashfs + $(call Image/mkfs/squashfs-common,$(1),-nopad) +endef + +define Image/mkfs/squashfs-hashed + $(call Image/mkfs/squashfs-common,$(1)) + $(STAGING_DIR_HOST)/bin/veritysetup format --hash-offset=`stat -c "%s" $@` $@ $@ \ + | $(TOPDIR)/scripts/prepare-dm-verity-uboot-script.sh > $@-dm-verity-uboot-script.txt endef # $(1): board name diff --git a/scripts/prepare-dm-verity-uboot-script.sh b/scripts/prepare-dm-verity-uboot-script.sh new file mode 100755 index 00..846e52b989 --- /dev/null +++ b/scripts/prepare-dm-verity-uboot-script.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +while read line; do + key=$(echo ${line} | cut -f1 -d':') + value=$(echo ${line} | cut -f2 -d':') + + case "${key}" in + "UUID") + UUID=${value} + ;; + "Data blocks") + DATA_BLOCKS=${value} + ;; + "Data block size") + DATA_BLOCK_SIZE=${value} + ;; + "Hash block size") + HASH_BLOCK_SIZE=${value} + ;; + "Hash algorithm") + HASH_ALG=${value} + ;; + "Salt") + SALT=${value} + ;; + "Root hash") + ROOT_HASH=${value} + ;; + esac +done + +SECTORS=$((${DATA_BLOCKS} * 8)) + +echo setenv verity_sectors $((${DATA_BLOCKS} * 8)) +echo setenv verity_data_blocks ${DATA_BLOCKS} +echo setenv verity_hash_start $((${DATA_BLOCKS} + 1)) +echo setenv verity_data_block_sz ${DATA_BLOCK_SIZE} +echo setenv verity_hash_block_sz ${HASH_BLOCK_SIZE} +echo setenv verity_hash_alg ${HASH_ALG} +echo setenv verity_salt ${SALT} +echo setenv verity_root_hash ${ROOT_HASH} diff --git a/tools
Re: [OpenWrt-Devel] [PATCH 0/2] introduce label_mac into hostname and SSID
> -Original Message- > From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org] On > Behalf Of Piotr Dymacz > Sent: Sonntag, 17. November 2019 14:19 > To: m...@adrianschmutzler.de; openwrt-devel@lists.openwrt.org > Subject: Re: [OpenWrt-Devel] [PATCH 0/2] introduce label_mac into hostname > and SSID > Based on the feedback I've received on this, I've decided to bury it and conclude on the patches by marking them as "Rejected". Best Adrian openpgp-digital-signature.asc Description: PGP signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] mac80211: update to version 5.4-rc8
This updates mac80211 to backports based on kernel 5.4-rc8. The delete patches were applied upstream. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 8 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 6 +- ...ath10k-fix-latency-issue-for-QCA988x.patch | 42 --- ...ckports-pci-Include-linux-pci-aspm.h.patch | 24 ..._disable_link_state-wrapper-with-ret.patch | 43 --- ...t-to-changes-to-skb_get_hash_perturb.patch | 68 -- .../017-rt2x00-initialize-last_reset.patch| 35 -- ...1-rt2x00-introduce-rt2x00_platform_h.patch | 2 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 4 +- ...isabling_bands_through_platform_data.patch | 2 +- ...-rt2x00-add-rf-self-txdc-calibration.patch | 2 +- .../rt2x00/983-rt2x00-add-r-calibration.patch | 2 +- .../984-rt2x00-add-rxdcoc-calibration.patch | 2 +- .../985-rt2x00-add-rxiq-calibration.patch | 2 +- .../986-rt2x00-add-TX-LOFT-calibration.patch | 2 +- ...ting-on-DFS-channels-in-ETSI-domains.patch | 118 -- ...11-accept-deauth-frames-in-IBSS-mode.patch | 39 -- 18 files changed, 17 insertions(+), 386 deletions(-) delete mode 100644 package/kernel/mac80211/patches/ath/982-ath10k-fix-latency-issue-for-QCA988x.patch delete mode 100644 package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch delete mode 100644 package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch delete mode 100644 package/kernel/mac80211/patches/build/102-backports-Adapt-to-changes-to-skb_get_hash_perturb.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/017-rt2x00-initialize-last_reset.patch delete mode 100644 package/kernel/mac80211/patches/subsys/030-mac80211_fix-scan-when-operating-on-DFS-channels-in-ETSI-domains.patch delete mode 100644 package/kernel/mac80211/patches/subsys/363-mac80211-accept-deauth-frames-in-IBSS-mode.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 422c0436e4..9e4c362a2d 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.4-rc2-1 -PKG_RELEASE:=2 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4-rc2/ -PKG_HASH:=b3baedc135b455f09f266cb77e73276ca21bceeb0f24bac2184cc4b97d09cdbf +PKG_VERSION:=5.4-rc8-1 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4-rc8/ +PKG_HASH:=707ffc50d0f6fe3398bcc3a7abd44ffa088d9309255a3a71d014620c20d3bbf9 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch index 8221d78197..69c29f15ee 100644 --- a/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3071,6 +3071,16 @@ int ath10k_core_register(struct ath10k * +@@ -3074,6 +3074,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index ae0f682224..3cf1957060 100644 --- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -2788,6 +2794,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -2791,6 +2797,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3044,9 +3054,18 @@ static void ath10k_core_register_work(st +@@ -3047,9 +3057,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3092,6 +3111,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3095,6 +3114,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; diff --gi
[OpenWrt-Devel] [PATCH 19.07] mac80211: update to version 4.19.85
Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- ...fix-tx99-with-monitor-mode-interface.patch | 92 -- ...upport-for-using-active-monitor-inte.patch | 96 --- .../patches/ath/404-regd_no_assoc_hints.patch | 10 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- .../ath/930-ath10k_add_tpt_led_trigger.patch | 4 +- ...-of-peer_bw_rxnss_override-parameter.patch | 8 +- ...dling-for-VHT160-in-recent-firmwares.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 28 +++--- ...75-ath10k-use-tpt-trigger-by-default.patch | 2 +- ...ilable-channels-via-DT-ieee80211-fre.patch | 39 ...001-brcmfmac-fix-wrong-strnchr-usage.patch | 38 ...e-buffer-for-obtaining-firmware-capa.patch | 28 -- ...-Add-airtime-statistics-and-settings.patch | 8 +- ...te-hash-for-fq-without-holding-fq-lo.patch | 56 +++ ...nd-deauth-when-expiring-inactive-STA.patch | 6 +- ...t-to-changes-to-skb_get_hash_perturb.patch | 68 - .../522-mac80211_configure_antenna_gain.patch | 4 +- 18 files changed, 76 insertions(+), 421 deletions(-) delete mode 100644 package/kernel/mac80211/patches/ath/381-ath9k-fix-tx99-with-monitor-mode-interface.patch delete mode 100644 package/kernel/mac80211/patches/ath/395-ath9k-add-back-support-for-using-active-monitor-inte.patch delete mode 100644 package/kernel/mac80211/patches/ath/976-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch delete mode 100644 package/kernel/mac80211/patches/brcm/302-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch delete mode 100644 package/kernel/mac80211/patches/brcm/304-v4.20-0002-brcmfmac-increase-buffer-for-obtaining-firmware-capa.patch delete mode 100644 package/kernel/mac80211/patches/subsys/370-backports-Adapt-to-changes-to-skb_get_hash_perturb.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 8545f23298..ed104a53fc 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=4.19.79-1 +PKG_VERSION:=4.19.85-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v4.19.79/ -PKG_HASH:=ee03b16949e4968092cfed3cd763ff4682bc29fa3b52ebc239aa915583413cf3 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v4.19.85/ +PKG_HASH:=6a92df43e8c3e2410638d84dfd18773d667757532dd0a911227c9b7d65aee34d PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/381-ath9k-fix-tx99-with-monitor-mode-interface.patch b/package/kernel/mac80211/patches/ath/381-ath9k-fix-tx99-with-monitor-mode-interface.patch deleted file mode 100644 index d5c37825fd..00 --- a/package/kernel/mac80211/patches/ath/381-ath9k-fix-tx99-with-monitor-mode-interface.patch +++ /dev/null @@ -1,92 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Aug 2018 11:35:05 +0200 -Subject: [PATCH] ath9k: fix tx99 with monitor mode interface - -Tx99 is typically configured via a monitor mode interface, which does -not get added to the driver as a vif. Since the code currently expects -a configured virtual interface for tx99, enabling tx99 via debugfs fails. -Since the vif is not needed anyway, remove all checks for it. - -Signed-off-by: Felix Fietkau - a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -1074,7 +1074,6 @@ struct ath_softc { - - struct ath_spec_scan_priv spec_priv; - -- struct ieee80211_vif *tx99_vif; - struct sk_buff *tx99_skb; - bool tx99_state; - s16 tx99_power; a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1251,15 +1251,10 @@ static int ath9k_add_interface(struct ie - struct ath_vif *avp = (void *)vif->drv_priv; - struct ath_node *an = &avp->mcast_node; - -- mutex_lock(&sc->mutex); -+ if (IS_ENABLED(CPTCFG_ATH9K_TX99)) -+ return -EOPNOTSUPP; - -- if (IS_ENABLED(CPTCFG_ATH9K_TX99)) { -- if (sc->cur_chan->nvifs >= 1) { -- mutex_unlock(&sc->mutex); -- return -EOPNOTSUPP; -- } -- sc->tx99_vif = vif; -- } -+ mutex_lock(&sc->mutex); - - ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); - sc->cur_chan->nvifs++; -@@ -1342,7 +1337,6 @@ static void ath9k_remove_interface(struc - ath9k_p2p_remove_vif(sc, vif); - - sc->cur_chan->nvifs--; -- sc->tx99_vif = NULL; - if (!ath9k_is_chanctx_enabled()) - list_del(&avp->list); - a/drivers/net/wireless/ath/ath9k/tx99.c -+++ b/drivers/net/wireless/ath/ath9k/tx99.c -@@ -54,12 +54,6 @@ static struct sk_buff *ath9k_build_tx99_ - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *tx_info; - struct