]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.2-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Mar 2023 17:56:07 +0000 (18:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Mar 2023 17:56:07 +0000 (18:56 +0100)
added patches:
brd-check-for-req_nowait-and-set-correct-page-allocation-mask.patch
brd-mark-as-nowait-compatible.patch
brd-return-0-error-from-brd_insert_page.patch
ima-align-ima_file_mmap-parameters-with-mmap_file-lsm-hook.patch
ima-fix-error-handling-logic-when-file-measurement-failed.patch
powerpc-boot-don-t-always-pass-mcpu-powerpc-when-building-32-bit-uimage.patch
selftests-core-fix-incorrect-kernel-headers-search-path.patch
selftests-ftrace-fix-eprobe-syntax-test-case-to-check-filter-support.patch
selftests-powerpc-fix-incorrect-kernel-headers-search-path.patch
selftests-sched-fix-incorrect-kernel-headers-search-path.patch

queue-6.2/brd-check-for-req_nowait-and-set-correct-page-allocation-mask.patch [new file with mode: 0644]
queue-6.2/brd-mark-as-nowait-compatible.patch [new file with mode: 0644]
queue-6.2/brd-return-0-error-from-brd_insert_page.patch [new file with mode: 0644]
queue-6.2/ima-align-ima_file_mmap-parameters-with-mmap_file-lsm-hook.patch [new file with mode: 0644]
queue-6.2/ima-fix-error-handling-logic-when-file-measurement-failed.patch [new file with mode: 0644]
queue-6.2/powerpc-boot-don-t-always-pass-mcpu-powerpc-when-building-32-bit-uimage.patch [new file with mode: 0644]
queue-6.2/selftests-core-fix-incorrect-kernel-headers-search-path.patch [new file with mode: 0644]
queue-6.2/selftests-ftrace-fix-eprobe-syntax-test-case-to-check-filter-support.patch [new file with mode: 0644]
queue-6.2/selftests-powerpc-fix-incorrect-kernel-headers-search-path.patch [new file with mode: 0644]
queue-6.2/selftests-sched-fix-incorrect-kernel-headers-search-path.patch [new file with mode: 0644]
queue-6.2/series

diff --git a/queue-6.2/brd-check-for-req_nowait-and-set-correct-page-allocation-mask.patch b/queue-6.2/brd-check-for-req_nowait-and-set-correct-page-allocation-mask.patch
new file mode 100644 (file)
index 0000000..0a50e60
--- /dev/null
@@ -0,0 +1,154 @@
+From 6ded703c56c21bfb259725d4f1831a5feb563e9b Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Thu, 16 Feb 2023 08:01:08 -0700
+Subject: brd: check for REQ_NOWAIT and set correct page allocation mask
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit 6ded703c56c21bfb259725d4f1831a5feb563e9b upstream.
+
+If REQ_NOWAIT is set, then do a non-blocking allocation if the operation
+is a write and we need to insert a new page. Currently REQ_NOWAIT cannot
+be set as the queue isn't marked as supporting nowait, this change is in
+preparation for allowing that.
+
+radix_tree_preload() warns on attempting to call it with an allocation
+mask that doesn't allow blocking. While that warning could arguably
+be removed, we need to handle radix insertion failures anyway as they
+are more likely if we cannot block to get memory.
+
+Remove legacy BUG_ON()'s and turn them into proper errors instead, one
+for the allocation failure and one for finding a page that doesn't
+match the correct index.
+
+Cc: stable@vger.kernel.org # 5.10+
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/brd.c |   48 ++++++++++++++++++++++++++++--------------------
+ 1 file changed, 28 insertions(+), 20 deletions(-)
+
+--- a/drivers/block/brd.c
++++ b/drivers/block/brd.c
+@@ -80,26 +80,21 @@ static struct page *brd_lookup_page(stru
+ /*
+  * Insert a new page for a given sector, if one does not already exist.
+  */
+-static int brd_insert_page(struct brd_device *brd, sector_t sector)
++static int brd_insert_page(struct brd_device *brd, sector_t sector, gfp_t gfp)
+ {
+       pgoff_t idx;
+       struct page *page;
+-      gfp_t gfp_flags;
++      int ret = 0;
+       page = brd_lookup_page(brd, sector);
+       if (page)
+               return 0;
+-      /*
+-       * Must use NOIO because we don't want to recurse back into the
+-       * block or filesystem layers from page reclaim.
+-       */
+-      gfp_flags = GFP_NOIO | __GFP_ZERO | __GFP_HIGHMEM;
+-      page = alloc_page(gfp_flags);
++      page = alloc_page(gfp | __GFP_ZERO | __GFP_HIGHMEM);
+       if (!page)
+               return -ENOMEM;
+-      if (radix_tree_preload(GFP_NOIO)) {
++      if (gfpflags_allow_blocking(gfp) && radix_tree_preload(gfp)) {
+               __free_page(page);
+               return -ENOMEM;
+       }
+@@ -110,15 +105,17 @@ static int brd_insert_page(struct brd_de
+       if (radix_tree_insert(&brd->brd_pages, idx, page)) {
+               __free_page(page);
+               page = radix_tree_lookup(&brd->brd_pages, idx);
+-              BUG_ON(!page);
+-              BUG_ON(page->index != idx);
++              if (!page)
++                      ret = -ENOMEM;
++              else if (page->index != idx)
++                      ret = -EIO;
+       } else {
+               brd->brd_nr_pages++;
+       }
+       spin_unlock(&brd->brd_lock);
+       radix_tree_preload_end();
+-      return 0;
++      return ret;
+ }
+ /*
+@@ -167,19 +164,20 @@ static void brd_free_pages(struct brd_de
+ /*
+  * copy_to_brd_setup must be called before copy_to_brd. It may sleep.
+  */
+-static int copy_to_brd_setup(struct brd_device *brd, sector_t sector, size_t n)
++static int copy_to_brd_setup(struct brd_device *brd, sector_t sector, size_t n,
++                           gfp_t gfp)
+ {
+       unsigned int offset = (sector & (PAGE_SECTORS-1)) << SECTOR_SHIFT;
+       size_t copy;
+       int ret;
+       copy = min_t(size_t, n, PAGE_SIZE - offset);
+-      ret = brd_insert_page(brd, sector);
++      ret = brd_insert_page(brd, sector, gfp);
+       if (ret)
+               return ret;
+       if (copy < n) {
+               sector += copy >> SECTOR_SHIFT;
+-              ret = brd_insert_page(brd, sector);
++              ret = brd_insert_page(brd, sector, gfp);
+       }
+       return ret;
+ }
+@@ -254,20 +252,26 @@ static void copy_from_brd(void *dst, str
+  * Process a single bvec of a bio.
+  */
+ static int brd_do_bvec(struct brd_device *brd, struct page *page,
+-                      unsigned int len, unsigned int off, enum req_op op,
++                      unsigned int len, unsigned int off, blk_opf_t opf,
+                       sector_t sector)
+ {
+       void *mem;
+       int err = 0;
+-      if (op_is_write(op)) {
+-              err = copy_to_brd_setup(brd, sector, len);
++      if (op_is_write(opf)) {
++              /*
++               * Must use NOIO because we don't want to recurse back into the
++               * block or filesystem layers from page reclaim.
++               */
++              gfp_t gfp = opf & REQ_NOWAIT ? GFP_NOWAIT : GFP_NOIO;
++
++              err = copy_to_brd_setup(brd, sector, len, gfp);
+               if (err)
+                       goto out;
+       }
+       mem = kmap_atomic(page);
+-      if (!op_is_write(op)) {
++      if (!op_is_write(opf)) {
+               copy_from_brd(mem + off, brd, sector, len);
+               flush_dcache_page(page);
+       } else {
+@@ -296,8 +300,12 @@ static void brd_submit_bio(struct bio *b
+                               (len & (SECTOR_SIZE - 1)));
+               err = brd_do_bvec(brd, bvec.bv_page, len, bvec.bv_offset,
+-                                bio_op(bio), sector);
++                                bio->bi_opf, sector);
+               if (err) {
++                      if (err == -ENOMEM && bio->bi_opf & REQ_NOWAIT) {
++                              bio_wouldblock_error(bio);
++                              return;
++                      }
+                       bio_io_error(bio);
+                       return;
+               }
diff --git a/queue-6.2/brd-mark-as-nowait-compatible.patch b/queue-6.2/brd-mark-as-nowait-compatible.patch
new file mode 100644 (file)
index 0000000..3fc0595
--- /dev/null
@@ -0,0 +1,57 @@
+From 67205f80be9910207481406c47f7d85e703fb2e9 Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Wed, 15 Feb 2023 16:43:47 -0700
+Subject: brd: mark as nowait compatible
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit 67205f80be9910207481406c47f7d85e703fb2e9 upstream.
+
+By default, non-mq drivers do not support nowait. This causes io_uring
+to use a slower path as the driver cannot be trust not to block. brd
+can safely set the nowait flag, as worst case all it does is a NOIO
+allocation.
+
+For io_uring, this makes a substantial difference. Before:
+
+submitter=0, tid=453, file=/dev/ram0, node=-1
+polled=0, fixedbufs=1/0, register_files=1, buffered=0, QD=128
+Engine=io_uring, sq_ring=128, cq_ring=128
+IOPS=440.03K, BW=1718MiB/s, IOS/call=32/31
+IOPS=428.96K, BW=1675MiB/s, IOS/call=32/32
+IOPS=442.59K, BW=1728MiB/s, IOS/call=32/31
+IOPS=419.65K, BW=1639MiB/s, IOS/call=32/32
+IOPS=426.82K, BW=1667MiB/s, IOS/call=32/31
+
+and after:
+
+submitter=0, tid=354, file=/dev/ram0, node=-1
+polled=0, fixedbufs=1/0, register_files=1, buffered=0, QD=128
+Engine=io_uring, sq_ring=128, cq_ring=128
+IOPS=3.37M, BW=13.15GiB/s, IOS/call=32/31
+IOPS=3.45M, BW=13.46GiB/s, IOS/call=32/31
+IOPS=3.43M, BW=13.42GiB/s, IOS/call=32/32
+IOPS=3.43M, BW=13.39GiB/s, IOS/call=32/31
+IOPS=3.43M, BW=13.38GiB/s, IOS/call=32/31
+
+or about an 8x in difference. Now that brd is prepared to deal with
+REQ_NOWAIT reads/writes, mark it as supporting that.
+
+Cc: stable@vger.kernel.org # 5.10+
+Link: https://lore.kernel.org/linux-block/20230203103005.31290-1-p.raghav@samsung.com/
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/brd.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/block/brd.c
++++ b/drivers/block/brd.c
+@@ -412,6 +412,7 @@ static int brd_alloc(int i)
+       /* Tell the block layer that this is not a rotational device */
+       blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
+       blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
++      blk_queue_flag_set(QUEUE_FLAG_NOWAIT, disk->queue);
+       err = add_disk(disk);
+       if (err)
+               goto out_cleanup_disk;
diff --git a/queue-6.2/brd-return-0-error-from-brd_insert_page.patch b/queue-6.2/brd-return-0-error-from-brd_insert_page.patch
new file mode 100644 (file)
index 0000000..fd29ae6
--- /dev/null
@@ -0,0 +1,93 @@
+From db0ccc44a20b4bb3039c0f6885a1f9c3323c7673 Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Thu, 16 Feb 2023 07:57:32 -0700
+Subject: brd: return 0/-error from brd_insert_page()
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit db0ccc44a20b4bb3039c0f6885a1f9c3323c7673 upstream.
+
+It currently returns a page, but callers just check for NULL/page to
+gauge success. Clean this up and return the appropriate error directly
+instead.
+
+Cc: stable@vger.kernel.org # 5.10+
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/brd.c |   26 ++++++++++++--------------
+ 1 file changed, 12 insertions(+), 14 deletions(-)
+
+--- a/drivers/block/brd.c
++++ b/drivers/block/brd.c
+@@ -78,11 +78,9 @@ static struct page *brd_lookup_page(stru
+ }
+ /*
+- * Look up and return a brd's page for a given sector.
+- * If one does not exist, allocate an empty page, and insert that. Then
+- * return it.
++ * Insert a new page for a given sector, if one does not already exist.
+  */
+-static struct page *brd_insert_page(struct brd_device *brd, sector_t sector)
++static int brd_insert_page(struct brd_device *brd, sector_t sector)
+ {
+       pgoff_t idx;
+       struct page *page;
+@@ -90,7 +88,7 @@ static struct page *brd_insert_page(stru
+       page = brd_lookup_page(brd, sector);
+       if (page)
+-              return page;
++              return 0;
+       /*
+        * Must use NOIO because we don't want to recurse back into the
+@@ -99,11 +97,11 @@ static struct page *brd_insert_page(stru
+       gfp_flags = GFP_NOIO | __GFP_ZERO | __GFP_HIGHMEM;
+       page = alloc_page(gfp_flags);
+       if (!page)
+-              return NULL;
++              return -ENOMEM;
+       if (radix_tree_preload(GFP_NOIO)) {
+               __free_page(page);
+-              return NULL;
++              return -ENOMEM;
+       }
+       spin_lock(&brd->brd_lock);
+@@ -120,8 +118,7 @@ static struct page *brd_insert_page(stru
+       spin_unlock(&brd->brd_lock);
+       radix_tree_preload_end();
+-
+-      return page;
++      return 0;
+ }
+ /*
+@@ -174,16 +171,17 @@ static int copy_to_brd_setup(struct brd_
+ {
+       unsigned int offset = (sector & (PAGE_SECTORS-1)) << SECTOR_SHIFT;
+       size_t copy;
++      int ret;
+       copy = min_t(size_t, n, PAGE_SIZE - offset);
+-      if (!brd_insert_page(brd, sector))
+-              return -ENOSPC;
++      ret = brd_insert_page(brd, sector);
++      if (ret)
++              return ret;
+       if (copy < n) {
+               sector += copy >> SECTOR_SHIFT;
+-              if (!brd_insert_page(brd, sector))
+-                      return -ENOSPC;
++              ret = brd_insert_page(brd, sector);
+       }
+-      return 0;
++      return ret;
+ }
+ /*
diff --git a/queue-6.2/ima-align-ima_file_mmap-parameters-with-mmap_file-lsm-hook.patch b/queue-6.2/ima-align-ima_file_mmap-parameters-with-mmap_file-lsm-hook.patch
new file mode 100644 (file)
index 0000000..f0da9e2
--- /dev/null
@@ -0,0 +1,107 @@
+From 4971c268b85e1c7a734a61622fc0813c86e2362e Mon Sep 17 00:00:00 2001
+From: Roberto Sassu <roberto.sassu@huawei.com>
+Date: Tue, 31 Jan 2023 18:42:43 +0100
+Subject: ima: Align ima_file_mmap() parameters with mmap_file LSM hook
+
+From: Roberto Sassu <roberto.sassu@huawei.com>
+
+commit 4971c268b85e1c7a734a61622fc0813c86e2362e upstream.
+
+Commit 98de59bfe4b2f ("take calculation of final prot in
+security_mmap_file() into a helper") moved the code to update prot, to be
+the actual protections applied to the kernel, to a new helper called
+mmap_prot().
+
+However, while without the helper ima_file_mmap() was getting the updated
+prot, with the helper ima_file_mmap() gets the original prot, which
+contains the protections requested by the application.
+
+A possible consequence of this change is that, if an application calls
+mmap() with only PROT_READ, and the kernel applies PROT_EXEC in addition,
+that application would have access to executable memory without having this
+event recorded in the IMA measurement list. This situation would occur for
+example if the application, before mmap(), calls the personality() system
+call with READ_IMPLIES_EXEC as the first argument.
+
+Align ima_file_mmap() parameters with those of the mmap_file LSM hook, so
+that IMA can receive both the requested prot and the final prot. Since the
+requested protections are stored in a new variable, and the final
+protections are stored in the existing variable, this effectively restores
+the original behavior of the MMAP_CHECK hook.
+
+Cc: stable@vger.kernel.org
+Fixes: 98de59bfe4b2 ("take calculation of final prot in security_mmap_file() into a helper")
+Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
+Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
+Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/ima.h               |    6 ++++--
+ security/integrity/ima/ima_main.c |    7 +++++--
+ security/security.c               |    7 ++++---
+ 3 files changed, 13 insertions(+), 7 deletions(-)
+
+--- a/include/linux/ima.h
++++ b/include/linux/ima.h
+@@ -21,7 +21,8 @@ extern int ima_file_check(struct file *f
+ extern void ima_post_create_tmpfile(struct user_namespace *mnt_userns,
+                                   struct inode *inode);
+ extern void ima_file_free(struct file *file);
+-extern int ima_file_mmap(struct file *file, unsigned long prot);
++extern int ima_file_mmap(struct file *file, unsigned long reqprot,
++                       unsigned long prot, unsigned long flags);
+ extern int ima_file_mprotect(struct vm_area_struct *vma, unsigned long prot);
+ extern int ima_load_data(enum kernel_load_data_id id, bool contents);
+ extern int ima_post_load_data(char *buf, loff_t size,
+@@ -76,7 +77,8 @@ static inline void ima_file_free(struct
+       return;
+ }
+-static inline int ima_file_mmap(struct file *file, unsigned long prot)
++static inline int ima_file_mmap(struct file *file, unsigned long reqprot,
++                              unsigned long prot, unsigned long flags)
+ {
+       return 0;
+ }
+--- a/security/integrity/ima/ima_main.c
++++ b/security/integrity/ima/ima_main.c
+@@ -397,7 +397,9 @@ out:
+ /**
+  * ima_file_mmap - based on policy, collect/store measurement.
+  * @file: pointer to the file to be measured (May be NULL)
+- * @prot: contains the protection that will be applied by the kernel.
++ * @reqprot: protection requested by the application
++ * @prot: protection that will be applied by the kernel
++ * @flags: operational flags
+  *
+  * Measure files being mmapped executable based on the ima_must_measure()
+  * policy decision.
+@@ -405,7 +407,8 @@ out:
+  * On success return 0.  On integrity appraisal error, assuming the file
+  * is in policy and IMA-appraisal is in enforcing mode, return -EACCES.
+  */
+-int ima_file_mmap(struct file *file, unsigned long prot)
++int ima_file_mmap(struct file *file, unsigned long reqprot,
++                unsigned long prot, unsigned long flags)
+ {
+       u32 secid;
+--- a/security/security.c
++++ b/security/security.c
+@@ -1661,12 +1661,13 @@ static inline unsigned long mmap_prot(st
+ int security_mmap_file(struct file *file, unsigned long prot,
+                       unsigned long flags)
+ {
++      unsigned long prot_adj = mmap_prot(file, prot);
+       int ret;
+-      ret = call_int_hook(mmap_file, 0, file, prot,
+-                                      mmap_prot(file, prot), flags);
++
++      ret = call_int_hook(mmap_file, 0, file, prot, prot_adj, flags);
+       if (ret)
+               return ret;
+-      return ima_file_mmap(file, prot);
++      return ima_file_mmap(file, prot, prot_adj, flags);
+ }
+ int security_mmap_addr(unsigned long addr)
diff --git a/queue-6.2/ima-fix-error-handling-logic-when-file-measurement-failed.patch b/queue-6.2/ima-fix-error-handling-logic-when-file-measurement-failed.patch
new file mode 100644 (file)
index 0000000..0335389
--- /dev/null
@@ -0,0 +1,45 @@
+From 6dc387d52eb67f45d68caa263704fa4e39ef8e76 Mon Sep 17 00:00:00 2001
+From: Matt Bobrowski <mattbobrowski@google.com>
+Date: Wed, 4 Jan 2023 03:41:44 +0000
+Subject: ima: fix error handling logic when file measurement failed
+
+From: Matt Bobrowski <mattbobrowski@google.com>
+
+commit 6dc387d52eb67f45d68caa263704fa4e39ef8e76 upstream.
+
+Restore the error handling logic so that when file measurement fails,
+the respective iint entry is not left with the digest data being
+populated with zeroes.
+
+Fixes: 54f03916fb89 ("ima: permit fsverity's file digests in the IMA measurement list")
+Cc: stable@vger.kernel.org     # 5.19
+Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
+Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ security/integrity/ima/ima_api.c  |    2 +-
+ security/integrity/ima/ima_main.c |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/security/integrity/ima/ima_api.c
++++ b/security/integrity/ima/ima_api.c
+@@ -292,7 +292,7 @@ int ima_collect_measurement(struct integ
+               result = ima_calc_file_hash(file, &hash.hdr);
+       }
+-      if (result == -ENOMEM)
++      if (result && result != -EBADF && result != -EINVAL)
+               goto out;
+       length = sizeof(hash.hdr) + hash.hdr.length;
+--- a/security/integrity/ima/ima_main.c
++++ b/security/integrity/ima/ima_main.c
+@@ -337,7 +337,7 @@ static int process_measurement(struct fi
+       hash_algo = ima_get_hash_algo(xattr_value, xattr_len);
+       rc = ima_collect_measurement(iint, file, buf, size, hash_algo, modsig);
+-      if (rc == -ENOMEM)
++      if (rc != 0 && rc != -EBADF && rc != -EINVAL)
+               goto out_locked;
+       if (!pathbuf)   /* ima_rdwr_violation possibly pre-fetched */
diff --git a/queue-6.2/powerpc-boot-don-t-always-pass-mcpu-powerpc-when-building-32-bit-uimage.patch b/queue-6.2/powerpc-boot-don-t-always-pass-mcpu-powerpc-when-building-32-bit-uimage.patch
new file mode 100644 (file)
index 0000000..a91a141
--- /dev/null
@@ -0,0 +1,62 @@
+From ff7c76f66d8bad4e694c264c789249e1d3a8205d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
+Date: Wed, 25 Jan 2023 08:39:00 +0100
+Subject: powerpc/boot: Don't always pass -mcpu=powerpc when building 32-bit uImage
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pali Rohár <pali@kernel.org>
+
+commit ff7c76f66d8bad4e694c264c789249e1d3a8205d upstream.
+
+When CONFIG_TARGET_CPU is specified then pass its value to the compiler
+-mcpu option. This fixes following build error when building kernel with
+powerpc e500 SPE capable cross compilers:
+
+    BOOTAS  arch/powerpc/boot/crt0.o
+  powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
+  powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
+  make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
+
+Similar change was already introduced for the main powerpc Makefile in
+commit 446cda1b21d9 ("powerpc/32: Don't always pass -mcpu=powerpc to the
+compiler").
+
+Fixes: 40a75584e526 ("powerpc/boot: Build wrapper for an appropriate CPU")
+Cc: stable@vger.kernel.org # v5.19+
+Signed-off-by: Pali Rohár <pali@kernel.org>
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/2ae3ae5887babfdacc34435bff0944b3f336100a.1674632329.git.christophe.leroy@csgroup.eu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/powerpc/boot/Makefile |   14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/arch/powerpc/boot/Makefile
++++ b/arch/powerpc/boot/Makefile
+@@ -39,13 +39,19 @@ BOOTCFLAGS    := -Wall -Wundef -Wstrict-
+                $(LINUXINCLUDE)
+ ifdef CONFIG_PPC64_BOOT_WRAPPER
+-ifdef CONFIG_CPU_LITTLE_ENDIAN
+-BOOTCFLAGS    += -m64 -mcpu=powerpc64le
++BOOTCFLAGS    += -m64
+ else
+-BOOTCFLAGS    += -m64 -mcpu=powerpc64
++BOOTCFLAGS    += -m32
+ endif
++
++ifdef CONFIG_TARGET_CPU_BOOL
++BOOTCFLAGS    += -mcpu=$(CONFIG_TARGET_CPU)
++else ifdef CONFIG_PPC64_BOOT_WRAPPER
++ifdef CONFIG_CPU_LITTLE_ENDIAN
++BOOTCFLAGS    += -mcpu=powerpc64le
+ else
+-BOOTCFLAGS    += -m32 -mcpu=powerpc
++BOOTCFLAGS    += -mcpu=powerpc64
++endif
+ endif
+ BOOTCFLAGS    += -isystem $(shell $(BOOTCC) -print-file-name=include)
diff --git a/queue-6.2/selftests-core-fix-incorrect-kernel-headers-search-path.patch b/queue-6.2/selftests-core-fix-incorrect-kernel-headers-search-path.patch
new file mode 100644 (file)
index 0000000..7b92d09
--- /dev/null
@@ -0,0 +1,34 @@
+From 145df2fdc38f24b3e52e4c2a59b02d874a074fbd Mon Sep 17 00:00:00 2001
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Date: Fri, 27 Jan 2023 08:57:25 -0500
+Subject: selftests: core: Fix incorrect kernel headers search path
+
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+commit 145df2fdc38f24b3e52e4c2a59b02d874a074fbd upstream.
+
+Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents
+building against kernel headers from the build environment in scenarios
+where kernel headers are installed into a specific output directory
+(O=...).
+
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Shuah Khan <shuah@kernel.org>
+Cc: linux-kselftest@vger.kernel.org
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: <stable@vger.kernel.org> # 5.18+
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/core/Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/testing/selftests/core/Makefile
++++ b/tools/testing/selftests/core/Makefile
+@@ -1,5 +1,5 @@
+ # SPDX-License-Identifier: GPL-2.0-only
+-CFLAGS += -g -I../../../../usr/include/
++CFLAGS += -g $(KHDR_INCLUDES)
+ TEST_GEN_PROGS := close_range_test
diff --git a/queue-6.2/selftests-ftrace-fix-eprobe-syntax-test-case-to-check-filter-support.patch b/queue-6.2/selftests-ftrace-fix-eprobe-syntax-test-case-to-check-filter-support.patch
new file mode 100644 (file)
index 0000000..e8d49c0
--- /dev/null
@@ -0,0 +1,38 @@
+From a457e944df92789ab31aaf35fae9db064e3c51c4 Mon Sep 17 00:00:00 2001
+From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
+Date: Tue, 21 Feb 2023 08:49:16 +0900
+Subject: selftests/ftrace: Fix eprobe syntax test case to check filter support
+
+From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
+
+commit a457e944df92789ab31aaf35fae9db064e3c51c4 upstream.
+
+Fix eprobe syntax test case to check whether the kernel supports the filter
+on eprobe for filter syntax test command. Without this fix, this test case
+will fail if the kernel supports eprobe but doesn't support the filter on
+eprobe.
+
+Link: https://lore.kernel.org/all/167309834742.640500.379128668288448035.stgit@devnote3/
+
+Fixes: 9e14bae7d049 ("selftests/ftrace: Add eprobe syntax error testcase")
+Cc: stable@vger.kernel.org
+Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
+Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Acked-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/ftrace/test.d/dynevent/eprobes_syntax_errors.tc |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/tools/testing/selftests/ftrace/test.d/dynevent/eprobes_syntax_errors.tc
++++ b/tools/testing/selftests/ftrace/test.d/dynevent/eprobes_syntax_errors.tc
+@@ -22,6 +22,8 @@ check_error 'e:foo/^bar.1 syscalls/sys_e
+ check_error 'e:foo/bar syscalls/sys_enter_openat arg=^dfd'    # BAD_FETCH_ARG
+ check_error 'e:foo/bar syscalls/sys_enter_openat ^arg=$foo'   # BAD_ATTACH_ARG
+-check_error 'e:foo/bar syscalls/sys_enter_openat if ^'        # NO_EP_FILTER
++if grep -q '<attached-group>\.<attached-event>.*\[if <filter>\]' README; then
++  check_error 'e:foo/bar syscalls/sys_enter_openat if ^'      # NO_EP_FILTER
++fi
+ exit 0
diff --git a/queue-6.2/selftests-powerpc-fix-incorrect-kernel-headers-search-path.patch b/queue-6.2/selftests-powerpc-fix-incorrect-kernel-headers-search-path.patch
new file mode 100644 (file)
index 0000000..8d1399f
--- /dev/null
@@ -0,0 +1,71 @@
+From 4f11410bf6da87defe8fd59b0413f0d9f71744da Mon Sep 17 00:00:00 2001
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Date: Fri, 27 Jan 2023 08:57:42 -0500
+Subject: selftests/powerpc: Fix incorrect kernel headers search path
+
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+commit 4f11410bf6da87defe8fd59b0413f0d9f71744da upstream.
+
+Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents
+building against kernel headers from the build environment in scenarios
+where kernel headers are installed into a specific output directory
+(O=...).
+
+Cc: stable@vger.kernel.org # v5.18+
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Acked-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20230127135755.79929-22-mathieu.desnoyers@efficios.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/powerpc/ptrace/Makefile   |    2 +-
+ tools/testing/selftests/powerpc/security/Makefile |    2 +-
+ tools/testing/selftests/powerpc/syscalls/Makefile |    2 +-
+ tools/testing/selftests/powerpc/tm/Makefile       |    2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/tools/testing/selftests/powerpc/ptrace/Makefile
++++ b/tools/testing/selftests/powerpc/ptrace/Makefile
+@@ -33,7 +33,7 @@ TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(T
+ $(TESTS_64): CFLAGS += -m64
+ $(TM_TESTS): CFLAGS += -I../tm -mhtm
+-CFLAGS += -I../../../../../usr/include -fno-pie
++CFLAGS += $(KHDR_INCLUDES) -fno-pie
+ $(OUTPUT)/ptrace-gpr: ptrace-gpr.S
+ $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
+--- a/tools/testing/selftests/powerpc/security/Makefile
++++ b/tools/testing/selftests/powerpc/security/Makefile
+@@ -5,7 +5,7 @@ TEST_PROGS := mitigation-patching.sh
+ top_srcdir = ../../../../..
+-CFLAGS += -I../../../../../usr/include
++CFLAGS += $(KHDR_INCLUDES)
+ include ../../lib.mk
+--- a/tools/testing/selftests/powerpc/syscalls/Makefile
++++ b/tools/testing/selftests/powerpc/syscalls/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0-only
+ TEST_GEN_PROGS := ipc_unmuxed rtas_filter
+-CFLAGS += -I../../../../../usr/include
++CFLAGS += $(KHDR_INCLUDES)
+ top_srcdir = ../../../../..
+ include ../../lib.mk
+--- a/tools/testing/selftests/powerpc/tm/Makefile
++++ b/tools/testing/selftests/powerpc/tm/Makefile
+@@ -17,7 +17,7 @@ $(TEST_GEN_PROGS): ../harness.c ../utils
+ CFLAGS += -mhtm
+ $(OUTPUT)/tm-syscall: tm-syscall-asm.S
+-$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
++$(OUTPUT)/tm-syscall: CFLAGS += $(KHDR_INCLUDES)
+ $(OUTPUT)/tm-tmspr: CFLAGS += -pthread
+ $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64
+ $(OUTPUT)/tm-resched-dscr: ../pmu/lib.c
diff --git a/queue-6.2/selftests-sched-fix-incorrect-kernel-headers-search-path.patch b/queue-6.2/selftests-sched-fix-incorrect-kernel-headers-search-path.patch
new file mode 100644 (file)
index 0000000..b6c9abc
--- /dev/null
@@ -0,0 +1,36 @@
+From 0d2cace5af50806a6b32ab73d367b80e46acda0f Mon Sep 17 00:00:00 2001
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Date: Fri, 27 Jan 2023 08:57:45 -0500
+Subject: selftests: sched: Fix incorrect kernel headers search path
+
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+commit 0d2cace5af50806a6b32ab73d367b80e46acda0f upstream.
+
+Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents
+building against kernel headers from the build environment in scenarios
+where kernel headers are installed into a specific output directory
+(O=...).
+
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Shuah Khan <shuah@kernel.org>
+Cc: linux-kselftest@vger.kernel.org
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: <stable@vger.kernel.org>  # 5.18+
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/sched/Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/testing/selftests/sched/Makefile
++++ b/tools/testing/selftests/sched/Makefile
+@@ -4,7 +4,7 @@ ifneq ($(shell $(CC) --version 2>&1 | he
+ CLANG_FLAGS += -no-integrated-as
+ endif
+-CFLAGS += -O2 -Wall -g -I./ -I../../../../usr/include/  -Wl,-rpath=./ \
++CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -Wl,-rpath=./ \
+         $(CLANG_FLAGS)
+ LDLIBS += -lpthread
index a7c554196122b578706c539e193e3ba80f95b654..db3953230ab287c3a8fc573bd0e4102760d7d916 100644 (file)
@@ -846,3 +846,13 @@ x86-microcode-amd-fix-mixed-steppings-support.patch
 x86-speculation-allow-enabling-stibp-with-legacy-ibrs.patch
 documentation-hw-vuln-document-the-interaction-between-ibrs-and-stibp.patch
 virt-sev-guest-return-eio-if-certificate-buffer-is-not-large-enough.patch
+brd-mark-as-nowait-compatible.patch
+brd-return-0-error-from-brd_insert_page.patch
+brd-check-for-req_nowait-and-set-correct-page-allocation-mask.patch
+ima-fix-error-handling-logic-when-file-measurement-failed.patch
+ima-align-ima_file_mmap-parameters-with-mmap_file-lsm-hook.patch
+powerpc-boot-don-t-always-pass-mcpu-powerpc-when-building-32-bit-uimage.patch
+selftests-powerpc-fix-incorrect-kernel-headers-search-path.patch
+selftests-ftrace-fix-eprobe-syntax-test-case-to-check-filter-support.patch
+selftests-sched-fix-incorrect-kernel-headers-search-path.patch
+selftests-core-fix-incorrect-kernel-headers-search-path.patch