diff -Nru mstflint-4.21.0+1/debian/changelog mstflint-4.21.0+1/debian/changelog --- mstflint-4.21.0+1/debian/changelog 2022-08-17 09:12:52.000000000 +0000 +++ mstflint-4.21.0+1/debian/changelog 2024-04-12 20:26:39.000000000 +0000 @@ -1,3 +1,30 @@ +mstflint (4.21.0+1-1ubuntu0.1) mantic; urgency=medium + + * Add mstflint-dkms package to avoid a regression from jammy. + LP: #2061182. This backports the packaging changes from noble that + introduce the mstflint-dkms binary, which depends on the following + backport of the install-dkms target from upstream: + - d/p/0001-debian-mstflint-mstflint-dkms-packages-generation.patch + * A bug in the kernel module can lead to UBSAN errors in dmesg upon + device closure. LP: #2061185. Backport changes to fix that: + - d/p/0002-Fix-illegal-shift-in-mst_release.patch + - d/p/0003-Fix-typo.patch (fix for previous patch) + * Backport change to clarify the licensing terms for the mstflint_access + kernel module. LP: #2061186. + - d/p/0004-Add-missed-license.patch + * The kernel modules source in mstflint 4.21 FTBFS w/ the 6.5 kernel. + LP: #2043098. Backport changes to fix that: + - d/p/0005-fix-kernel-module-build-on-kernel-6.4.patch + - d/p/0006-kernel-module-fix-wrong-comparison-order.patch (fix for + previous patch). + * Since we have now backported every patch that touches the kernel module + source between 4.21.0 and 4.26.0, use 4.26.0 as the upstream version for + the mstflint-dkms deb. This requires a patch to let us override the + version during the build: + - d/p/kernel-module-config-version.patch + + -- dann frazier Fri, 12 Apr 2024 14:26:39 -0600 + mstflint (4.21.0+1-1) unstable; urgency=medium * New upstream release: diff -Nru mstflint-4.21.0+1/debian/clean mstflint-4.21.0+1/debian/clean --- mstflint-4.21.0+1/debian/clean 2021-02-03 11:43:07.000000000 +0000 +++ mstflint-4.21.0+1/debian/clean 2024-04-09 21:58:50.000000000 +0000 @@ -15,3 +15,4 @@ resourceparse/mstresourceparse common/python_wrapper common/tools_version.py +debian/mstflint-dkms.dkms diff -Nru mstflint-4.21.0+1/debian/control mstflint-4.21.0+1/debian/control --- mstflint-4.21.0+1/debian/control 2022-08-17 02:42:23.000000000 +0000 +++ mstflint-4.21.0+1/debian/control 2024-04-09 21:58:50.000000000 +0000 @@ -1,10 +1,12 @@ Source: mstflint Section: net Priority: optional -Maintainer: Debian HPC Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian HPC Team Uploaders: Mehdi Dogguy , Tzafrir Cohen Build-Depends: debhelper-compat (= 13), + dh-sequence-dkms, libboost-filesystem-dev, libboost-regex-dev, libboost-system-dev, @@ -23,6 +25,7 @@ Vcs-Git: https://salsa.debian.org/hpc-team/mstflint.git Vcs-Browser: https://salsa.debian.org/hpc-team/mstflint Homepage: https://github.com/Mellanox/mstflint +Testsuite: autopkgtest-pkg-dkms Package: mstflint Architecture: linux-any @@ -30,6 +33,7 @@ python3, ${misc:Depends}, ${shlibs:Depends} +Suggests: mstflint-dkms Description: Mellanox firmware burning application and diagnostics tools This package contains a burning tool and diagnostic tools for Mellanox manufactured host channel adapters (HCA) and network interface cards (NIC). @@ -38,3 +42,24 @@ HCA/NIC cards. Using it with cards manufactured by other vendors may be harmful to the cards (due to different configurations). Using the diagnostic tools is normally safe for all HCAs/NICs. + +Package: mstflint-dkms +Section: kernel +Priority: optional +Architecture: all +Depends: dkms, + make, + ${misc:Depends} +Enhances: mstlint +Description: mstflint kernel module for Linux + The mstflint userspace tools require a kernel module to operate in + Secure Boot mode. This package provides the required module source, + and will build that module for your kernel upon installation. + . + Note: This module will need to be signed by a trusted key in order + for your kernel to load it when booted in Secure Boot mode. + For information on how to do this, see the appropriate documentation + for your distribution. For Debian and Ubuntu: + . + https://wiki.debian.org/SecureBoot + https://wiki.ubuntu.com/UEFI/SecureBoot diff -Nru mstflint-4.21.0+1/debian/docs mstflint-4.21.0+1/debian/docs --- mstflint-4.21.0+1/debian/docs 2020-08-26 21:16:29.000000000 +0000 +++ mstflint-4.21.0+1/debian/docs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -README diff -Nru mstflint-4.21.0+1/debian/mstflint-dkms.dkms.in mstflint-4.21.0+1/debian/mstflint-dkms.dkms.in --- mstflint-4.21.0+1/debian/mstflint-dkms.dkms.in 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/mstflint-dkms.dkms.in 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,11 @@ +kernelver=${kernelver:-$(uname -r)} +kernel_source_dir=${kernel_source_dir:-/lib/modules/$kernelver/build} + +PACKAGE_NAME="mstflint" +PACKAGE_VERSION="@PKGVER@" +BUILT_MODULE_NAME[0]="mstflint_access" +BUILT_MODULE_LOCATION[0]="./" +DEST_MODULE_LOCATION[0]="/kernel/../misc/" +MAKE="make KPVER=$kernelver KSRC=$kernel_source_dir all" +CLEAN="make clean" +AUTOINSTALL="yes" diff -Nru mstflint-4.21.0+1/debian/mstflint-dkms.install mstflint-4.21.0+1/debian/mstflint-dkms.install --- mstflint-4.21.0+1/debian/mstflint-dkms.install 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/mstflint-dkms.install 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1 @@ +usr/src/mstflint-*/* diff -Nru mstflint-4.21.0+1/debian/mstflint.docs mstflint-4.21.0+1/debian/mstflint.docs --- mstflint-4.21.0+1/debian/mstflint.docs 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/mstflint.docs 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1 @@ +README diff -Nru mstflint-4.21.0+1/debian/mstflint.install mstflint-4.21.0+1/debian/mstflint.install --- mstflint-4.21.0+1/debian/mstflint.install 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/mstflint.install 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,3 @@ +usr/bin/* +usr/lib/* +usr/share/* diff -Nru mstflint-4.21.0+1/debian/patches/0001-debian-mstflint-mstflint-dkms-packages-generation.patch mstflint-4.21.0+1/debian/patches/0001-debian-mstflint-mstflint-dkms-packages-generation.patch --- mstflint-4.21.0+1/debian/patches/0001-debian-mstflint-mstflint-dkms-packages-generation.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/0001-debian-mstflint-mstflint-dkms-packages-generation.patch 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,43 @@ +From 7ef4dfbf5466161af6ff4b70133e0da06e23e01f Mon Sep 17 00:00:00 2001 +From: Alex Blago +Date: Sun, 14 Aug 2022 03:44:20 -0700 +Subject: [PATCH 02/11] debian: mstflint/mstflint-dkms packages generation + +Tested OS: Linux(amd64) +Tested devices: N/A +Tested flows: Build + +Known gaps (with RM ticket): N/A + +Issue: 3173534 +--- + kernel/Makefile | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/kernel/Makefile b/kernel/Makefile +index da21bdb2..3bc09658 100644 +--- a/kernel/Makefile ++++ b/kernel/Makefile +@@ -31,6 +31,11 @@ KPVER ?= $(shell uname -r) + KSRC ?= /lib/modules/$(KPVER)/build + CPU_ARCH ?= $(shell uname -m) + ++PACKAGE_NAME := mstflint ++PACKAGE_VERSION := $(shell sed -r '1 s:(.*) \((.*)\).*:\2:; q' ../debian/changelog) ++DKMS_SRC_DIR := /usr/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) ++SOURCE_FILES := Makefile mst.h mst_kernel.h mst_main.c mst_vpd.c ++ + # GCC earlier than 4.6.0 will build modules which require 'mcount', + # and this symbol will not be available in the kernel if the kernel was + # compiled with GCC 4.6.0 and above. +@@ -81,3 +86,7 @@ all: + clean: + make -C $(KSRC) M=$(PWD) clean + ++install-dkms: $(SOURCE_FILES) ++ install -d $(DESTDIR)$(DKMS_SRC_DIR) ++ cp -a $^ $(DESTDIR)$(DKMS_SRC_DIR) ++ +-- +2.43.0 + diff -Nru mstflint-4.21.0+1/debian/patches/0002-Fix-illegal-shift-in-mst_release.patch mstflint-4.21.0+1/debian/patches/0002-Fix-illegal-shift-in-mst_release.patch --- mstflint-4.21.0+1/debian/patches/0002-Fix-illegal-shift-in-mst_release.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/0002-Fix-illegal-shift-in-mst_release.patch 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,36 @@ +From 1c4dfabdb4358678f6d3c2e30b3957bc6e14f29d Mon Sep 17 00:00:00 2001 +From: Chris Moore +Date: Thu, 20 Apr 2023 08:23:24 -0700 +Subject: [PATCH 05/11] Fix illegal shift in mst_release + +UBSAN is catching an illegal shift in mst_release() and is reporting it +to syslog. The problem is that mst_release() is doing: + slot_mask = ~(1 << (md->connectx_wa_slot_p1 - 1)); +but md->connectx_wa_slot_pl is only set if the user calls the undocumented +PCI_CONNECX_WA ioctl(). When the file is opened connectx_wa_slot_pl is +set to 0. If a user simply does an open() and then a close() then +md->connectx_wa_slot_p1 is 0 and mst_release will try to do a shift by -1. +--- + kernel/mst_main.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index 3f01f2af..6c7fcee6 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -598,8 +598,10 @@ static int mst_release(struct inode* inode, struct file* file) + goto out; + } + +- slot_mask = ~(1 << (md->connectx_wa_slot_p1 - 1)); +- dev->connectx_wa_slots &= slot_mask; ++ if (md->connectx_wa_slot_pl != 0) { ++ slot_mask = ~(1 << (md->connectx_wa_slot_p1 - 1)); ++ dev->connectx_wa_slots &= slot_mask; ++ } + + /* + * mst_info("CONNECTX_WA: Released slot %u. Current slots: %02x\n", +-- +2.43.0 + diff -Nru mstflint-4.21.0+1/debian/patches/0003-Fix-typo.patch mstflint-4.21.0+1/debian/patches/0003-Fix-typo.patch --- mstflint-4.21.0+1/debian/patches/0003-Fix-typo.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/0003-Fix-typo.patch 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,25 @@ +From be9f0d677fec4fd3b78411f41569acfeaf642654 Mon Sep 17 00:00:00 2001 +From: Chris Moore +Date: Thu, 20 Apr 2023 12:05:26 -0700 +Subject: [PATCH 06/11] Fix typo + +--- + kernel/mst_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index 6c7fcee6..dacae6bf 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -598,7 +598,7 @@ static int mst_release(struct inode* inode, struct file* file) + goto out; + } + +- if (md->connectx_wa_slot_pl != 0) { ++ if (md->connectx_wa_slot_p1 != 0) { + slot_mask = ~(1 << (md->connectx_wa_slot_p1 - 1)); + dev->connectx_wa_slots &= slot_mask; + } +-- +2.43.0 + diff -Nru mstflint-4.21.0+1/debian/patches/0004-Add-missed-license.patch mstflint-4.21.0+1/debian/patches/0004-Add-missed-license.patch --- mstflint-4.21.0+1/debian/patches/0004-Add-missed-license.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/0004-Add-missed-license.patch 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,231 @@ +From cadf37cf60c1e9e1372b5e1efd7ce8b687c2840a Mon Sep 17 00:00:00 2001 +From: Alex Blago +Date: Wed, 14 Jun 2023 02:05:55 -0700 +Subject: [PATCH 07/11] Add missed license + +--- + kernel/mst.h | 32 +++++++++++++++++++++++++--- + kernel/mst_kernel.h | 32 +++++++++++++++++++++++++--- + kernel/mst_main.c | 51 +++++++++++++++++++++------------------------ + kernel/mst_vpd.c | 51 +++++++++++++++++++++------------------------ + 4 files changed, 106 insertions(+), 60 deletions(-) + +diff --git a/kernel/mst.h b/kernel/mst.h +index 757d2849..c2c6345e 100644 +--- a/kernel/mst.h ++++ b/kernel/mst.h +@@ -1,8 +1,34 @@ +-/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ + /* +- * Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. ++ * Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. ++ * ++ * This software is available to you under a choice of one of two ++ * licenses. You may choose to be licensed under the terms of the GNU ++ * General Public License (GPL) Version 2, available from the file ++ * COPYING in the main directory of this source tree, or the ++ * OpenIB.org BSD license below: ++ * ++ * Redistribution and use in source and binary forms, with or ++ * without modification, are permitted provided that the following ++ * conditions are met: ++ * ++ * - Redistributions of source code must retain the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer. ++ * ++ * - Redistributions in binary form must reproduce the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer in the documentation and/or other materials ++ * provided with the distribution. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. + */ +- + #ifndef _MST_H_ + #define _MST_H_ + +diff --git a/kernel/mst_kernel.h b/kernel/mst_kernel.h +index e35e233f..d1ed375e 100644 +--- a/kernel/mst_kernel.h ++++ b/kernel/mst_kernel.h +@@ -1,8 +1,34 @@ +-/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ + /* +- * Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. ++ * Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. ++ * ++ * This software is available to you under a choice of one of two ++ * licenses. You may choose to be licensed under the terms of the GNU ++ * General Public License (GPL) Version 2, available from the file ++ * COPYING in the main directory of this source tree, or the ++ * OpenIB.org BSD license below: ++ * ++ * Redistribution and use in source and binary forms, with or ++ * without modification, are permitted provided that the following ++ * conditions are met: ++ * ++ * - Redistributions of source code must retain the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer. ++ * ++ * - Redistributions in binary form must reproduce the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer in the documentation and/or other materials ++ * provided with the distribution. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. + */ +- + #ifndef _MST_KERNEL_H_ + #define _MST_KERNEL_H_ + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index dacae6bf..b1d85be8 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -1,37 +1,34 @@ + /* +- * Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +- * BSD-3-Clause ++ * Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. + * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are met: ++ * This software is available to you under a choice of one of two ++ * licenses. You may choose to be licensed under the terms of the GNU ++ * General Public License (GPL) Version 2, available from the file ++ * COPYING in the main directory of this source tree, or the ++ * OpenIB.org BSD license below: + * +- * 1. Redistributions of source code must retain the above copyright notice, this +- * list of conditions and the following disclaimer. ++ * Redistribution and use in source and binary forms, with or ++ * without modification, are permitted provided that the following ++ * conditions are met: + * +- * 2. Redistributions in binary form must reproduce the above copyright notice, +- * this list of conditions and the following disclaimer in the documentation +- * and/or other materials provided with the distribution. ++ * - Redistributions of source code must retain the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer. + * +- * 3. Neither the name of the copyright holder nor the names of its +- * contributors may be used to endorse or promote products derived from +- * this software without specific prior written permission. ++ * - Redistributions in binary form must reproduce the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer in the documentation and/or other materials ++ * provided with the distribution. + * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. + */ +-// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB +-/* +- * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. +- */ +- + #include + #include + #include +diff --git a/kernel/mst_vpd.c b/kernel/mst_vpd.c +index 8e3903a4..003c5ee8 100644 +--- a/kernel/mst_vpd.c ++++ b/kernel/mst_vpd.c +@@ -1,37 +1,34 @@ + /* +- * Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +- * BSD-3-Clause ++ * Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. + * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are met: ++ * This software is available to you under a choice of one of two ++ * licenses. You may choose to be licensed under the terms of the GNU ++ * General Public License (GPL) Version 2, available from the file ++ * COPYING in the main directory of this source tree, or the ++ * OpenIB.org BSD license below: + * +- * 1. Redistributions of source code must retain the above copyright notice, this +- * list of conditions and the following disclaimer. ++ * Redistribution and use in source and binary forms, with or ++ * without modification, are permitted provided that the following ++ * conditions are met: + * +- * 2. Redistributions in binary form must reproduce the above copyright notice, +- * this list of conditions and the following disclaimer in the documentation +- * and/or other materials provided with the distribution. ++ * - Redistributions of source code must retain the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer. + * +- * 3. Neither the name of the copyright holder nor the names of its +- * contributors may be used to endorse or promote products derived from +- * this software without specific prior written permission. ++ * - Redistributions in binary form must reproduce the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer in the documentation and/or other materials ++ * provided with the distribution. + * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. + */ +-// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB +-/* +- * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. +- */ +- + #include + #include + #include "mst_kernel.h" +-- +2.43.0 + diff -Nru mstflint-4.21.0+1/debian/patches/0005-fix-kernel-module-build-on-kernel-6.4.patch mstflint-4.21.0+1/debian/patches/0005-fix-kernel-module-build-on-kernel-6.4.patch --- mstflint-4.21.0+1/debian/patches/0005-fix-kernel-module-build-on-kernel-6.4.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/0005-fix-kernel-module-build-on-kernel-6.4.patch 2024-04-09 21:58:50.000000000 +0000 @@ -0,0 +1,29 @@ +From be99828c2a8af46426c003a5ee8daa44f8831ade Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 31 Oct 2023 19:52:22 +0100 +Subject: [PATCH 10/11] fix kernel module build on kernel >= 6.4 + +Signed-off-by: Markus Theil +--- + kernel/mst_main.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index b1d85be8..c7409096 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -1650,7 +1650,11 @@ static struct mst_dev_data* mst_device_create(enum dev_type type, struct pci_dev + + if (alloc_chrdev_region(&dev->my_dev, 0, 1, dev->name)) + mst_err("failed to allocate chrdev_region\n"); ++#if KERNEL_VERSION(6, 4, 0) >= LINUX_VERSION_CODE ++ dev->cl = class_create(dev->name); ++#else + dev->cl = class_create(THIS_MODULE, dev->name); ++#endif + if (dev->cl == NULL) + { + pr_alert("Class creation failed\n"); +-- +2.43.0 + diff -Nru mstflint-4.21.0+1/debian/patches/0006-kernel-module-fix-wrong-comparison-order.patch mstflint-4.21.0+1/debian/patches/0006-kernel-module-fix-wrong-comparison-order.patch --- mstflint-4.21.0+1/debian/patches/0006-kernel-module-fix-wrong-comparison-order.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/0006-kernel-module-fix-wrong-comparison-order.patch 2024-04-10 01:45:05.000000000 +0000 @@ -0,0 +1,21 @@ +From d122c2df1ab9c87165b1b291fa61e3f06137699e Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Thu, 2 Nov 2023 10:17:32 +0100 +Subject: [PATCH 11/11] kernel module: fix wrong comparison order + +Signed-off-by: Markus Theil +--- + kernel/mst_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -1650,7 +1650,7 @@ + + if (alloc_chrdev_region(&dev->my_dev, 0, 1, dev->name)) + mst_err("failed to allocate chrdev_region\n"); +-#if KERNEL_VERSION(6, 4, 0) >= LINUX_VERSION_CODE ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) + dev->cl = class_create(dev->name); + #else + dev->cl = class_create(THIS_MODULE, dev->name); diff -Nru mstflint-4.21.0+1/debian/patches/kernel-module-config-version.patch mstflint-4.21.0+1/debian/patches/kernel-module-config-version.patch --- mstflint-4.21.0+1/debian/patches/kernel-module-config-version.patch 1970-01-01 00:00:00.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/kernel-module-config-version.patch 2024-04-10 01:48:08.000000000 +0000 @@ -0,0 +1,17 @@ +Description: Allow overriding the kernel module version during build +Author: dann frazier + +Forwarded: not-needed +Last-Update: 2024-04-10 + +--- mstflint-4.21.0+1.orig/kernel/Makefile ++++ mstflint-4.21.0+1/kernel/Makefile +@@ -32,7 +32,7 @@ KSRC ?= /lib/modules/$(KPVER)/build + CPU_ARCH ?= $(shell uname -m) + + PACKAGE_NAME := mstflint +-PACKAGE_VERSION := $(shell sed -r '1 s:(.*) \((.*)\).*:\2:; q' ../debian/changelog) ++PACKAGE_VERSION ?= $(shell sed -r '1 s:(.*) \((.*)\).*:\2:; q' ../debian/changelog) + DKMS_SRC_DIR := /usr/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) + SOURCE_FILES := Makefile mst.h mst_kernel.h mst_main.c mst_vpd.c + diff -Nru mstflint-4.21.0+1/debian/patches/series mstflint-4.21.0+1/debian/patches/series --- mstflint-4.21.0+1/debian/patches/series 2022-08-17 03:32:32.000000000 +0000 +++ mstflint-4.21.0+1/debian/patches/series 2024-04-09 21:58:50.000000000 +0000 @@ -5,3 +5,10 @@ mipsel.patch man-proper-header-line.patch typos.patch +0001-debian-mstflint-mstflint-dkms-packages-generation.patch +0002-Fix-illegal-shift-in-mst_release.patch +0003-Fix-typo.patch +0004-Add-missed-license.patch +0005-fix-kernel-module-build-on-kernel-6.4.patch +0006-kernel-module-fix-wrong-comparison-order.patch +kernel-module-config-version.patch diff -Nru mstflint-4.21.0+1/debian/rules mstflint-4.21.0+1/debian/rules --- mstflint-4.21.0+1/debian/rules 2021-02-08 09:26:59.000000000 +0000 +++ mstflint-4.21.0+1/debian/rules 2024-04-09 23:06:25.000000000 +0000 @@ -1,9 +1,21 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk + export DEB_BUILD_MAINT_OPTIONS = hardening=+all +pname := mstflint +pdkms := $(pname)-dkms +dkms_pkg := $(pname)-$(pversion) +deb_revision := $(lastword $(subst -, ,$(DEB_VERSION))) +dkms_pkg_ver := 4.26.0+1-$(deb_revision) + +test: + echo $(deb_revision) + echo $(dkms_pkg_ver) + %: - dh $@ + dh $@ --with dkms override_dh_clean: dh_clean @@ -12,7 +24,8 @@ | xargs -r rm -f # Skip ext_libs/ @for Makefile in `find . -name Makefile`; do \ - if [ ! -e $$Makefile.in ]; then \ + if [ ! -e $$Makefile.in ] && \ + [ $$Makefile != "./kernel/Makefile" ]; then \ rm -fv $$Makefile; \ fi; \ done @@ -22,7 +35,13 @@ override_dh_auto_install: dh_auto_install - rm -rf debian/mstflint/usr/include debian/mstflint/usr/lib/*/*.a debian/mstflint/usr/lib/*/mstflint/*.a + rm -rf debian/tmp/usr/include debian/tmp/usr/lib/*/*.a debian/tmp/usr/lib/*/mstflint/*.a # Unused unless fw-mgr is enabled: - rm -rf debian/mstflint/usr/share/man/man1/mstarchive.1* \ - debian/mstflint/usr/share/man/man1/mstfwmanager.1* + rm -rf debian/tmp/usr/share/man/man1/mstarchive.1* \ + debian/tmp/usr/share/man/man1/mstfwmanager.1* + sed -e 's:@PKGVER@:$(dkms_pkg_ver):' < debian/$(pdkms).dkms.in > debian/$(pdkms).dkms + make -C kernel DESTDIR=$(CURDIR)/debian/tmp PACKAGE_VERSION=$(dkms_pkg_ver) install-dkms + +override_dh_gencontrol: + dh_gencontrol + dh_gencontrol -pmstflint-dkms -- -v$(dkms_pkg_ver)