]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Mar 2020 08:55:49 +0000 (10:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Mar 2020 08:55:49 +0000 (10:55 +0200)
added patches:
arm64-compat-map-spsr_elx-psr-for-signals.patch
arm64-ptrace-map-spsr_elx-psr-for-compat-tasks.patch
ftrace-x86-anotate-text_mutex-split-between-ftrace_arch_code_modify_post_process-and-ftrace_arch_code_modify_prepare.patch

queue-4.14/arm64-compat-map-spsr_elx-psr-for-signals.patch [new file with mode: 0644]
queue-4.14/arm64-ptrace-map-spsr_elx-psr-for-compat-tasks.patch [new file with mode: 0644]
queue-4.14/ftrace-x86-anotate-text_mutex-split-between-ftrace_arch_code_modify_post_process-and-ftrace_arch_code_modify_prepare.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/arm64-compat-map-spsr_elx-psr-for-signals.patch b/queue-4.14/arm64-compat-map-spsr_elx-psr-for-signals.patch
new file mode 100644 (file)
index 0000000..7ad35fc
--- /dev/null
@@ -0,0 +1,64 @@
+From 25dc2c80cfa33153057aa94984855acd57adf92a Mon Sep 17 00:00:00 2001
+From: Mark Rutland <mark.rutland@arm.com>
+Date: Thu, 5 Jul 2018 15:16:50 +0100
+Subject: arm64: compat: map SPSR_ELx<->PSR for signals
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+commit 25dc2c80cfa33153057aa94984855acd57adf92a upstream.
+
+The SPSR_ELx format for exceptions taken from AArch32 differs from the
+AArch32 PSR format. Thus, we must translate between the two when setting
+up a compat sigframe, or restoring context from a compat sigframe.
+
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Fixes: 7206dc93a58fb764 ("arm64: Expose Arm v8.4 features")
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Suzuki Poulose <suzuki.poulose@arm.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/signal32.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/arch/arm64/kernel/signal32.c
++++ b/arch/arm64/kernel/signal32.c
+@@ -321,6 +321,7 @@ static int compat_restore_sigframe(struc
+       int err;
+       sigset_t set;
+       struct compat_aux_sigframe __user *aux;
++      unsigned long psr;
+       err = get_sigset_t(&set, &sf->uc.uc_sigmask);
+       if (err == 0) {
+@@ -344,7 +345,9 @@ static int compat_restore_sigframe(struc
+       __get_user_error(regs->compat_sp, &sf->uc.uc_mcontext.arm_sp, err);
+       __get_user_error(regs->compat_lr, &sf->uc.uc_mcontext.arm_lr, err);
+       __get_user_error(regs->pc, &sf->uc.uc_mcontext.arm_pc, err);
+-      __get_user_error(regs->pstate, &sf->uc.uc_mcontext.arm_cpsr, err);
++      __get_user_error(psr, &sf->uc.uc_mcontext.arm_cpsr, err);
++
++      regs->pstate = compat_psr_to_pstate(psr);
+       /*
+        * Avoid compat_sys_sigreturn() restarting.
+@@ -500,6 +503,7 @@ static int compat_setup_sigframe(struct
+                                struct pt_regs *regs, sigset_t *set)
+ {
+       struct compat_aux_sigframe __user *aux;
++      unsigned long psr = pstate_to_compat_psr(regs->pstate);
+       int err = 0;
+       __put_user_error(regs->regs[0], &sf->uc.uc_mcontext.arm_r0, err);
+@@ -518,7 +522,7 @@ static int compat_setup_sigframe(struct
+       __put_user_error(regs->compat_sp, &sf->uc.uc_mcontext.arm_sp, err);
+       __put_user_error(regs->compat_lr, &sf->uc.uc_mcontext.arm_lr, err);
+       __put_user_error(regs->pc, &sf->uc.uc_mcontext.arm_pc, err);
+-      __put_user_error(regs->pstate, &sf->uc.uc_mcontext.arm_cpsr, err);
++      __put_user_error(psr, &sf->uc.uc_mcontext.arm_cpsr, err);
+       __put_user_error((compat_ulong_t)0, &sf->uc.uc_mcontext.trap_no, err);
+       /* set the compat FSR WnR */
diff --git a/queue-4.14/arm64-ptrace-map-spsr_elx-psr-for-compat-tasks.patch b/queue-4.14/arm64-ptrace-map-spsr_elx-psr-for-compat-tasks.patch
new file mode 100644 (file)
index 0000000..aa20f56
--- /dev/null
@@ -0,0 +1,45 @@
+From 76fc52bd07d3e9cb708f1a50b60c825c96acd606 Mon Sep 17 00:00:00 2001
+From: Mark Rutland <mark.rutland@arm.com>
+Date: Thu, 5 Jul 2018 15:16:51 +0100
+Subject: arm64: ptrace: map SPSR_ELx<->PSR for compat tasks
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+commit 76fc52bd07d3e9cb708f1a50b60c825c96acd606 upstream.
+
+The SPSR_ELx format for exceptions taken from AArch32 is slightly
+different to the AArch32 PSR format.
+
+Map between the two in the compat ptrace code.
+
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Fixes: 7206dc93a58fb764 ("arm64: Expose Arm v8.4 features")
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Suzuki Poulose <suzuki.poulose@arm.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/ptrace.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/arm64/kernel/ptrace.c
++++ b/arch/arm64/kernel/ptrace.c
+@@ -833,6 +833,7 @@ static int compat_gpr_get(struct task_st
+                       break;
+               case 16:
+                       reg = task_pt_regs(target)->pstate;
++                      reg = pstate_to_compat_psr(reg);
+                       break;
+               case 17:
+                       reg = task_pt_regs(target)->orig_x0;
+@@ -900,6 +901,7 @@ static int compat_gpr_set(struct task_st
+                       newregs.pc = reg;
+                       break;
+               case 16:
++                      reg = compat_psr_to_pstate(reg);
+                       newregs.pstate = reg;
+                       break;
+               case 17:
diff --git a/queue-4.14/ftrace-x86-anotate-text_mutex-split-between-ftrace_arch_code_modify_post_process-and-ftrace_arch_code_modify_prepare.patch b/queue-4.14/ftrace-x86-anotate-text_mutex-split-between-ftrace_arch_code_modify_post_process-and-ftrace_arch_code_modify_prepare.patch
new file mode 100644 (file)
index 0000000..482821d
--- /dev/null
@@ -0,0 +1,46 @@
+From 074376ac0e1d1fcd4fafebca86ee6158e7c20680 Mon Sep 17 00:00:00 2001
+From: Jiri Kosina <jkosina@suse.cz>
+Date: Sat, 29 Jun 2019 23:22:33 +0200
+Subject: ftrace/x86: Anotate text_mutex split between ftrace_arch_code_modify_post_process() and ftrace_arch_code_modify_prepare()
+
+From: Jiri Kosina <jkosina@suse.cz>
+
+commit 074376ac0e1d1fcd4fafebca86ee6158e7c20680 upstream.
+
+ftrace_arch_code_modify_prepare() is acquiring text_mutex, while the
+corresponding release is happening in ftrace_arch_code_modify_post_process().
+
+This has already been documented in the code, but let's also make the fact
+that this is intentional clear to the semantic analysis tools such as sparse.
+
+Link: http://lkml.kernel.org/r/nycvar.YFH.7.76.1906292321170.27227@cbobk.fhfr.pm
+
+Fixes: 39611265edc1a ("ftrace/x86: Add a comment to why we take text_mutex in ftrace_arch_code_modify_prepare()")
+Fixes: d5b844a2cf507 ("ftrace/x86: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()")
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/ftrace.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/x86/kernel/ftrace.c
++++ b/arch/x86/kernel/ftrace.c
+@@ -36,6 +36,7 @@
+ #ifdef CONFIG_DYNAMIC_FTRACE
+ int ftrace_arch_code_modify_prepare(void)
++    __acquires(&text_mutex)
+ {
+       mutex_lock(&text_mutex);
+       set_kernel_text_rw();
+@@ -44,6 +45,7 @@ int ftrace_arch_code_modify_prepare(void
+ }
+ int ftrace_arch_code_modify_post_process(void)
++    __releases(&text_mutex)
+ {
+       set_all_modules_text_ro();
+       set_kernel_text_ro();
index 0736bb950499325cd2ece3fc87621eb8a7e8ac85..5968dd17fd2e84d630deaf4ea8149f156931d8e0 100644 (file)
@@ -83,3 +83,6 @@ scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch
 mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch
 dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch
 sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch
+arm64-ptrace-map-spsr_elx-psr-for-compat-tasks.patch
+arm64-compat-map-spsr_elx-psr-for-signals.patch
+ftrace-x86-anotate-text_mutex-split-between-ftrace_arch_code_modify_post_process-and-ftrace_arch_code_modify_prepare.patch