From: Sasha Levin Date: Fri, 12 Jun 2026 01:09:50 +0000 (-0400) Subject: Fixes for all trees X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=be9a9667b7a6efeec3d4bdb4ae78afe584d48a25;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for all trees Signed-off-by: Sasha Levin --- diff --git a/queue-6.12/series b/queue-6.12/series index b664088b86..e029c24f50 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -64,3 +64,4 @@ alsa-seq-dummy-fix-ump-event-stack-overread.patch ima-kexec-skip-ima-segment-validation-after-kexec-so.patch ima-kexec-move-ima-log-copy-from-kexec-load-to-execu.patch spi-cadence-quadspi-fix-unclocked-access-on-unbind.patch +tools-rv-fix-cleanup-after-failed-trace-setup.patch diff --git a/queue-6.12/tools-rv-fix-cleanup-after-failed-trace-setup.patch b/queue-6.12/tools-rv-fix-cleanup-after-failed-trace-setup.patch new file mode 100644 index 0000000000..398c3c93f2 --- /dev/null +++ b/queue-6.12/tools-rv-fix-cleanup-after-failed-trace-setup.patch @@ -0,0 +1,40 @@ +From 70287713d7292377de69b3147eceac581cc33466 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:45 +0200 +Subject: tools/rv: Fix cleanup after failed trace setup + +From: Gabriele Monaco + +[ Upstream commit 33ec2269a4155cad7e9e42c92327dcaa9aee59a7 ] + +Currently if ikm_setup_trace_instance() fails, the tool returns without +any cleanup, if rv was called with both -t and -r, this means the +reactor is not going to be cleared. + +Jump to the cleanup label to restore the reactor if necessary. + +Fixes: 6d60f89691fc9 ("tools/rv: Add in-kernel monitor interface") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-5-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index ced72950cb1eed..64ae847313f6dc 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -655,7 +655,7 @@ int ikm_run_monitor(char *monitor_name, int argc, char **argv) + if (config_trace) { + inst = ikm_setup_trace_instance(monitor_name); + if (!inst) +- return -1; ++ goto out_free_instance; + } + + retval = ikm_enable(monitor_name); +-- +2.53.0 + diff --git a/queue-6.18/cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch b/queue-6.18/cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch new file mode 100644 index 0000000000..21ea42eac7 --- /dev/null +++ b/queue-6.18/cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch @@ -0,0 +1,41 @@ +From cdae4f4fac3456e65f2b6398d49e6a1afb54fe34 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 May 2026 10:21:31 +0800 +Subject: cpufreq/amd-pstate: drop stale @epp_cached kdoc + +From: Zhan Xusheng + +[ Upstream commit 3cd07ee35a66038fd1a643632bfc057645e07c9a ] + +Commit 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP") removed +the epp_cached field from struct amd_cpudata in favour of always +reading from cppc_req_cached, but the kdoc above the struct still +documents @epp_cached. + +Drop the now-stale @epp_cached entry. + +Reviewed-by: Mario Limonciello (AMD) +Fixes: 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP") +Signed-off-by: Zhan Xusheng +Link: https://lore.kernel.org/r/20260526022131.1302373-1-zhanxusheng@xiaomi.com +Signed-off-by: Mario Limonciello (AMD) +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/amd-pstate.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/cpufreq/amd-pstate.h b/drivers/cpufreq/amd-pstate.h +index cb45fdca27a6c7..75136d2250c1a5 100644 +--- a/drivers/cpufreq/amd-pstate.h ++++ b/drivers/cpufreq/amd-pstate.h +@@ -76,7 +76,6 @@ struct amd_aperf_mperf { + * @hw_prefcore: check whether HW supports preferred core featue. + * Only when hw_prefcore and early prefcore param are true, + * AMD P-State driver supports preferred core featue. +- * @epp_cached: Cached CPPC energy-performance preference value + * @policy: Cpufreq policy value + * + * The amd_cpudata is key private data for each CPU thread in AMD P-State, and +-- +2.53.0 + diff --git a/queue-6.18/series b/queue-6.18/series index 8aa8a548dd..03d57d5344 100644 --- a/queue-6.18/series +++ b/queue-6.18/series @@ -74,3 +74,10 @@ time-fix-off-by-one-in-settimeofday-usec-validation.patch alsa-pcm-fix-wait-queue-list-corruption-in-snd_pcm_d.patch alsa-seq-dummy-fix-ump-event-stack-overread.patch spi-cadence-quadspi-fix-unclocked-access-on-unbind.patch +cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch +tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch +tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch +tools-rv-fix-substring-match-when-listing-container-.patch +tools-rv-fix-cleanup-after-failed-trace-setup.patch +verification-rvgen-fix-options-shared-among-commands.patch +verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch diff --git a/queue-6.18/tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch b/queue-6.18/tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch new file mode 100644 index 0000000000..a8e9660aba --- /dev/null +++ b/queue-6.18/tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch @@ -0,0 +1,47 @@ +From c2d7defd60088289258b4b1879d9ecda92c52796 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Jun 2026 14:09:45 +0200 +Subject: tools/rv: Ensure monitor name and desc are NUL-terminated + +From: Gabriele Monaco + +[ Upstream commit 08904765bb941f98306ae6841c33cfd299343faf ] + +ikm_fill_monitor_definition() copies monitor name and description with +strncpy(), but does not guarantee NUL termination when source strings are +equal to or longer than the destination buffers. + +Clamp copies to sizeof(dst) - 1 and explicitly append '\0' for both fields +to keep them safe for later string operations. + +Suggested-by: unknownbbqrx +Fixes: 6d60f89691fc9 ("tools/rv: Add in-kernel monitor interface") +Link: https://lore.kernel.org/r/20260604120946.90302-2-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index 4bb746ea6e1735..d324538249d3ab 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -215,10 +215,11 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *co + return -1; + } + +- strncpy(ikm->name, nested_name, MAX_DA_NAME_LEN); ++ strncpy(ikm->name, nested_name, sizeof(ikm->name) - 1); ++ ikm->name[sizeof(ikm->name) - 1] = '\0'; + ikm->enabled = enabled; +- strncpy(ikm->desc, desc, MAX_DESCRIPTION); +- ++ strncpy(ikm->desc, desc, sizeof(ikm->desc) - 1); ++ ikm->desc[sizeof(ikm->desc) - 1] = '\0'; + free(desc); + + return 0; +-- +2.53.0 + diff --git a/queue-6.18/tools-rv-fix-cleanup-after-failed-trace-setup.patch b/queue-6.18/tools-rv-fix-cleanup-after-failed-trace-setup.patch new file mode 100644 index 0000000000..753a305afb --- /dev/null +++ b/queue-6.18/tools-rv-fix-cleanup-after-failed-trace-setup.patch @@ -0,0 +1,40 @@ +From 986542d388617f7ace1e1d2f8750d95301d89a85 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:45 +0200 +Subject: tools/rv: Fix cleanup after failed trace setup + +From: Gabriele Monaco + +[ Upstream commit 33ec2269a4155cad7e9e42c92327dcaa9aee59a7 ] + +Currently if ikm_setup_trace_instance() fails, the tool returns without +any cleanup, if rv was called with both -t and -r, this means the +reactor is not going to be cleared. + +Jump to the cleanup label to restore the reactor if necessary. + +Fixes: 6d60f89691fc9 ("tools/rv: Add in-kernel monitor interface") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-5-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index e4f35940374f5a..e6dea4040f8f4c 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -810,7 +810,7 @@ int ikm_run_monitor(char *monitor_name, int argc, char **argv) + if (config_trace) { + inst = ikm_setup_trace_instance(nested_name); + if (!inst) +- return -1; ++ goto out_free_instance; + } + + retval = ikm_enable(full_name); +-- +2.53.0 + diff --git a/queue-6.18/tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch b/queue-6.18/tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch new file mode 100644 index 0000000000..079c0f3ae4 --- /dev/null +++ b/queue-6.18/tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch @@ -0,0 +1,96 @@ +From 086836316eddebfb8958c765c9086ec38bbabcc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:42 +0200 +Subject: tools/rv: Fix substring match bug in monitor name search + +From: Gabriele Monaco + +[ Upstream commit a963fbf3166f2e178ac38b6c3c186a0c98092fb9 ] + +__ikm_find_monitor_name() relies on strstr() to find a monitor by name, +which fails if the target monitor is a substring of a previously listed +monitor. + +Fix it by tokenizing the available_monitors file and matching full +tokens instead. + +Fixes: eba321a16fc6 ("tools/rv: Add support for nested monitors") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-2-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 48 ++++++++++++++------------- + 1 file changed, 25 insertions(+), 23 deletions(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index d324538249d3ab..95eac9ab148468 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -58,38 +58,40 @@ static int __ikm_read_enable(char *monitor_name) + */ + static int __ikm_find_monitor_name(char *monitor_name, char *out_name) + { +- char *available_monitors, container[MAX_DA_NAME_LEN+1], *cursor, *end; +- int retval = 1; ++ char *available_monitors, *cursor, *line; ++ int len = strlen(monitor_name); ++ int found = 0; + + available_monitors = tracefs_instance_file_read(NULL, "rv/available_monitors", NULL); + if (!available_monitors) + return -1; + +- cursor = strstr(available_monitors, monitor_name); +- if (!cursor) { +- retval = 0; +- goto out_free; +- } ++ config_is_container = 0; ++ cursor = available_monitors; ++ while ((line = strsep(&cursor, "\n"))) { ++ char *colon = strchr(line, ':'); + +- for (; cursor > available_monitors; cursor--) +- if (*(cursor-1) == '\n') +- break; +- end = strstr(cursor, "\n"); +- memcpy(out_name, cursor, end-cursor); +- out_name[end-cursor] = '\0'; +- +- cursor = strstr(out_name, ":"); +- if (cursor) +- *cursor = '/'; +- else { +- sprintf(container, "%s:", monitor_name); +- if (strstr(available_monitors, container)) +- config_is_container = 1; ++ if (strcmp(line, monitor_name) && (!colon || strcmp(colon + 1, monitor_name))) ++ continue; ++ ++ strncpy(out_name, line, 2 * MAX_DA_NAME_LEN); ++ out_name[2 * MAX_DA_NAME_LEN - 1] = '\0'; ++ ++ if (colon) { ++ out_name[colon - line] = '/'; ++ } else { ++ /* If there are children, they are on the next line. */ ++ line = strsep(&cursor, "\n"); ++ if (line && !strncmp(line, monitor_name, len) && line[len] == ':') ++ config_is_container = 1; ++ } ++ ++ found = 1; ++ break; + } + +-out_free: + free(available_monitors); +- return retval; ++ return found; + } + + /* +-- +2.53.0 + diff --git a/queue-6.18/tools-rv-fix-substring-match-when-listing-container-.patch b/queue-6.18/tools-rv-fix-substring-match-when-listing-container-.patch new file mode 100644 index 0000000000..09b4b7bdd8 --- /dev/null +++ b/queue-6.18/tools-rv-fix-substring-match-when-listing-container-.patch @@ -0,0 +1,48 @@ +From 787f1c8cb6d5c110d0e2083506a6faa5fa916469 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:43 +0200 +Subject: tools/rv: Fix substring match when listing container monitors + +From: Gabriele Monaco + +[ Upstream commit ba0247c5aa3fcb2890a92a97a88c70fe5ce704a6 ] + +When listing monitors within a specific container (rv list ), +the tool incorrectly matched monitors if the requested container name +was only a prefix of the actual container (e.g., 'rv list sche' would +incorrectly list monitors from 'sched:'). + +Fix this by ensuring the container name is an exact match and is +immediately followed by the ':' separator. + +Fixes: eba321a16fc6 ("tools/rv: Add support for nested monitors") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-3-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index 95eac9ab148468..e4f35940374f5a 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -193,8 +193,12 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *co + nested_name = strstr(name, ":"); + if (nested_name) { + /* it belongs in container if it starts with "container:" */ +- if (container && strstr(name, container) != name) +- return 1; ++ if (container) { ++ int len = strlen(container); ++ ++ if (strncmp(name, container, len) || name[len] != ':') ++ return 1; ++ } + *nested_name = '/'; + ++nested_name; + ikm->nested = 1; +-- +2.53.0 + diff --git a/queue-6.18/verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch b/queue-6.18/verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch new file mode 100644 index 0000000000..162b7c1348 --- /dev/null +++ b/queue-6.18/verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch @@ -0,0 +1,56 @@ +From f3d7f618da74f402b1b869e36d18043ffe677d89 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:48 +0200 +Subject: verification/rvgen: Fix ltl2k writing True as a literal + +From: Gabriele Monaco + +[ Upstream commit df996599cc69a9b74ff437c67751cf8a61f62e39 ] + +The rvgen parser for LTL stores literal true values in the python +representation (capitalised True), this doesn't build in C. +The Literal class should already handle this case but ASTNode skips its +strigification method and converts the value (true/false) directly. + +Fix by delegating ASTNode stringification to the Literal and Variable +classes instead of bypassing them. + +Fixes: 97ffa4ce6ab32 ("verification/rvgen: Add support for linear temporal logic") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-8-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rvgen/rvgen/ltl2ba.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/tools/verification/rvgen/rvgen/ltl2ba.py b/tools/verification/rvgen/rvgen/ltl2ba.py +index f14e6760ac3db8..aada15ec83a3c2 100644 +--- a/tools/verification/rvgen/rvgen/ltl2ba.py ++++ b/tools/verification/rvgen/rvgen/ltl2ba.py +@@ -121,10 +121,8 @@ class ASTNode: + return self.op.expand(self, node, node_set) + + def __str__(self): +- if isinstance(self.op, Literal): +- return str(self.op.value) +- if isinstance(self.op, Variable): +- return self.op.name.lower() ++ if isinstance(self.op, (Literal, Variable)): ++ return str(self.op) + return "val" + str(self.id) + + def normalize(self): +@@ -381,6 +379,9 @@ class Variable: + def __iter__(self): + yield from () + ++ def __str__(self): ++ return self.name.lower() ++ + def negate(self): + new = ASTNode(self) + return NotOp(new) +-- +2.53.0 + diff --git a/queue-6.18/verification-rvgen-fix-options-shared-among-commands.patch b/queue-6.18/verification-rvgen-fix-options-shared-among-commands.patch new file mode 100644 index 0000000000..b068f882c8 --- /dev/null +++ b/queue-6.18/verification-rvgen-fix-options-shared-among-commands.patch @@ -0,0 +1,66 @@ +From f7e95c1c835d17e1c065eb73063554defffdb3f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:47 +0200 +Subject: verification/rvgen: Fix options shared among commands + +From: Gabriele Monaco + +[ Upstream commit 5f845ad706c0b394ae274e9a930044f78bef782e ] + +After rvgen was refactored to use subparsers, the common options (-a and +-D) were left in the main parser. This meant that they needed to be +called /before/ the subcommand and using them without subcommand was +allowed. This is not the original intent. + + rvgen -D "some description" container -n name + +Define the options as parent in the subparsers to allow them to be used +from both subcommands together with other options. + + rvgen container -n name -D "some description" + +Fixes: 5270a0e3041c ("verification/dot2k: Replace is_container() hack with subparsers") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-7-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rvgen/__main__.py | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/tools/verification/rvgen/__main__.py b/tools/verification/rvgen/__main__.py +index fa6fc1f4de2f7e..5198bccccd107b 100644 +--- a/tools/verification/rvgen/__main__.py ++++ b/tools/verification/rvgen/__main__.py +@@ -17,14 +17,16 @@ if __name__ == '__main__': + import sys + + parser = argparse.ArgumentParser(description='Generate kernel rv monitor') +- parser.add_argument("-D", "--description", dest="description", required=False) +- parser.add_argument("-a", "--auto_patch", dest="auto_patch", ++ ++ parent_parser = argparse.ArgumentParser(add_help=False) ++ parent_parser.add_argument("-D", "--description", dest="description", required=False) ++ parent_parser.add_argument("-a", "--auto_patch", dest="auto_patch", + action="store_true", required=False, + help="Patch the kernel in place") + + subparsers = parser.add_subparsers(dest="subcmd", required=True) + +- monitor_parser = subparsers.add_parser("monitor") ++ monitor_parser = subparsers.add_parser("monitor", parents=[parent_parser]) + monitor_parser.add_argument('-n', "--model_name", dest="model_name") + monitor_parser.add_argument("-p", "--parent", dest="parent", + required=False, help="Create a monitor nested to parent") +@@ -34,7 +36,7 @@ if __name__ == '__main__': + monitor_parser.add_argument('-t', "--monitor_type", dest="monitor_type", + help=f"Available options: {', '.join(Monitor.monitor_types.keys())}") + +- container_parser = subparsers.add_parser("container") ++ container_parser = subparsers.add_parser("container", parents=[parent_parser]) + container_parser.add_argument('-n', "--model_name", dest="model_name", required=True) + + params = parser.parse_args() +-- +2.53.0 + diff --git a/queue-6.6/series b/queue-6.6/series index c2f6d36d99..9a3242aa37 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -249,3 +249,4 @@ time-fix-off-by-one-in-settimeofday-usec-validation.patch alsa-pcm-fix-wait-queue-list-corruption-in-snd_pcm_d.patch usb-gadget-f_ncm-fix-net_device-lifecycle-with-devic.patch usb-gadget-u_ether-fix-null-pointer-deref-in-eth_get.patch +tools-rv-fix-cleanup-after-failed-trace-setup.patch diff --git a/queue-6.6/tools-rv-fix-cleanup-after-failed-trace-setup.patch b/queue-6.6/tools-rv-fix-cleanup-after-failed-trace-setup.patch new file mode 100644 index 0000000000..1567b992ec --- /dev/null +++ b/queue-6.6/tools-rv-fix-cleanup-after-failed-trace-setup.patch @@ -0,0 +1,40 @@ +From 4db13024d2f9d1436fb5e18a79ebea48154f254e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:45 +0200 +Subject: tools/rv: Fix cleanup after failed trace setup + +From: Gabriele Monaco + +[ Upstream commit 33ec2269a4155cad7e9e42c92327dcaa9aee59a7 ] + +Currently if ikm_setup_trace_instance() fails, the tool returns without +any cleanup, if rv was called with both -t and -r, this means the +reactor is not going to be cleared. + +Jump to the cleanup label to restore the reactor if necessary. + +Fixes: 6d60f89691fc9 ("tools/rv: Add in-kernel monitor interface") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-5-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index ced72950cb1eed..64ae847313f6dc 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -655,7 +655,7 @@ int ikm_run_monitor(char *monitor_name, int argc, char **argv) + if (config_trace) { + inst = ikm_setup_trace_instance(monitor_name); + if (!inst) +- return -1; ++ goto out_free_instance; + } + + retval = ikm_enable(monitor_name); +-- +2.53.0 + diff --git a/queue-7.0/cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch b/queue-7.0/cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch new file mode 100644 index 0000000000..54e8636583 --- /dev/null +++ b/queue-7.0/cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch @@ -0,0 +1,41 @@ +From d01884a685d79698ae155d0e54f1296998f4b421 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 May 2026 10:21:31 +0800 +Subject: cpufreq/amd-pstate: drop stale @epp_cached kdoc + +From: Zhan Xusheng + +[ Upstream commit 3cd07ee35a66038fd1a643632bfc057645e07c9a ] + +Commit 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP") removed +the epp_cached field from struct amd_cpudata in favour of always +reading from cppc_req_cached, but the kdoc above the struct still +documents @epp_cached. + +Drop the now-stale @epp_cached entry. + +Reviewed-by: Mario Limonciello (AMD) +Fixes: 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP") +Signed-off-by: Zhan Xusheng +Link: https://lore.kernel.org/r/20260526022131.1302373-1-zhanxusheng@xiaomi.com +Signed-off-by: Mario Limonciello (AMD) +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/amd-pstate.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/cpufreq/amd-pstate.h b/drivers/cpufreq/amd-pstate.h +index cb45fdca27a6c7..75136d2250c1a5 100644 +--- a/drivers/cpufreq/amd-pstate.h ++++ b/drivers/cpufreq/amd-pstate.h +@@ -76,7 +76,6 @@ struct amd_aperf_mperf { + * @hw_prefcore: check whether HW supports preferred core featue. + * Only when hw_prefcore and early prefcore param are true, + * AMD P-State driver supports preferred core featue. +- * @epp_cached: Cached CPPC energy-performance preference value + * @policy: Cpufreq policy value + * + * The amd_cpudata is key private data for each CPU thread in AMD P-State, and +-- +2.53.0 + diff --git a/queue-7.0/riscv-cfi-reject-unknown-flags-in-pr_set_cfi.patch b/queue-7.0/riscv-cfi-reject-unknown-flags-in-pr_set_cfi.patch new file mode 100644 index 0000000000..d48a4383df --- /dev/null +++ b/queue-7.0/riscv-cfi-reject-unknown-flags-in-pr_set_cfi.patch @@ -0,0 +1,74 @@ +From eba7393f8efac2443eaabd88298704d8317f29f1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 May 2026 18:39:18 +0000 +Subject: riscv: cfi: reject unknown flags in PR_SET_CFI + +From: Richard Patel + +[ Upstream commit 15b4155138505669d3d43d7692459ee8ea2a86e7 ] + +prctl(PR_SET_CFI,PR_CFI_BRANCH_LANDING_PADS) silently ignored +unknown control values. Only PR_CFI_{ENABLE,DISABLE,LOCK} should +be permitted. + +This changes the behavior of the uABI (fails previously accepted bits +with EINVAL). + +Fixes: 08ee1559052b ("prctl: cfi: change the branch landing pad prctl()s to be more descriptive") +Signed-off-by: Richard Patel +Link: https://patch.msgid.link/20260518183918.322545-1-ripatel@wii.dev +[pjw@kernel.org: change the patch description to note that although this is a uABI change, it does not break the uABI] +Signed-off-by: Paul Walmsley +Signed-off-by: Sasha Levin +--- + arch/riscv/include/asm/usercfi.h | 1 + + arch/riscv/kernel/usercfi.c | 3 +++ + tools/testing/selftests/riscv/cfi/cfitests.c | 6 ++++++ + 3 files changed, 10 insertions(+) + +diff --git a/arch/riscv/include/asm/usercfi.h b/arch/riscv/include/asm/usercfi.h +index f56966edbf5c62..61ee02cee29720 100644 +--- a/arch/riscv/include/asm/usercfi.h ++++ b/arch/riscv/include/asm/usercfi.h +@@ -50,6 +50,7 @@ void set_indir_lp_status(struct task_struct *task, bool enable); + void set_indir_lp_lock(struct task_struct *task, bool lock); + + #define PR_SHADOW_STACK_SUPPORTED_STATUS_MASK (PR_SHADOW_STACK_ENABLE) ++#define PR_CFI_SUPPORTED_STATUS_MASK (PR_CFI_ENABLE | PR_CFI_DISABLE | PR_CFI_LOCK) + + #else + +diff --git a/arch/riscv/kernel/usercfi.c b/arch/riscv/kernel/usercfi.c +index 2c535737511dce..1ea86f21fbfa61 100644 +--- a/arch/riscv/kernel/usercfi.c ++++ b/arch/riscv/kernel/usercfi.c +@@ -476,6 +476,9 @@ int arch_prctl_set_branch_landing_pad_state(struct task_struct *t, unsigned long + if (!is_user_lpad_enabled()) + return -EINVAL; + ++ if (state & ~PR_CFI_SUPPORTED_STATUS_MASK) ++ return -EINVAL; ++ + /* indirect branch tracking is locked and further can't be modified by user */ + if (is_indir_lp_locked(t)) + return -EINVAL; +diff --git a/tools/testing/selftests/riscv/cfi/cfitests.c b/tools/testing/selftests/riscv/cfi/cfitests.c +index 39d097b6881ff2..0e3943461e7d83 100644 +--- a/tools/testing/selftests/riscv/cfi/cfitests.c ++++ b/tools/testing/selftests/riscv/cfi/cfitests.c +@@ -141,6 +141,12 @@ int main(int argc, char *argv[]) + + ksft_print_msg("Starting risc-v tests\n"); + ++ /* Test unknown PR_CFI bits */ ++ ret = my_syscall5(__NR_prctl, PR_SET_CFI, PR_CFI_BRANCH_LANDING_PADS, ++ PR_CFI_ENABLE | 0xffff0, 0, 0); ++ if (!ret) ++ ksft_exit_fail_msg("PR_SET_CFI accepted reserved branch landing pad bits\n"); ++ + /* + * Landing pad test. Not a lot of kernel changes to support landing + * pads for user mode except lighting up a bit in senvcfg via a prctl. +-- +2.53.0 + diff --git a/queue-7.0/riscv-ptrace-use-user_regset_note_type-for-regset_cf.patch b/queue-7.0/riscv-ptrace-use-user_regset_note_type-for-regset_cf.patch new file mode 100644 index 0000000000..94a605a7ab --- /dev/null +++ b/queue-7.0/riscv-ptrace-use-user_regset_note_type-for-regset_cf.patch @@ -0,0 +1,38 @@ +From 88abdafc78ca209312759f6d7de8fb3c9e629585 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 22 May 2026 00:34:30 +0200 +Subject: riscv/ptrace: Use USER_REGSET_NOTE_TYPE for REGSET_CFI + +From: Andreas Schwab + +[ Upstream commit e3573f739e3dadab57ec80488d07e05c8f6e82d3 ] + +Fixes a warning while dumping core: + +[54983.546369][ C7] WARNING: [!note_name] fs/binfmt_elf.c:1771 at elf_core_dump+0x910/0xf68, CPU#7: abort01/31982 + +Fixes: 2af7c9cf021c ("riscv/ptrace: expose riscv CFI status and state via ptrace and in core files") +Signed-off-by: Andreas Schwab +Link: https://patch.msgid.link/87y0hcxuh5.fsf@igel.home +Signed-off-by: Paul Walmsley +Signed-off-by: Sasha Levin +--- + arch/riscv/kernel/ptrace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c +index 793bcee4618282..f336a183667eb8 100644 +--- a/arch/riscv/kernel/ptrace.c ++++ b/arch/riscv/kernel/ptrace.c +@@ -413,7 +413,7 @@ static struct user_regset riscv_user_regset[] __ro_after_init = { + #endif + #ifdef CONFIG_RISCV_USER_CFI + [REGSET_CFI] = { +- .core_note_type = NT_RISCV_USER_CFI, ++ USER_REGSET_NOTE_TYPE(RISCV_USER_CFI), + .align = sizeof(__u64), + .n = sizeof(struct user_cfi_state) / sizeof(__u64), + .size = sizeof(__u64), +-- +2.53.0 + diff --git a/queue-7.0/rtla-fix-parsing-of-multi-character-short-options.patch b/queue-7.0/rtla-fix-parsing-of-multi-character-short-options.patch new file mode 100644 index 0000000000..cdaf7ca2cf --- /dev/null +++ b/queue-7.0/rtla-fix-parsing-of-multi-character-short-options.patch @@ -0,0 +1,262 @@ +From 1bcb45155dc6a7191f7d97df2e91a8b66fb9ec9c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jun 2026 14:55:06 +0200 +Subject: rtla: Fix parsing of multi-character short options + +From: Tomas Glozar + +[ Upstream commit e9e41d3035032ed6053d8bad7b7077e1cb3a6540 ] + +A bug was reported where the parsing of multi-character short options, +be it a short option with an argument specified without space (e.g. +"-p100") or multiple short options in one argument (e.g. -un), ignores +options specific to individual tools. + +Furthermore, if the rest of the option is supposed to be an argument, it +gets reinterpreted as a string of options. For example, -p100 gets +interpreted as -100, which is due to hackish implementation read as +--no-thread --no-irq --no-irq with timerlat hist, causing rtla to error +out: + +$ rtla timerlat hist -p100 +no-irq and no-thread set, there is nothing to do here + +This behavior is caused by getopt_long() being called twice on each +argument, once in common_parse_options(), once in [tool]_parse_args(): + +- common_parse_options() calls getopt_long() with an array of options + common for all rtla tools, while suppressing errors (opterr = 0). +- If the option fails to parse, common_parse_options() returns 0. +- If 0 is returned from common_parse_options(), [tool]_parse_args() + calls getopt_long() again, with its own set of options. + +* [tool] means one of {osnoise,timerlat}_{top,hist} + +At least in glibc, getopt_long() increments its internal nextchar +variable even if the option is not recognized. That means that in the +case of "-p100", common_parse_options() sets nextchar pointing to '1', +and timerlat_hist_parse_args() sees '1', not 'p'; the same then repeats +for the first and second '0'. + +As there is no way to restore the correct internal state of +getopt_long() reliably, fix the issue by merging the common options back +to the longopt array and option string of the [tool]_parse_args() +functions using a macro; only the switch part is left in the original +function, which is renamed to set_common_option(). + +Fixes: 850cd24cb6d6 ("tools/rtla: Add common_parse_options()") +Reported-by: John Kacur +Tested-by: John Kacur +Link: https://lore.kernel.org/r/20260602125506.3325345-1-tglozar@redhat.com +Signed-off-by: Tomas Glozar +Signed-off-by: Sasha Levin +--- + tools/tracing/rtla/src/common.c | 28 +++++--------------------- + tools/tracing/rtla/src/common.h | 12 ++++++++++- + tools/tracing/rtla/src/osnoise_hist.c | 7 ++++--- + tools/tracing/rtla/src/osnoise_top.c | 7 ++++--- + tools/tracing/rtla/src/timerlat_hist.c | 7 ++++--- + tools/tracing/rtla/src/timerlat_top.c | 7 ++++--- + 6 files changed, 32 insertions(+), 36 deletions(-) + +diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c +index 839c78c065e12f..01d5b8d5aeaf2e 100644 +--- a/tools/tracing/rtla/src/common.c ++++ b/tools/tracing/rtla/src/common.c +@@ -82,37 +82,20 @@ int getopt_auto(int argc, char **argv, const struct option *long_opts) + } + + /* +- * common_parse_options - parse common command line options ++ * set_common_option - set common options + * ++ * @c: option character + * @argc: argument count + * @argv: argument vector + * @common: common parameters structure + * + * Parse command line options that are common to all rtla tools. + * +- * Returns: non zero if a common option was parsed, or 0 +- * if the option should be handled by tool-specific parsing. ++ * Returns: 1 if the option was set, 0 otherwise. + */ +-int common_parse_options(int argc, char **argv, struct common_params *common) ++int set_common_option(int c, int argc, char **argv, struct common_params *common) + { + struct trace_events *tevent; +- int saved_state = optind; +- int c; +- +- static struct option long_options[] = { +- {"cpus", required_argument, 0, 'c'}, +- {"cgroup", optional_argument, 0, 'C'}, +- {"debug", no_argument, 0, 'D'}, +- {"duration", required_argument, 0, 'd'}, +- {"event", required_argument, 0, 'e'}, +- {"house-keeping", required_argument, 0, 'H'}, +- {"priority", required_argument, 0, 'P'}, +- {0, 0, 0, 0} +- }; +- +- opterr = 0; +- c = getopt_auto(argc, argv, long_options); +- opterr = 1; + + switch (c) { + case 'c': +@@ -152,11 +135,10 @@ int common_parse_options(int argc, char **argv, struct common_params *common) + common->set_sched = 1; + break; + default: +- optind = saved_state; + return 0; + } + +- return c; ++ return 1; + } + + /* +diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/common.h +index d4b3715700be73..e00e3930ddb0b5 100644 +--- a/tools/tracing/rtla/src/common.h ++++ b/tools/tracing/rtla/src/common.h +@@ -158,7 +158,17 @@ int osnoise_set_stop_total_us(struct osnoise_context *context, + long long stop_total_us); + + int getopt_auto(int argc, char **argv, const struct option *long_opts); +-int common_parse_options(int argc, char **argv, struct common_params *common); ++ ++#define COMMON_OPTIONS \ ++ {"cpus", required_argument, 0, 'c'},\ ++ {"cgroup", optional_argument, 0, 'C'},\ ++ {"debug", no_argument, 0, 'D'},\ ++ {"duration", required_argument, 0, 'd'},\ ++ {"event", required_argument, 0, 'e'},\ ++ {"house-keeping", required_argument, 0, 'H'},\ ++ {"priority", required_argument, 0, 'P'} ++int set_common_option(int c, int argc, char **argv, struct common_params *common); ++ + int common_apply_config(struct osnoise_tool *tool, struct common_params *params); + int top_main_loop(struct osnoise_tool *tool); + int hist_main_loop(struct osnoise_tool *tool); +diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c +index 5c863e7aad28b4..5dd1d4ba0b887d 100644 +--- a/tools/tracing/rtla/src/osnoise_hist.c ++++ b/tools/tracing/rtla/src/osnoise_hist.c +@@ -480,6 +480,7 @@ static struct common_params + + while (1) { + static struct option long_options[] = { ++ COMMON_OPTIONS, + {"auto", required_argument, 0, 'a'}, + {"bucket-size", required_argument, 0, 'b'}, + {"entries", required_argument, 0, 'E'}, +@@ -503,15 +504,15 @@ static struct common_params + {0, 0, 0, 0} + }; + +- if (common_parse_options(argc, argv, ¶ms->common)) +- continue; +- + c = getopt_auto(argc, argv, long_options); + + /* detect the end of the options. */ + if (c == -1) + break; + ++ if (set_common_option(c, argc, argv, ¶ms->common)) ++ continue; ++ + switch (c) { + case 'a': + /* set sample stop to auto_thresh */ +diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c +index b7aed40fd2164f..5c278c68b1a2c8 100644 +--- a/tools/tracing/rtla/src/osnoise_top.c ++++ b/tools/tracing/rtla/src/osnoise_top.c +@@ -337,6 +337,7 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv) + + while (1) { + static struct option long_options[] = { ++ COMMON_OPTIONS, + {"auto", required_argument, 0, 'a'}, + {"help", no_argument, 0, 'h'}, + {"period", required_argument, 0, 'p'}, +@@ -355,15 +356,15 @@ struct common_params *osnoise_top_parse_args(int argc, char **argv) + {0, 0, 0, 0} + }; + +- if (common_parse_options(argc, argv, ¶ms->common)) +- continue; +- + c = getopt_auto(argc, argv, long_options); + + /* Detect the end of the options. */ + if (c == -1) + break; + ++ if (set_common_option(c, argc, argv, ¶ms->common)) ++ continue; ++ + switch (c) { + case 'a': + /* set sample stop to auto_thresh */ +diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c +index 096de8ba3efbb6..5089b72c7a9439 100644 +--- a/tools/tracing/rtla/src/timerlat_hist.c ++++ b/tools/tracing/rtla/src/timerlat_hist.c +@@ -789,6 +789,7 @@ static struct common_params + + while (1) { + static struct option long_options[] = { ++ COMMON_OPTIONS, + {"auto", required_argument, 0, 'a'}, + {"bucket-size", required_argument, 0, 'b'}, + {"entries", required_argument, 0, 'E'}, +@@ -822,11 +823,11 @@ static struct common_params + {0, 0, 0, 0} + }; + +- if (common_parse_options(argc, argv, ¶ms->common)) +- continue; +- + c = getopt_auto(argc, argv, long_options); + ++ if (set_common_option(c, argc, argv, ¶ms->common)) ++ continue; ++ + /* detect the end of the options. */ + if (c == -1) + break; +diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c +index 27c14aa71a8bc8..1311afc981e24c 100644 +--- a/tools/tracing/rtla/src/timerlat_top.c ++++ b/tools/tracing/rtla/src/timerlat_top.c +@@ -558,6 +558,7 @@ static struct common_params + + while (1) { + static struct option long_options[] = { ++ COMMON_OPTIONS, + {"auto", required_argument, 0, 'a'}, + {"help", no_argument, 0, 'h'}, + {"irq", required_argument, 0, 'i'}, +@@ -585,11 +586,11 @@ static struct common_params + {0, 0, 0, 0} + }; + +- if (common_parse_options(argc, argv, ¶ms->common)) +- continue; +- + c = getopt_auto(argc, argv, long_options); + ++ if (set_common_option(c, argc, argv, ¶ms->common)) ++ continue; ++ + /* detect the end of the options. */ + if (c == -1) + break; +-- +2.53.0 + diff --git a/queue-7.0/series b/queue-7.0/series index db5241184d..ff43e9f3c8 100644 --- a/queue-7.0/series +++ b/queue-7.0/series @@ -84,3 +84,13 @@ time-fix-off-by-one-in-settimeofday-usec-validation.patch alsa-pcm-fix-wait-queue-list-corruption-in-snd_pcm_d.patch alsa-seq-dummy-fix-ump-event-stack-overread.patch x86-resctrl-only-check-intel-systems-for-snc.patch +cpufreq-amd-pstate-drop-stale-epp_cached-kdoc.patch +rtla-fix-parsing-of-multi-character-short-options.patch +tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch +tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch +tools-rv-fix-substring-match-when-listing-container-.patch +tools-rv-fix-cleanup-after-failed-trace-setup.patch +verification-rvgen-fix-options-shared-among-commands.patch +verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch +riscv-ptrace-use-user_regset_note_type-for-regset_cf.patch +riscv-cfi-reject-unknown-flags-in-pr_set_cfi.patch diff --git a/queue-7.0/tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch b/queue-7.0/tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch new file mode 100644 index 0000000000..11fca73f11 --- /dev/null +++ b/queue-7.0/tools-rv-ensure-monitor-name-and-desc-are-nul-termin.patch @@ -0,0 +1,47 @@ +From 2d1c6f204b44c972b1a6442ef90afe632f63d6c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Jun 2026 14:09:45 +0200 +Subject: tools/rv: Ensure monitor name and desc are NUL-terminated + +From: Gabriele Monaco + +[ Upstream commit 08904765bb941f98306ae6841c33cfd299343faf ] + +ikm_fill_monitor_definition() copies monitor name and description with +strncpy(), but does not guarantee NUL termination when source strings are +equal to or longer than the destination buffers. + +Clamp copies to sizeof(dst) - 1 and explicitly append '\0' for both fields +to keep them safe for later string operations. + +Suggested-by: unknownbbqrx +Fixes: 6d60f89691fc9 ("tools/rv: Add in-kernel monitor interface") +Link: https://lore.kernel.org/r/20260604120946.90302-2-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index 4bb746ea6e1735..d324538249d3ab 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -215,10 +215,11 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *co + return -1; + } + +- strncpy(ikm->name, nested_name, MAX_DA_NAME_LEN); ++ strncpy(ikm->name, nested_name, sizeof(ikm->name) - 1); ++ ikm->name[sizeof(ikm->name) - 1] = '\0'; + ikm->enabled = enabled; +- strncpy(ikm->desc, desc, MAX_DESCRIPTION); +- ++ strncpy(ikm->desc, desc, sizeof(ikm->desc) - 1); ++ ikm->desc[sizeof(ikm->desc) - 1] = '\0'; + free(desc); + + return 0; +-- +2.53.0 + diff --git a/queue-7.0/tools-rv-fix-cleanup-after-failed-trace-setup.patch b/queue-7.0/tools-rv-fix-cleanup-after-failed-trace-setup.patch new file mode 100644 index 0000000000..8f343ec5a1 --- /dev/null +++ b/queue-7.0/tools-rv-fix-cleanup-after-failed-trace-setup.patch @@ -0,0 +1,40 @@ +From 438b00c11cf6da79fbede6ae611d514eef7d9621 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:45 +0200 +Subject: tools/rv: Fix cleanup after failed trace setup + +From: Gabriele Monaco + +[ Upstream commit 33ec2269a4155cad7e9e42c92327dcaa9aee59a7 ] + +Currently if ikm_setup_trace_instance() fails, the tool returns without +any cleanup, if rv was called with both -t and -r, this means the +reactor is not going to be cleared. + +Jump to the cleanup label to restore the reactor if necessary. + +Fixes: 6d60f89691fc9 ("tools/rv: Add in-kernel monitor interface") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-5-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index e4f35940374f5a..e6dea4040f8f4c 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -810,7 +810,7 @@ int ikm_run_monitor(char *monitor_name, int argc, char **argv) + if (config_trace) { + inst = ikm_setup_trace_instance(nested_name); + if (!inst) +- return -1; ++ goto out_free_instance; + } + + retval = ikm_enable(full_name); +-- +2.53.0 + diff --git a/queue-7.0/tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch b/queue-7.0/tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch new file mode 100644 index 0000000000..813f6e1d3c --- /dev/null +++ b/queue-7.0/tools-rv-fix-substring-match-bug-in-monitor-name-sea.patch @@ -0,0 +1,96 @@ +From fc0a136efe900dd8a7ace583630d36c24019534d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:42 +0200 +Subject: tools/rv: Fix substring match bug in monitor name search + +From: Gabriele Monaco + +[ Upstream commit a963fbf3166f2e178ac38b6c3c186a0c98092fb9 ] + +__ikm_find_monitor_name() relies on strstr() to find a monitor by name, +which fails if the target monitor is a substring of a previously listed +monitor. + +Fix it by tokenizing the available_monitors file and matching full +tokens instead. + +Fixes: eba321a16fc6 ("tools/rv: Add support for nested monitors") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-2-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 48 ++++++++++++++------------- + 1 file changed, 25 insertions(+), 23 deletions(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index d324538249d3ab..95eac9ab148468 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -58,38 +58,40 @@ static int __ikm_read_enable(char *monitor_name) + */ + static int __ikm_find_monitor_name(char *monitor_name, char *out_name) + { +- char *available_monitors, container[MAX_DA_NAME_LEN+1], *cursor, *end; +- int retval = 1; ++ char *available_monitors, *cursor, *line; ++ int len = strlen(monitor_name); ++ int found = 0; + + available_monitors = tracefs_instance_file_read(NULL, "rv/available_monitors", NULL); + if (!available_monitors) + return -1; + +- cursor = strstr(available_monitors, monitor_name); +- if (!cursor) { +- retval = 0; +- goto out_free; +- } ++ config_is_container = 0; ++ cursor = available_monitors; ++ while ((line = strsep(&cursor, "\n"))) { ++ char *colon = strchr(line, ':'); + +- for (; cursor > available_monitors; cursor--) +- if (*(cursor-1) == '\n') +- break; +- end = strstr(cursor, "\n"); +- memcpy(out_name, cursor, end-cursor); +- out_name[end-cursor] = '\0'; +- +- cursor = strstr(out_name, ":"); +- if (cursor) +- *cursor = '/'; +- else { +- sprintf(container, "%s:", monitor_name); +- if (strstr(available_monitors, container)) +- config_is_container = 1; ++ if (strcmp(line, monitor_name) && (!colon || strcmp(colon + 1, monitor_name))) ++ continue; ++ ++ strncpy(out_name, line, 2 * MAX_DA_NAME_LEN); ++ out_name[2 * MAX_DA_NAME_LEN - 1] = '\0'; ++ ++ if (colon) { ++ out_name[colon - line] = '/'; ++ } else { ++ /* If there are children, they are on the next line. */ ++ line = strsep(&cursor, "\n"); ++ if (line && !strncmp(line, monitor_name, len) && line[len] == ':') ++ config_is_container = 1; ++ } ++ ++ found = 1; ++ break; + } + +-out_free: + free(available_monitors); +- return retval; ++ return found; + } + + /* +-- +2.53.0 + diff --git a/queue-7.0/tools-rv-fix-substring-match-when-listing-container-.patch b/queue-7.0/tools-rv-fix-substring-match-when-listing-container-.patch new file mode 100644 index 0000000000..daa17eb0af --- /dev/null +++ b/queue-7.0/tools-rv-fix-substring-match-when-listing-container-.patch @@ -0,0 +1,48 @@ +From 0bdeb88044c71809ddfaf1ea1e8f640c5d5f336f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:43 +0200 +Subject: tools/rv: Fix substring match when listing container monitors + +From: Gabriele Monaco + +[ Upstream commit ba0247c5aa3fcb2890a92a97a88c70fe5ce704a6 ] + +When listing monitors within a specific container (rv list ), +the tool incorrectly matched monitors if the requested container name +was only a prefix of the actual container (e.g., 'rv list sche' would +incorrectly list monitors from 'sched:'). + +Fix this by ensuring the container name is an exact match and is +immediately followed by the ':' separator. + +Fixes: eba321a16fc6 ("tools/rv: Add support for nested monitors") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-3-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rv/src/in_kernel.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c +index 95eac9ab148468..e4f35940374f5a 100644 +--- a/tools/verification/rv/src/in_kernel.c ++++ b/tools/verification/rv/src/in_kernel.c +@@ -193,8 +193,12 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *co + nested_name = strstr(name, ":"); + if (nested_name) { + /* it belongs in container if it starts with "container:" */ +- if (container && strstr(name, container) != name) +- return 1; ++ if (container) { ++ int len = strlen(container); ++ ++ if (strncmp(name, container, len) || name[len] != ':') ++ return 1; ++ } + *nested_name = '/'; + ++nested_name; + ikm->nested = 1; +-- +2.53.0 + diff --git a/queue-7.0/verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch b/queue-7.0/verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch new file mode 100644 index 0000000000..c0666ea4cc --- /dev/null +++ b/queue-7.0/verification-rvgen-fix-ltl2k-writing-true-as-a-liter.patch @@ -0,0 +1,56 @@ +From 4f4af13a12c2ae47cfb6cd2d6316ae68a71616dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:48 +0200 +Subject: verification/rvgen: Fix ltl2k writing True as a literal + +From: Gabriele Monaco + +[ Upstream commit df996599cc69a9b74ff437c67751cf8a61f62e39 ] + +The rvgen parser for LTL stores literal true values in the python +representation (capitalised True), this doesn't build in C. +The Literal class should already handle this case but ASTNode skips its +strigification method and converts the value (true/false) directly. + +Fix by delegating ASTNode stringification to the Literal and Variable +classes instead of bypassing them. + +Fixes: 97ffa4ce6ab32 ("verification/rvgen: Add support for linear temporal logic") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-8-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rvgen/rvgen/ltl2ba.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/tools/verification/rvgen/rvgen/ltl2ba.py b/tools/verification/rvgen/rvgen/ltl2ba.py +index f14e6760ac3db8..aada15ec83a3c2 100644 +--- a/tools/verification/rvgen/rvgen/ltl2ba.py ++++ b/tools/verification/rvgen/rvgen/ltl2ba.py +@@ -121,10 +121,8 @@ class ASTNode: + return self.op.expand(self, node, node_set) + + def __str__(self): +- if isinstance(self.op, Literal): +- return str(self.op.value) +- if isinstance(self.op, Variable): +- return self.op.name.lower() ++ if isinstance(self.op, (Literal, Variable)): ++ return str(self.op) + return "val" + str(self.id) + + def normalize(self): +@@ -381,6 +379,9 @@ class Variable: + def __iter__(self): + yield from () + ++ def __str__(self): ++ return self.name.lower() ++ + def negate(self): + new = ASTNode(self) + return NotOp(new) +-- +2.53.0 + diff --git a/queue-7.0/verification-rvgen-fix-options-shared-among-commands.patch b/queue-7.0/verification-rvgen-fix-options-shared-among-commands.patch new file mode 100644 index 0000000000..eed187417d --- /dev/null +++ b/queue-7.0/verification-rvgen-fix-options-shared-among-commands.patch @@ -0,0 +1,66 @@ +From 6fc5bd9743f3e8db8e225c3d26c75334e5df63cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 May 2026 17:20:47 +0200 +Subject: verification/rvgen: Fix options shared among commands + +From: Gabriele Monaco + +[ Upstream commit 5f845ad706c0b394ae274e9a930044f78bef782e ] + +After rvgen was refactored to use subparsers, the common options (-a and +-D) were left in the main parser. This meant that they needed to be +called /before/ the subcommand and using them without subcommand was +allowed. This is not the original intent. + + rvgen -D "some description" container -n name + +Define the options as parent in the subparsers to allow them to be used +from both subcommands together with other options. + + rvgen container -n name -D "some description" + +Fixes: 5270a0e3041c ("verification/dot2k: Replace is_container() hack with subparsers") +Reviewed-by: Nam Cao +Link: https://lore.kernel.org/r/20260514152055.229162-7-gmonaco@redhat.com +Signed-off-by: Gabriele Monaco +Signed-off-by: Sasha Levin +--- + tools/verification/rvgen/__main__.py | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/tools/verification/rvgen/__main__.py b/tools/verification/rvgen/__main__.py +index fa6fc1f4de2f7e..5198bccccd107b 100644 +--- a/tools/verification/rvgen/__main__.py ++++ b/tools/verification/rvgen/__main__.py +@@ -17,14 +17,16 @@ if __name__ == '__main__': + import sys + + parser = argparse.ArgumentParser(description='Generate kernel rv monitor') +- parser.add_argument("-D", "--description", dest="description", required=False) +- parser.add_argument("-a", "--auto_patch", dest="auto_patch", ++ ++ parent_parser = argparse.ArgumentParser(add_help=False) ++ parent_parser.add_argument("-D", "--description", dest="description", required=False) ++ parent_parser.add_argument("-a", "--auto_patch", dest="auto_patch", + action="store_true", required=False, + help="Patch the kernel in place") + + subparsers = parser.add_subparsers(dest="subcmd", required=True) + +- monitor_parser = subparsers.add_parser("monitor") ++ monitor_parser = subparsers.add_parser("monitor", parents=[parent_parser]) + monitor_parser.add_argument('-n', "--model_name", dest="model_name") + monitor_parser.add_argument("-p", "--parent", dest="parent", + required=False, help="Create a monitor nested to parent") +@@ -34,7 +36,7 @@ if __name__ == '__main__': + monitor_parser.add_argument('-t', "--monitor_type", dest="monitor_type", + help=f"Available options: {', '.join(Monitor.monitor_types.keys())}") + +- container_parser = subparsers.add_parser("container") ++ container_parser = subparsers.add_parser("container", parents=[parent_parser]) + container_parser.add_argument('-n', "--model_name", dest="model_name", required=True) + + params = parser.parse_args() +-- +2.53.0 +