From af2c2c7bf81a5a6db707ceb909a6fc4e3d4982a6 Mon Sep 17 00:00:00 2001 From: "Justin M. Forbes" Date: Mon, 28 Mar 2022 10:01:52 -0500 Subject: kernel-5.17-0 * Mon Mar 28 2022 Justin M. Forbes [5.17-0] - Revert "swiotlb: rework "fix info leak with DMA_FROM_DEVICE"" (Linus Torvalds) - drm/i915: Temporarily disable selective fetch for PSR2 on ADL-P (Lyude Paul) [2065794] - Fix RHDISTGIT for Fedora (Justin M. Forbes) - mm/sparsemem: Fix 'mem_section' will never be NULL gcc 12 warning (Waiman Long) - Turn on RANDOM_TRUST_BOOTLOADER (Justin M. Forbes) - Revert "PCI/MSI: Mask MSI-X vectors only on success" (Justin M. Forbes) - Define SNAPSHOT correctly for VERSION_ON_UPSTREAM=0 (Justin M. Forbes) - Config fixups after some RHEL specific patches were reverted (Justin M. Forbes) - Basic Fedora Branch setup (Justin M. Forbes) - Reset Makefile.rhelver for the 5.18 cycle (Justin M. Forbes) Resolves: rhbz#2065794 Signed-off-by: Justin M. Forbes --- Patchlist.changelog | 6 +++ kernel.spec | 13 +++--- patch-5.17-redhat.patch | 106 ++++++++++++++++++++++++++++++++++++++++++++++-- sources | 6 +-- 4 files changed, 120 insertions(+), 11 deletions(-) diff --git a/Patchlist.changelog b/Patchlist.changelog index da00a6cfc..2e908ec9e 100644 --- a/Patchlist.changelog +++ b/Patchlist.changelog @@ -1,3 +1,9 @@ +"https://gitlab.com/cki-project/kernel-ark/-/commit"/442a5cb0498230a157a4f482de2d53796a400435 + 442a5cb0498230a157a4f482de2d53796a400435 Revert "swiotlb: rework "fix info leak with DMA_FROM_DEVICE"" + +"https://gitlab.com/cki-project/kernel-ark/-/commit"/2151233ebcc5c33b39ed3ba2b5a848f7205d5159 + 2151233ebcc5c33b39ed3ba2b5a848f7205d5159 drm/i915: Temporarily disable selective fetch for PSR2 on ADL-P + "https://gitlab.com/cki-project/kernel-ark/-/commit"/9db0837f0d0b5ddd9b81e1feb1bcbff21ae93106 9db0837f0d0b5ddd9b81e1feb1bcbff21ae93106 mm/sparsemem: Fix 'mem_section' will never be NULL gcc 12 warning diff --git a/kernel.spec b/kernel.spec index 1e86c8014..216d3e33b 100755 --- a/kernel.spec +++ b/kernel.spec @@ -130,7 +130,7 @@ Summary: The Linux kernel # The kernel tarball/base version %define kversion 5.17 -%define rpmversion 5.17.0 +%define rpmversion 5.17.1 %define patchversion 5.17 %define pkgrelease 300 @@ -695,7 +695,7 @@ BuildRequires: lld # exact git commit you can run # # xzcat -qq ${TARBALL} | git get-tar-commit-id -Source0: linux-5.17.tar.xz +Source0: linux-5.17.1.tar.xz Source1: Makefile.rhelver @@ -1391,8 +1391,8 @@ ApplyOptionalPatch() fi } -%setup -q -n kernel-5.17 -c -mv linux-5.17 linux-%{KVERREL} +%setup -q -n kernel-5.17.1 -c +mv linux-5.17.1 linux-%{KVERREL} cd linux-%{KVERREL} cp -a %{SOURCE1} . @@ -3019,7 +3019,10 @@ fi # # %changelog -* Wed Mar 23 2022 Justin M. Forbes [5.17-300] +* Mon Mar 28 2022 Justin M. Forbes [5.17-0] +- Revert "swiotlb: rework "fix info leak with DMA_FROM_DEVICE"" (Linus Torvalds) +- drm/i915: Temporarily disable selective fetch for PSR2 on ADL-P (Lyude Paul) [2065794] +- Fix RHDISTGIT for Fedora (Justin M. Forbes) - mm/sparsemem: Fix 'mem_section' will never be NULL gcc 12 warning (Waiman Long) - Turn on RANDOM_TRUST_BOOTLOADER (Justin M. Forbes) - Revert "PCI/MSI: Mask MSI-X vectors only on success" (Justin M. Forbes) diff --git a/patch-5.17-redhat.patch b/patch-5.17-redhat.patch index 22a578b74..c7eaa8cc0 100644 --- a/patch-5.17-redhat.patch +++ b/patch-5.17-redhat.patch @@ -1,3 +1,4 @@ + Documentation/core-api/dma-attributes.rst | 8 ++ Kconfig | 2 + Kconfig.redhat | 17 +++ Makefile | 12 +- @@ -18,6 +19,7 @@ drivers/firmware/efi/Makefile | 1 + drivers/firmware/efi/efi.c | 124 +++++++++++++++------ drivers/firmware/efi/secureboot.c | 38 +++++++ + drivers/gpu/drm/i915/display/intel_psr.c | 9 ++ drivers/hid/hid-rmi.c | 64 ----------- drivers/hwtracing/coresight/coresight-etm4x-core.c | 19 ++++ drivers/input/rmi4/rmi_driver.c | 124 ++++++++++++--------- @@ -28,6 +30,7 @@ drivers/pci/msi/msi.c | 12 +- drivers/pci/quirks.c | 24 ++++ drivers/usb/core/hub.c | 7 ++ + include/linux/dma-mapping.h | 8 ++ include/linux/efi.h | 22 ++-- include/linux/lsm_hook_defs.h | 2 + include/linux/lsm_hooks.h | 6 + @@ -37,6 +40,7 @@ include/linux/rmi.h | 1 + include/linux/security.h | 5 + init/Kconfig | 2 +- + kernel/dma/swiotlb.c | 23 ++-- kernel/module.c | 2 + kernel/module_signing.c | 9 +- scripts/mod/modpost.c | 8 ++ @@ -45,8 +49,24 @@ security/lockdown/Kconfig | 13 +++ security/lockdown/lockdown.c | 1 + security/security.c | 6 + - 47 files changed, 719 insertions(+), 199 deletions(-) - + 51 files changed, 752 insertions(+), 214 deletions(-) + +diff --git a/Documentation/core-api/dma-attributes.rst b/Documentation/core-api/dma-attributes.rst +index 1887d92e8e92..17706dc91ec9 100644 +--- a/Documentation/core-api/dma-attributes.rst ++++ b/Documentation/core-api/dma-attributes.rst +@@ -130,3 +130,11 @@ accesses to DMA buffers in both privileged "supervisor" and unprivileged + subsystem that the buffer is fully accessible at the elevated privilege + level (and ideally inaccessible or at least read-only at the + lesser-privileged levels). ++ ++DMA_ATTR_OVERWRITE ++------------------ ++ ++This is a hint to the DMA-mapping subsystem that the device is expected to ++overwrite the entire mapped size, thus the caller does not require any of the ++previous buffer contents to be preserved. This allows bounce-buffering ++implementations to optimise DMA_FROM_DEVICE transfers. diff --git a/Kconfig b/Kconfig index 745bc773f567..f57ff40109d7 100644 --- a/Kconfig @@ -81,7 +101,7 @@ index 000000000000..733a26bd887a + +endmenu diff --git a/Makefile b/Makefile -index 7214f075e1f0..6ecb3acb605c 100644 +index 34f9f5a9457a..799d71b74ea9 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,10 @@ $(if $(filter __%, $(MAKECMDGOALS)), \ @@ -894,6 +914,26 @@ index 000000000000..de0a3714a5d4 + } + } +} +diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c +index 00279e8c2775..545424e4a066 100644 +--- a/drivers/gpu/drm/i915/display/intel_psr.c ++++ b/drivers/gpu/drm/i915/display/intel_psr.c +@@ -744,6 +744,15 @@ static bool intel_psr2_sel_fetch_config_valid(struct intel_dp *intel_dp, + return false; + } + ++ /* Temporary workaround for Lenovo's issues with the X1 Carbon 10th Gen ++ * See: https://bugzilla.redhat.com/show_bug.cgi?id=2065794 ++ */ ++ if (IS_ALDERLAKE_P(dev_priv)) { ++ drm_dbg_kms(&dev_priv->drm, ++ "PSR2 sel fetch disabled on ADL-P, see rhbz2065794\n"); ++ return false; ++ } ++ + return crtc_state->enable_psr2_sel_fetch = true; + } + diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 311eee599ce9..2460c6bd46f8 100644 --- a/drivers/hid/hid-rmi.c @@ -1496,6 +1536,25 @@ index 47a1c8bddf86..e309d992e2ad 100644 /* Lock the device, then check to see if we were * disconnected while waiting for the lock to succeed. */ usb_lock_device(hdev); +diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h +index dca2b1355bb1..6150d11a607e 100644 +--- a/include/linux/dma-mapping.h ++++ b/include/linux/dma-mapping.h +@@ -61,6 +61,14 @@ + */ + #define DMA_ATTR_PRIVILEGED (1UL << 9) + ++/* ++ * This is a hint to the DMA-mapping subsystem that the device is expected ++ * to overwrite the entire mapped size, thus the caller does not require any ++ * of the previous buffer contents to be preserved. This allows ++ * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers. ++ */ ++#define DMA_ATTR_OVERWRITE (1UL << 10) ++ + /* + * A dma_addr_t can hold any valid DMA or bus address for the platform. It can + * be given to a device to use as a DMA source or target. It is specific to a diff --git a/include/linux/efi.h b/include/linux/efi.h index ccd4d3f91c98..e64643e3e364 100644 --- a/include/linux/efi.h @@ -1696,6 +1755,47 @@ index e9119bf54b1f..e3b57b4898fe 100644 select IO_WQ default y help +diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c +index 6db1c475ec82..bfc56cb21705 100644 +--- a/kernel/dma/swiotlb.c ++++ b/kernel/dma/swiotlb.c +@@ -627,14 +627,10 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr, + for (i = 0; i < nr_slots(alloc_size + offset); i++) + mem->slots[index + i].orig_addr = slot_addr(orig_addr, i); + tlb_addr = slot_addr(mem->start, index) + offset; +- /* +- * When dir == DMA_FROM_DEVICE we could omit the copy from the orig +- * to the tlb buffer, if we knew for sure the device will +- * overwirte the entire current content. But we don't. Thus +- * unconditional bounce may prevent leaking swiotlb content (i.e. +- * kernel memory) to user-space. +- */ +- swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE); ++ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && ++ (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || ++ dir == DMA_BIDIRECTIONAL)) ++ swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE); + return tlb_addr; + } + +@@ -701,13 +697,10 @@ void swiotlb_tbl_unmap_single(struct device *dev, phys_addr_t tlb_addr, + void swiotlb_sync_single_for_device(struct device *dev, phys_addr_t tlb_addr, + size_t size, enum dma_data_direction dir) + { +- /* +- * Unconditional bounce is necessary to avoid corruption on +- * sync_*_for_cpu or dma_ummap_* when the device didn't overwrite +- * the whole lengt of the bounce buffer. +- */ +- swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE); +- BUG_ON(!valid_dma_direction(dir)); ++ if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL) ++ swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE); ++ else ++ BUG_ON(dir != DMA_FROM_DEVICE); + } + + void swiotlb_sync_single_for_cpu(struct device *dev, phys_addr_t tlb_addr, diff --git a/kernel/module.c b/kernel/module.c index 46a5c2ed1928..92c2306651ce 100644 --- a/kernel/module.c diff --git a/sources b/sources index e13a60eaf..7beed4fdd 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (linux-5.17.tar.xz) = f1f61baf70e17bff176ea1d60113a54c475baa1fe28087269c256c3de48498a1d89648139d4174abbc98c39ad823acdf6dc78e5d80f00152b730c4f1966e9189 -SHA512 (kernel-abi-stablelists-5.17.0-300.tar.bz2) = fd3e6fd441bfde1fddee5dd19a2f0aeb89ea8ff8bf7494b8925bd7b9fe4cd52496cfa4a6a8af8a5474b64d7251d08397c4a999541b87fa4568b1b666cd7fe403 -SHA512 (kernel-kabi-dw-5.17.0-300.tar.bz2) = eac3ce7bbfea8fe9d7fbac3edc9bc301fdd9af9958a3e54b4d5652f71f066511e7099b7026258b7fc929a383ceeb329dc8d5bb358aa8997fd1d9ae8117b5c5c8 +SHA512 (linux-5.17.1.tar.xz) = 9b20ab347f3aac5d6330a1fa2058d56e77c0d6f163c9add173569c87135bc7e006e26e40d987da568e5744581d83e4f000446b2a0a4f63844c718941565f6aab +SHA512 (kernel-abi-stablelists-5.17.1-300.tar.bz2) = 63955c208cc5b348f36b3905f228d146c41cf7cc6cec1876c470636d94b7e76063d9b1e3f67b1fa3319678208f026d5611983caa82660edf56ca2c2b82169f24 +SHA512 (kernel-kabi-dw-5.17.1-300.tar.bz2) = fdb8e55efa441e294994fdffc2cfb53ffb5ef93c6014e2498de3e19e5e862f446dd36c3186ee1dcee2abeca4b4f7652ff4aa5975d4283c117e585cf8ed3ab136 -- cgit