From: Greg Kroah-Hartman Date: Mon, 19 Aug 2024 04:24:52 +0000 (+0200) Subject: 6.10-stable patches X-Git-Tag: v6.1.107~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cfb941b4a742a8fc7870b209b62a4cd92a32088;p=thirdparty%2Fkernel%2Fstable-queue.git 6.10-stable patches added patches: netfs-ceph-revert-netfs-remove-deprecated-use-of-pg_private_2-as-a-second-writeback-flag.patch revert-acpi-ec-evaluate-orphan-_reg-under-ec-device.patch revert-misc-fastrpc-restrict-untrusted-app-to-attach-to-privileged-pd.patch revert-serial-8250_omap-set-the-console-genpd-always-on-if-no-console-suspend.patch revert-usb-typec-tcpm-clear-pd_event-queue-in-port_reset.patch selinux-revert-our-use-of-vma_is_initial_heap.patch series tty-atmel_serial-use-the-correct-rts-flag.patch tty-serial-fsl_lpuart-mark-last-busy-before-uart_add_one_port.patch tty-vt-conmakehash-remove-non-portable-code-printing-comment-header.patch --- diff --git a/queue-6.10/netfs-ceph-revert-netfs-remove-deprecated-use-of-pg_private_2-as-a-second-writeback-flag.patch b/queue-6.10/netfs-ceph-revert-netfs-remove-deprecated-use-of-pg_private_2-as-a-second-writeback-flag.patch new file mode 100644 index 00000000000..35d9189e9a1 --- /dev/null +++ b/queue-6.10/netfs-ceph-revert-netfs-remove-deprecated-use-of-pg_private_2-as-a-second-writeback-flag.patch @@ -0,0 +1,300 @@ +From 8e5ced7804cb9184c4a23f8054551240562a8eda Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Tue, 30 Jul 2024 17:01:40 +0100 +Subject: netfs, ceph: Revert "netfs: Remove deprecated use of PG_private_2 as a second writeback flag" + +From: David Howells + +commit 8e5ced7804cb9184c4a23f8054551240562a8eda upstream. + +This reverts commit ae678317b95e760607c7b20b97c9cd4ca9ed6e1a. + +Revert the patch that removes the deprecated use of PG_private_2 in +netfslib for the moment as Ceph is actually still using this to track +data copied to the cache. + +Fixes: ae678317b95e ("netfs: Remove deprecated use of PG_private_2 as a second writeback flag") +Reported-by: Max Kellermann +Signed-off-by: David Howells +cc: Ilya Dryomov +cc: Xiubo Li +cc: Jeff Layton +cc: Matthew Wilcox +cc: ceph-devel@vger.kernel.org +cc: netfs@lists.linux.dev +cc: linux-fsdevel@vger.kernel.org +cc: linux-mm@kvack.org +https: //lore.kernel.org/r/3575457.1722355300@warthog.procyon.org.uk +Signed-off-by: Christian Brauner +Signed-off-by: Greg Kroah-Hartman +--- + fs/ceph/addr.c | 19 +++++ + fs/netfs/buffered_read.c | 8 ++ + fs/netfs/io.c | 144 +++++++++++++++++++++++++++++++++++++++++++ + include/trace/events/netfs.h | 1 + 4 files changed, 170 insertions(+), 2 deletions(-) + +--- a/fs/ceph/addr.c ++++ b/fs/ceph/addr.c +@@ -498,6 +498,11 @@ const struct netfs_request_ops ceph_netf + }; + + #ifdef CONFIG_CEPH_FSCACHE ++static void ceph_set_page_fscache(struct page *page) ++{ ++ folio_start_private_2(page_folio(page)); /* [DEPRECATED] */ ++} ++ + static void ceph_fscache_write_terminated(void *priv, ssize_t error, bool was_async) + { + struct inode *inode = priv; +@@ -515,6 +520,10 @@ static void ceph_fscache_write_to_cache( + ceph_fscache_write_terminated, inode, true, caching); + } + #else ++static inline void ceph_set_page_fscache(struct page *page) ++{ ++} ++ + static inline void ceph_fscache_write_to_cache(struct inode *inode, u64 off, u64 len, bool caching) + { + } +@@ -706,6 +715,8 @@ static int writepage_nounlock(struct pag + len = wlen; + + set_page_writeback(page); ++ if (caching) ++ ceph_set_page_fscache(page); + ceph_fscache_write_to_cache(inode, page_off, len, caching); + + if (IS_ENCRYPTED(inode)) { +@@ -789,6 +800,8 @@ static int ceph_writepage(struct page *p + return AOP_WRITEPAGE_ACTIVATE; + } + ++ folio_wait_private_2(page_folio(page)); /* [DEPRECATED] */ ++ + err = writepage_nounlock(page, wbc); + if (err == -ERESTARTSYS) { + /* direct memory reclaimer was killed by SIGKILL. return 0 +@@ -1062,7 +1075,8 @@ get_more_pages: + unlock_page(page); + break; + } +- if (PageWriteback(page)) { ++ if (PageWriteback(page) || ++ PagePrivate2(page) /* [DEPRECATED] */) { + if (wbc->sync_mode == WB_SYNC_NONE) { + doutc(cl, "%p under writeback\n", page); + unlock_page(page); +@@ -1070,6 +1084,7 @@ get_more_pages: + } + doutc(cl, "waiting on writeback %p\n", page); + wait_on_page_writeback(page); ++ folio_wait_private_2(page_folio(page)); /* [DEPRECATED] */ + } + + if (!clear_page_dirty_for_io(page)) { +@@ -1254,6 +1269,8 @@ new_request: + } + + set_page_writeback(page); ++ if (caching) ++ ceph_set_page_fscache(page); + len += thp_size(page); + } + ceph_fscache_write_to_cache(inode, offset, len, caching); +--- a/fs/netfs/buffered_read.c ++++ b/fs/netfs/buffered_read.c +@@ -466,7 +466,7 @@ retry: + if (!netfs_is_cache_enabled(ctx) && + netfs_skip_folio_read(folio, pos, len, false)) { + netfs_stat(&netfs_n_rh_write_zskip); +- goto have_folio; ++ goto have_folio_no_wait; + } + + rreq = netfs_alloc_request(mapping, file, +@@ -507,6 +507,12 @@ retry: + netfs_put_request(rreq, false, netfs_rreq_trace_put_return); + + have_folio: ++ if (test_bit(NETFS_ICTX_USE_PGPRIV2, &ctx->flags)) { ++ ret = folio_wait_private_2_killable(folio); ++ if (ret < 0) ++ goto error; ++ } ++have_folio_no_wait: + *_folio = folio; + kleave(" = 0"); + return 0; +--- a/fs/netfs/io.c ++++ b/fs/netfs/io.c +@@ -99,6 +99,146 @@ static void netfs_rreq_completed(struct + } + + /* ++ * [DEPRECATED] Deal with the completion of writing the data to the cache. We ++ * have to clear the PG_fscache bits on the folios involved and release the ++ * caller's ref. ++ * ++ * May be called in softirq mode and we inherit a ref from the caller. ++ */ ++static void netfs_rreq_unmark_after_write(struct netfs_io_request *rreq, ++ bool was_async) ++{ ++ struct netfs_io_subrequest *subreq; ++ struct folio *folio; ++ pgoff_t unlocked = 0; ++ bool have_unlocked = false; ++ ++ rcu_read_lock(); ++ ++ list_for_each_entry(subreq, &rreq->subrequests, rreq_link) { ++ XA_STATE(xas, &rreq->mapping->i_pages, subreq->start / PAGE_SIZE); ++ ++ xas_for_each(&xas, folio, (subreq->start + subreq->len - 1) / PAGE_SIZE) { ++ if (xas_retry(&xas, folio)) ++ continue; ++ ++ /* We might have multiple writes from the same huge ++ * folio, but we mustn't unlock a folio more than once. ++ */ ++ if (have_unlocked && folio->index <= unlocked) ++ continue; ++ unlocked = folio_next_index(folio) - 1; ++ trace_netfs_folio(folio, netfs_folio_trace_end_copy); ++ folio_end_private_2(folio); ++ have_unlocked = true; ++ } ++ } ++ ++ rcu_read_unlock(); ++ netfs_rreq_completed(rreq, was_async); ++} ++ ++static void netfs_rreq_copy_terminated(void *priv, ssize_t transferred_or_error, ++ bool was_async) /* [DEPRECATED] */ ++{ ++ struct netfs_io_subrequest *subreq = priv; ++ struct netfs_io_request *rreq = subreq->rreq; ++ ++ if (IS_ERR_VALUE(transferred_or_error)) { ++ netfs_stat(&netfs_n_rh_write_failed); ++ trace_netfs_failure(rreq, subreq, transferred_or_error, ++ netfs_fail_copy_to_cache); ++ } else { ++ netfs_stat(&netfs_n_rh_write_done); ++ } ++ ++ trace_netfs_sreq(subreq, netfs_sreq_trace_write_term); ++ ++ /* If we decrement nr_copy_ops to 0, the ref belongs to us. */ ++ if (atomic_dec_and_test(&rreq->nr_copy_ops)) ++ netfs_rreq_unmark_after_write(rreq, was_async); ++ ++ netfs_put_subrequest(subreq, was_async, netfs_sreq_trace_put_terminated); ++} ++ ++/* ++ * [DEPRECATED] Perform any outstanding writes to the cache. We inherit a ref ++ * from the caller. ++ */ ++static void netfs_rreq_do_write_to_cache(struct netfs_io_request *rreq) ++{ ++ struct netfs_cache_resources *cres = &rreq->cache_resources; ++ struct netfs_io_subrequest *subreq, *next, *p; ++ struct iov_iter iter; ++ int ret; ++ ++ trace_netfs_rreq(rreq, netfs_rreq_trace_copy); ++ ++ /* We don't want terminating writes trying to wake us up whilst we're ++ * still going through the list. ++ */ ++ atomic_inc(&rreq->nr_copy_ops); ++ ++ list_for_each_entry_safe(subreq, p, &rreq->subrequests, rreq_link) { ++ if (!test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags)) { ++ list_del_init(&subreq->rreq_link); ++ netfs_put_subrequest(subreq, false, ++ netfs_sreq_trace_put_no_copy); ++ } ++ } ++ ++ list_for_each_entry(subreq, &rreq->subrequests, rreq_link) { ++ /* Amalgamate adjacent writes */ ++ while (!list_is_last(&subreq->rreq_link, &rreq->subrequests)) { ++ next = list_next_entry(subreq, rreq_link); ++ if (next->start != subreq->start + subreq->len) ++ break; ++ subreq->len += next->len; ++ list_del_init(&next->rreq_link); ++ netfs_put_subrequest(next, false, ++ netfs_sreq_trace_put_merged); ++ } ++ ++ ret = cres->ops->prepare_write(cres, &subreq->start, &subreq->len, ++ subreq->len, rreq->i_size, true); ++ if (ret < 0) { ++ trace_netfs_failure(rreq, subreq, ret, netfs_fail_prepare_write); ++ trace_netfs_sreq(subreq, netfs_sreq_trace_write_skip); ++ continue; ++ } ++ ++ iov_iter_xarray(&iter, ITER_SOURCE, &rreq->mapping->i_pages, ++ subreq->start, subreq->len); ++ ++ atomic_inc(&rreq->nr_copy_ops); ++ netfs_stat(&netfs_n_rh_write); ++ netfs_get_subrequest(subreq, netfs_sreq_trace_get_copy_to_cache); ++ trace_netfs_sreq(subreq, netfs_sreq_trace_write); ++ cres->ops->write(cres, subreq->start, &iter, ++ netfs_rreq_copy_terminated, subreq); ++ } ++ ++ /* If we decrement nr_copy_ops to 0, the usage ref belongs to us. */ ++ if (atomic_dec_and_test(&rreq->nr_copy_ops)) ++ netfs_rreq_unmark_after_write(rreq, false); ++} ++ ++static void netfs_rreq_write_to_cache_work(struct work_struct *work) /* [DEPRECATED] */ ++{ ++ struct netfs_io_request *rreq = ++ container_of(work, struct netfs_io_request, work); ++ ++ netfs_rreq_do_write_to_cache(rreq); ++} ++ ++static void netfs_rreq_write_to_cache(struct netfs_io_request *rreq) /* [DEPRECATED] */ ++{ ++ rreq->work.func = netfs_rreq_write_to_cache_work; ++ if (!queue_work(system_unbound_wq, &rreq->work)) ++ BUG(); ++} ++ ++/* + * Handle a short read. + */ + static void netfs_rreq_short_read(struct netfs_io_request *rreq, +@@ -275,6 +415,10 @@ again: + clear_bit_unlock(NETFS_RREQ_IN_PROGRESS, &rreq->flags); + wake_up_bit(&rreq->flags, NETFS_RREQ_IN_PROGRESS); + ++ if (test_bit(NETFS_RREQ_COPY_TO_CACHE, &rreq->flags) && ++ test_bit(NETFS_RREQ_USE_PGPRIV2, &rreq->flags)) ++ return netfs_rreq_write_to_cache(rreq); ++ + netfs_rreq_completed(rreq, was_async); + } + +--- a/include/trace/events/netfs.h ++++ b/include/trace/events/netfs.h +@@ -145,6 +145,7 @@ + EM(netfs_folio_trace_clear_g, "clear-g") \ + EM(netfs_folio_trace_clear_s, "clear-s") \ + EM(netfs_folio_trace_copy_to_cache, "mark-copy") \ ++ EM(netfs_folio_trace_end_copy, "end-copy") \ + EM(netfs_folio_trace_filled_gaps, "filled-gaps") \ + EM(netfs_folio_trace_kill, "kill") \ + EM(netfs_folio_trace_kill_cc, "kill-cc") \ diff --git a/queue-6.10/revert-acpi-ec-evaluate-orphan-_reg-under-ec-device.patch b/queue-6.10/revert-acpi-ec-evaluate-orphan-_reg-under-ec-device.patch new file mode 100644 index 00000000000..8fe32b685b3 --- /dev/null +++ b/queue-6.10/revert-acpi-ec-evaluate-orphan-_reg-under-ec-device.patch @@ -0,0 +1,146 @@ +From 779bac9994452f6a894524f70c00cfb0cd4b6364 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Mon, 12 Aug 2024 15:08:04 +0200 +Subject: Revert "ACPI: EC: Evaluate orphan _REG under EC device" + +From: Rafael J. Wysocki + +commit 779bac9994452f6a894524f70c00cfb0cd4b6364 upstream. + +This reverts commit 0e6b6dedf168 ("Revert "ACPI: EC: Evaluate orphan +_REG under EC device") because the problem addressed by it will be +addressed differently in what follows. + +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Hans de Goede +Cc: All applicable +Link: https://patch.msgid.link/3236716.5fSG56mABF@rjwysocki.net +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/acpica/acevents.h | 4 --- + drivers/acpi/acpica/evregion.c | 6 +++- + drivers/acpi/acpica/evxfregn.c | 54 ----------------------------------------- + drivers/acpi/ec.c | 3 -- + include/acpi/acpixf.h | 4 --- + 5 files changed, 5 insertions(+), 66 deletions(-) + +--- a/drivers/acpi/acpica/acevents.h ++++ b/drivers/acpi/acpica/acevents.h +@@ -191,10 +191,6 @@ void + acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, + acpi_adr_space_type space_id, u32 function); + +-void +-acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *node, +- acpi_adr_space_type space_id); +- + acpi_status + acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); + +--- a/drivers/acpi/acpica/evregion.c ++++ b/drivers/acpi/acpica/evregion.c +@@ -20,6 +20,10 @@ extern u8 acpi_gbl_default_address_space + + /* Local prototypes */ + ++static void ++acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, ++ acpi_adr_space_type space_id); ++ + static acpi_status + acpi_ev_reg_run(acpi_handle obj_handle, + u32 level, void *context, void **return_value); +@@ -814,7 +818,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, + * + ******************************************************************************/ + +-void ++static void + acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, + acpi_adr_space_type space_id) + { +--- a/drivers/acpi/acpica/evxfregn.c ++++ b/drivers/acpi/acpica/evxfregn.c +@@ -306,57 +306,3 @@ acpi_execute_reg_methods(acpi_handle dev + } + + ACPI_EXPORT_SYMBOL(acpi_execute_reg_methods) +- +-/******************************************************************************* +- * +- * FUNCTION: acpi_execute_orphan_reg_method +- * +- * PARAMETERS: device - Handle for the device +- * space_id - The address space ID +- * +- * RETURN: Status +- * +- * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI +- * device. This is a _REG method that has no corresponding region +- * within the device's scope. +- * +- ******************************************************************************/ +-acpi_status +-acpi_execute_orphan_reg_method(acpi_handle device, acpi_adr_space_type space_id) +-{ +- struct acpi_namespace_node *node; +- acpi_status status; +- +- ACPI_FUNCTION_TRACE(acpi_execute_orphan_reg_method); +- +- /* Parameter validation */ +- +- if (!device) { +- return_ACPI_STATUS(AE_BAD_PARAMETER); +- } +- +- status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); +- if (ACPI_FAILURE(status)) { +- return_ACPI_STATUS(status); +- } +- +- /* Convert and validate the device handle */ +- +- node = acpi_ns_validate_handle(device); +- if (node) { +- +- /* +- * If an "orphan" _REG method is present in the device's scope +- * for the given address space ID, run it. +- */ +- +- acpi_ev_execute_orphan_reg_method(node, space_id); +- } else { +- status = AE_BAD_PARAMETER; +- } +- +- (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +- return_ACPI_STATUS(status); +-} +- +-ACPI_EXPORT_SYMBOL(acpi_execute_orphan_reg_method) +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -1507,9 +1507,6 @@ static int ec_install_handlers(struct ac + + if (call_reg && !test_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags)) { + acpi_execute_reg_methods(scope_handle, ACPI_ADR_SPACE_EC); +- if (scope_handle != ec->handle) +- acpi_execute_orphan_reg_method(ec->handle, ACPI_ADR_SPACE_EC); +- + set_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags); + } + +--- a/include/acpi/acpixf.h ++++ b/include/acpi/acpixf.h +@@ -663,10 +663,6 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_adr_space_type + space_id)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status +- acpi_execute_orphan_reg_method(acpi_handle device, +- acpi_adr_space_type +- space_id)) +-ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_remove_address_space_handler(acpi_handle + device, + acpi_adr_space_type diff --git a/queue-6.10/revert-misc-fastrpc-restrict-untrusted-app-to-attach-to-privileged-pd.patch b/queue-6.10/revert-misc-fastrpc-restrict-untrusted-app-to-attach-to-privileged-pd.patch new file mode 100644 index 00000000000..1ba1fe1ce8c --- /dev/null +++ b/queue-6.10/revert-misc-fastrpc-restrict-untrusted-app-to-attach-to-privileged-pd.patch @@ -0,0 +1,88 @@ +From 9bb5e74b2bf88fbb024bb15ded3b011e02c673be Mon Sep 17 00:00:00 2001 +From: Griffin Kroah-Hartman +Date: Thu, 15 Aug 2024 11:49:20 +0200 +Subject: Revert "misc: fastrpc: Restrict untrusted app to attach to privileged PD" + +From: Griffin Kroah-Hartman + +commit 9bb5e74b2bf88fbb024bb15ded3b011e02c673be upstream. + +This reverts commit bab2f5e8fd5d2f759db26b78d9db57412888f187. + +Joel reported that this commit breaks userspace and stops sensors in +SDM845 from working. Also breaks other qcom SoC devices running postmarketOS. + +Cc: stable +Cc: Ekansh Gupta +Cc: Dmitry Baryshkov +Reported-by: Joel Selvaraj +Link: https://lore.kernel.org/r/9a9f5646-a554-4b65-8122-d212bb665c81@umsystem.edu +Signed-off-by: Griffin Kroah-Hartman +Acked-by: Srinivas Kandagatla +Fixes: bab2f5e8fd5d ("misc: fastrpc: Restrict untrusted app to attach to privileged PD") +Link: https://lore.kernel.org/r/20240815094920.8242-1-griffin@kroah.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/fastrpc.c | 22 +++------------------- + include/uapi/misc/fastrpc.h | 3 --- + 2 files changed, 3 insertions(+), 22 deletions(-) + +--- a/drivers/misc/fastrpc.c ++++ b/drivers/misc/fastrpc.c +@@ -2087,16 +2087,6 @@ err_invoke: + return err; + } + +-static int is_attach_rejected(struct fastrpc_user *fl) +-{ +- /* Check if the device node is non-secure */ +- if (!fl->is_secure_dev) { +- dev_dbg(&fl->cctx->rpdev->dev, "untrusted app trying to attach to privileged DSP PD\n"); +- return -EACCES; +- } +- return 0; +-} +- + static long fastrpc_device_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) + { +@@ -2109,19 +2099,13 @@ static long fastrpc_device_ioctl(struct + err = fastrpc_invoke(fl, argp); + break; + case FASTRPC_IOCTL_INIT_ATTACH: +- err = is_attach_rejected(fl); +- if (!err) +- err = fastrpc_init_attach(fl, ROOT_PD); ++ err = fastrpc_init_attach(fl, ROOT_PD); + break; + case FASTRPC_IOCTL_INIT_ATTACH_SNS: +- err = is_attach_rejected(fl); +- if (!err) +- err = fastrpc_init_attach(fl, SENSORS_PD); ++ err = fastrpc_init_attach(fl, SENSORS_PD); + break; + case FASTRPC_IOCTL_INIT_CREATE_STATIC: +- err = is_attach_rejected(fl); +- if (!err) +- err = fastrpc_init_create_static_process(fl, argp); ++ err = fastrpc_init_create_static_process(fl, argp); + break; + case FASTRPC_IOCTL_INIT_CREATE: + err = fastrpc_init_create_process(fl, argp); +--- a/include/uapi/misc/fastrpc.h ++++ b/include/uapi/misc/fastrpc.h +@@ -8,14 +8,11 @@ + #define FASTRPC_IOCTL_ALLOC_DMA_BUFF _IOWR('R', 1, struct fastrpc_alloc_dma_buf) + #define FASTRPC_IOCTL_FREE_DMA_BUFF _IOWR('R', 2, __u32) + #define FASTRPC_IOCTL_INVOKE _IOWR('R', 3, struct fastrpc_invoke) +-/* This ioctl is only supported with secure device nodes */ + #define FASTRPC_IOCTL_INIT_ATTACH _IO('R', 4) + #define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create) + #define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap) + #define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap) +-/* This ioctl is only supported with secure device nodes */ + #define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8) +-/* This ioctl is only supported with secure device nodes */ + #define FASTRPC_IOCTL_INIT_CREATE_STATIC _IOWR('R', 9, struct fastrpc_init_create_static) + #define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map) + #define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap) diff --git a/queue-6.10/revert-serial-8250_omap-set-the-console-genpd-always-on-if-no-console-suspend.patch b/queue-6.10/revert-serial-8250_omap-set-the-console-genpd-always-on-if-no-console-suspend.patch new file mode 100644 index 00000000000..a42a129ddf6 --- /dev/null +++ b/queue-6.10/revert-serial-8250_omap-set-the-console-genpd-always-on-if-no-console-suspend.patch @@ -0,0 +1,104 @@ +From 0863bffda1131fd2fa9c05b653ad9ee3d8db127e Mon Sep 17 00:00:00 2001 +From: Griffin Kroah-Hartman +Date: Wed, 14 Aug 2024 13:17:47 +0200 +Subject: Revert "serial: 8250_omap: Set the console genpd always on if no console suspend" + +From: Griffin Kroah-Hartman + +commit 0863bffda1131fd2fa9c05b653ad9ee3d8db127e upstream. + +This reverts commit 68e6939ea9ec3d6579eadeab16060339cdeaf940. + +Kevin reported that this causes a crash during suspend on platforms that +dont use PM domains. + +Link: https://lore.kernel.org/r/7ha5hgpchq.fsf@baylibre.com +Cc: Thomas Richard +Fixes: 68e6939ea9ec ("serial: 8250_omap: Set the console genpd always on if no console suspend") +Cc: stable +Reported-by: Kevin Hilman +Signed-off-by: Griffin Kroah-Hartman +Link: https://lore.kernel.org/r/20240814111747.82371-1-griffin@kroah.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_omap.c | 33 +++++------------------------ + 1 file changed, 5 insertions(+), 28 deletions(-) + +diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c +index 1af9aed99c65..afef1dd4ddf4 100644 +--- a/drivers/tty/serial/8250/8250_omap.c ++++ b/drivers/tty/serial/8250/8250_omap.c +@@ -27,7 +27,6 @@ + #include + #include + #include +-#include + + #include "8250.h" + +@@ -119,12 +118,6 @@ + #define UART_OMAP_TO_L 0x26 + #define UART_OMAP_TO_H 0x27 + +-/* +- * Copy of the genpd flags for the console. +- * Only used if console suspend is disabled +- */ +-static unsigned int genpd_flags_console; +- + struct omap8250_priv { + void __iomem *membase; + int line; +@@ -1655,7 +1648,6 @@ static int omap8250_suspend(struct device *dev) + { + struct omap8250_priv *priv = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(priv->line); +- struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain); + int err = 0; + + serial8250_suspend_port(priv->line); +@@ -1666,19 +1658,8 @@ static int omap8250_suspend(struct device *dev) + if (!device_may_wakeup(dev)) + priv->wer = 0; + serial_out(up, UART_OMAP_WER, priv->wer); +- if (uart_console(&up->port)) { +- if (console_suspend_enabled) +- err = pm_runtime_force_suspend(dev); +- else { +- /* +- * The pd shall not be powered-off (no console suspend). +- * Make copy of genpd flags before to set it always on. +- * The original value is restored during the resume. +- */ +- genpd_flags_console = genpd->flags; +- genpd->flags |= GENPD_FLAG_ALWAYS_ON; +- } +- } ++ if (uart_console(&up->port) && console_suspend_enabled) ++ err = pm_runtime_force_suspend(dev); + flush_work(&priv->qos_work); + + return err; +@@ -1688,16 +1669,12 @@ static int omap8250_resume(struct device *dev) + { + struct omap8250_priv *priv = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(priv->line); +- struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain); + int err; + + if (uart_console(&up->port) && console_suspend_enabled) { +- if (console_suspend_enabled) { +- err = pm_runtime_force_resume(dev); +- if (err) +- return err; +- } else +- genpd->flags = genpd_flags_console; ++ err = pm_runtime_force_resume(dev); ++ if (err) ++ return err; + } + + serial8250_resume_port(priv->line); +-- +2.46.0 + diff --git a/queue-6.10/revert-usb-typec-tcpm-clear-pd_event-queue-in-port_reset.patch b/queue-6.10/revert-usb-typec-tcpm-clear-pd_event-queue-in-port_reset.patch new file mode 100644 index 00000000000..45a96178902 --- /dev/null +++ b/queue-6.10/revert-usb-typec-tcpm-clear-pd_event-queue-in-port_reset.patch @@ -0,0 +1,65 @@ +From 21ea1ce37fc267dc45fe27517bbde926211683df Mon Sep 17 00:00:00 2001 +From: Xu Yang +Date: Fri, 9 Aug 2024 19:29:01 +0800 +Subject: Revert "usb: typec: tcpm: clear pd_event queue in PORT_RESET" + +From: Xu Yang + +commit 21ea1ce37fc267dc45fe27517bbde926211683df upstream. + +This reverts commit bf20c69cf3cf9c6445c4925dd9a8a6ca1b78bfdf. + +During tcpm_init() stage, if the VBUS is still present after +tcpm_reset_port(), then we assume that VBUS will off and goto safe0v +after a specific discharge time. Following a TCPM_VBUS_EVENT event if +VBUS reach to off state. TCPM_VBUS_EVENT event may be set during +PORT_RESET handling stage. If pd_events reset to 0 after TCPM_VBUS_EVENT +set, we will lost this VBUS event. Then the port state machine may stuck +at one state. + +Before: + +[ 2.570172] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev1 NONE_AMS] +[ 2.570179] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms] +[ 2.570182] pending state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED @ 920 ms [rev1 NONE_AMS] +[ 3.490213] state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED [delayed 920 ms] +[ 3.490220] Start toggling +[ 3.546050] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected] +[ 3.546057] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS] + +After revert this patch, we can see VBUS off event and the port will goto +expected state. + +[ 2.441992] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev1 NONE_AMS] +[ 2.441999] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms] +[ 2.442002] pending state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED @ 920 ms [rev1 NONE_AMS] +[ 2.442122] VBUS off +[ 2.442125] state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED [rev1 NONE_AMS] +[ 2.442127] VBUS VSAFE0V +[ 2.442351] CC1: 0 -> 0, CC2: 0 -> 0 [state SNK_UNATTACHED, polarity 0, disconnected] +[ 2.442357] Start toggling +[ 2.491850] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected] +[ 2.491858] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS] +[ 2.491863] pending state change SRC_ATTACH_WAIT -> SNK_TRY @ 200 ms [rev1 NONE_AMS] +[ 2.691905] state change SRC_ATTACH_WAIT -> SNK_TRY [delayed 200 ms] + +Fixes: bf20c69cf3cf ("usb: typec: tcpm: clear pd_event queue in PORT_RESET") +Cc: stable@vger.kernel.org +Signed-off-by: Xu Yang +Acked-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20240809112901.535072-1-xu.yang_2@nxp.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/tcpm/tcpm.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -5630,7 +5630,6 @@ static void run_state_machine(struct tcp + break; + case PORT_RESET: + tcpm_reset_port(port); +- port->pd_events = 0; + if (port->self_powered) + tcpm_set_cc(port, TYPEC_CC_OPEN); + else diff --git a/queue-6.10/selinux-revert-our-use-of-vma_is_initial_heap.patch b/queue-6.10/selinux-revert-our-use-of-vma_is_initial_heap.patch new file mode 100644 index 00000000000..d0b4ca01b7d --- /dev/null +++ b/queue-6.10/selinux-revert-our-use-of-vma_is_initial_heap.patch @@ -0,0 +1,56 @@ +From 05a3d6e9307250a5911d75308e4363466794ab21 Mon Sep 17 00:00:00 2001 +From: Paul Moore +Date: Thu, 8 Aug 2024 11:57:38 -0400 +Subject: selinux: revert our use of vma_is_initial_heap() + +From: Paul Moore + +commit 05a3d6e9307250a5911d75308e4363466794ab21 upstream. + +Unfortunately it appears that vma_is_initial_heap() is currently broken +for applications that do not currently have any heap allocated, e.g. +brk == start_brk. The breakage is such that it will cause SELinux to +check for the process/execheap permission on memory regions that cross +brk/start_brk even when there is no heap. + +The proper fix would be to correct vma_is_initial_heap(), but as there +are multiple callers I am hesitant to unilaterally modify the helper +out of concern that I would end up breaking some other subsystem. The +mm developers have been made aware of the situation and hopefully they +will have a fix at some point in the future, but we need a fix soon so +we are simply going to revert our use of vma_is_initial_heap() in favor +of our old logic/code which works as expected, even in the face of a +zero size heap. We can return to using vma_is_initial_heap() at some +point in the future when it is fixed. + +Cc: stable@vger.kernel.org +Reported-by: Marc Reisner +Closes: https://lore.kernel.org/all/ZrPmoLKJEf1wiFmM@marcreisner.com +Fixes: 68df1baf158f ("selinux: use vma_is_initial_stack() and vma_is_initial_heap()") +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman +--- + security/selinux/hooks.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +--- a/security/selinux/hooks.c ++++ b/security/selinux/hooks.c +@@ -3852,7 +3852,17 @@ static int selinux_file_mprotect(struct + if (default_noexec && + (prot & PROT_EXEC) && !(vma->vm_flags & VM_EXEC)) { + int rc = 0; +- if (vma_is_initial_heap(vma)) { ++ /* ++ * We don't use the vma_is_initial_heap() helper as it has ++ * a history of problems and is currently broken on systems ++ * where there is no heap, e.g. brk == start_brk. Before ++ * replacing the conditional below with vma_is_initial_heap(), ++ * or something similar, please ensure that the logic is the ++ * same as what we have below or you have tested every possible ++ * corner case you can think to test. ++ */ ++ if (vma->vm_start >= vma->vm_mm->start_brk && ++ vma->vm_end <= vma->vm_mm->brk) { + rc = avc_has_perm(sid, sid, SECCLASS_PROCESS, + PROCESS__EXECHEAP, NULL); + } else if (!vma->vm_file && (vma_is_initial_stack(vma) || diff --git a/queue-6.10/series b/queue-6.10/series new file mode 100644 index 00000000000..fc7c6e6c181 --- /dev/null +++ b/queue-6.10/series @@ -0,0 +1,9 @@ +tty-vt-conmakehash-remove-non-portable-code-printing-comment-header.patch +tty-serial-fsl_lpuart-mark-last-busy-before-uart_add_one_port.patch +tty-atmel_serial-use-the-correct-rts-flag.patch +revert-acpi-ec-evaluate-orphan-_reg-under-ec-device.patch +revert-misc-fastrpc-restrict-untrusted-app-to-attach-to-privileged-pd.patch +revert-serial-8250_omap-set-the-console-genpd-always-on-if-no-console-suspend.patch +revert-usb-typec-tcpm-clear-pd_event-queue-in-port_reset.patch +selinux-revert-our-use-of-vma_is_initial_heap.patch +netfs-ceph-revert-netfs-remove-deprecated-use-of-pg_private_2-as-a-second-writeback-flag.patch diff --git a/queue-6.10/tty-atmel_serial-use-the-correct-rts-flag.patch b/queue-6.10/tty-atmel_serial-use-the-correct-rts-flag.patch new file mode 100644 index 00000000000..a196ad77ac0 --- /dev/null +++ b/queue-6.10/tty-atmel_serial-use-the-correct-rts-flag.patch @@ -0,0 +1,43 @@ +From c9f6613b16123989f2c3bd04b1d9b2365d6914e7 Mon Sep 17 00:00:00 2001 +From: Mathieu Othacehe +Date: Thu, 8 Aug 2024 08:06:37 +0200 +Subject: tty: atmel_serial: use the correct RTS flag. + +From: Mathieu Othacehe + +commit c9f6613b16123989f2c3bd04b1d9b2365d6914e7 upstream. + +In RS485 mode, the RTS pin is driven high by hardware when the transmitter +is operating. This behaviour cannot be changed. This means that the driver +should claim that it supports SER_RS485_RTS_ON_SEND and not +SER_RS485_RTS_AFTER_SEND. + +Otherwise, when configuring the port with the SER_RS485_RTS_ON_SEND, one +get the following warning: + +kern.warning kernel: atmel_usart_serial atmel_usart_serial.2.auto: +ttyS1 (1): invalid RTS setting, using RTS_AFTER_SEND instead + +which is contradictory with what's really happening. + +Signed-off-by: Mathieu Othacehe +Cc: stable +Tested-by: Alexander Dahl +Fixes: af47c491e3c7 ("serial: atmel: Fill in rs485_supported") +Link: https://lore.kernel.org/r/20240808060637.19886-1-othacehe@gnu.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/atmel_serial.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/atmel_serial.c ++++ b/drivers/tty/serial/atmel_serial.c +@@ -2514,7 +2514,7 @@ static const struct uart_ops atmel_pops + }; + + static const struct serial_rs485 atmel_rs485_supported = { +- .flags = SER_RS485_ENABLED | SER_RS485_RTS_AFTER_SEND | SER_RS485_RX_DURING_TX, ++ .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RX_DURING_TX, + .delay_rts_before_send = 1, + .delay_rts_after_send = 1, + }; diff --git a/queue-6.10/tty-serial-fsl_lpuart-mark-last-busy-before-uart_add_one_port.patch b/queue-6.10/tty-serial-fsl_lpuart-mark-last-busy-before-uart_add_one_port.patch new file mode 100644 index 00000000000..e1a50a98253 --- /dev/null +++ b/queue-6.10/tty-serial-fsl_lpuart-mark-last-busy-before-uart_add_one_port.patch @@ -0,0 +1,52 @@ +From dc98d76a15bc29a9a4e76f2f65f39f3e590fb15c Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Thu, 8 Aug 2024 22:03:25 +0800 +Subject: tty: serial: fsl_lpuart: mark last busy before uart_add_one_port + +From: Peng Fan + +commit dc98d76a15bc29a9a4e76f2f65f39f3e590fb15c upstream. + +With "earlycon initcall_debug=1 loglevel=8" in bootargs, kernel +sometimes boot hang. It is because normal console still is not ready, +but runtime suspend is called, so early console putchar will hang +in waiting TRDE set in UARTSTAT. + +The lpuart driver has auto suspend delay set to 3000ms, but during +uart_add_one_port, a child device serial ctrl will added and probed with +its pm runtime enabled(see serial_ctrl.c). +The runtime suspend call path is: +device_add + |-> bus_probe_device + |->device_initial_probe + |->__device_attach + |-> pm_runtime_get_sync(dev->parent); + |-> pm_request_idle(dev); + |-> pm_runtime_put(dev->parent); + +So in the end, before normal console ready, the lpuart get runtime +suspended. And earlycon putchar will hang. + +To address the issue, mark last busy just after pm_runtime_enable, +three seconds is long enough to switch from bootconsole to normal +console. + +Fixes: 43543e6f539b ("tty: serial: fsl_lpuart: Add runtime pm support") +Cc: stable +Signed-off-by: Peng Fan +Link: https://lore.kernel.org/r/20240808140325.580105-1-peng.fan@oss.nxp.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/fsl_lpuart.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/tty/serial/fsl_lpuart.c ++++ b/drivers/tty/serial/fsl_lpuart.c +@@ -2923,6 +2923,7 @@ static int lpuart_probe(struct platform_ + pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); ++ pm_runtime_mark_last_busy(&pdev->dev); + + ret = lpuart_global_reset(sport); + if (ret) diff --git a/queue-6.10/tty-vt-conmakehash-remove-non-portable-code-printing-comment-header.patch b/queue-6.10/tty-vt-conmakehash-remove-non-portable-code-printing-comment-header.patch new file mode 100644 index 00000000000..528329646e8 --- /dev/null +++ b/queue-6.10/tty-vt-conmakehash-remove-non-portable-code-printing-comment-header.patch @@ -0,0 +1,106 @@ +From 7258fdd7d7459616b3fe1a603e33900584b10c13 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Sat, 10 Aug 2024 01:07:20 +0900 +Subject: tty: vt: conmakehash: remove non-portable code printing comment header + +From: Masahiro Yamada + +commit 7258fdd7d7459616b3fe1a603e33900584b10c13 upstream. + +Commit 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no +longer in env") included , which invoked another +(wrong) patch that tried to address a build error on macOS. + +According to the specification [1], the correct header to use PATH_MAX +is . + +The minimal fix would be to replace with . + +However, the following commits seem questionable to me: + + - 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output") + - 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env") + +These commits made too many efforts to cope with a comment header in +drivers/tty/vt/consolemap_deftbl.c: + + /* + * Do not edit this file; it was automatically generated by + * + * conmakehash drivers/tty/vt/cp437.uni > [this file] + * + */ + +With this commit, the header part of the generate C file will be +simplified as follows: + + /* + * Automatically generated file; Do not edit. + */ + +BTW, another series of excessive efforts for a comment header can be +seen in the following: + + - 5ef6dc08cfde ("lib/build_OID_registry: don't mention the full path of the script in output") + - 2fe29fe94563 ("lib/build_OID_registry: avoid non-destructive substitution for Perl < 5.13.2 compat") + +[1]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html + +Fixes: 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env") +Cc: stable +Reported-by: Daniel Gomez +Closes: https://lore.kernel.org/all/20240807-macos-build-support-v1-11-4cd1ded85694@samsung.com/ +Signed-off-by: Masahiro Yamada +Link: https://lore.kernel.org/r/20240809160853.1269466-1-masahiroy@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/vt/conmakehash.c | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c +index 82d9db68b2ce..a931fcde7ad9 100644 +--- a/drivers/tty/vt/conmakehash.c ++++ b/drivers/tty/vt/conmakehash.c +@@ -11,8 +11,6 @@ + * Copyright (C) 1995-1997 H. Peter Anvin + */ + +-#include +-#include + #include + #include + #include +@@ -79,7 +77,6 @@ int main(int argc, char *argv[]) + { + FILE *ctbl; + const char *tblname; +- char base_tblname[PATH_MAX]; + char buffer[65536]; + int fontlen; + int i, nuni, nent; +@@ -245,20 +242,15 @@ int main(int argc, char *argv[]) + for ( i = 0 ; i < fontlen ; i++ ) + nuni += unicount[i]; + +- strncpy(base_tblname, tblname, PATH_MAX); +- base_tblname[PATH_MAX - 1] = 0; + printf("\ + /*\n\ +- * Do not edit this file; it was automatically generated by\n\ +- *\n\ +- * conmakehash %s > [this file]\n\ +- *\n\ ++ * Automatically generated file; Do not edit.\n\ + */\n\ + \n\ + #include \n\ + \n\ + u8 dfont_unicount[%d] = \n\ +-{\n\t", basename(base_tblname), fontlen); ++{\n\t", fontlen); + + for ( i = 0 ; i < fontlen ; i++ ) + { +-- +2.46.0 +