From: Greg Kroah-Hartman Date: Thu, 25 Apr 2019 07:50:40 +0000 (+0200) Subject: 3.18-stable patches X-Git-Tag: v3.18.139~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6686a26ab3ce4262d9df1fe8755b5e5a02572fc;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: arm64-futex-restore-oldval-initialization-to-work-around-buggy-compilers.patch --- diff --git a/queue-3.18/arm64-futex-restore-oldval-initialization-to-work-around-buggy-compilers.patch b/queue-3.18/arm64-futex-restore-oldval-initialization-to-work-around-buggy-compilers.patch new file mode 100644 index 00000000000..3169d404774 --- /dev/null +++ b/queue-3.18/arm64-futex-restore-oldval-initialization-to-work-around-buggy-compilers.patch @@ -0,0 +1,52 @@ +From 334d683655a0a4a68792ab1de6b20f4b559b0fcd Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Wed, 17 Apr 2019 00:21:21 -0700 +Subject: arm64: futex: Restore oldval initialization to work around buggy compilers + +From: Nathan Chancellor + +commit ff8acf929014b7f87315588e0daf8597c8aa9d1c upstream. + +Commit 045afc24124d ("arm64: futex: Fix FUTEX_WAKE_OP atomic ops with +non-zero result value") removed oldval's zero initialization in +arch_futex_atomic_op_inuser because it is not necessary. Unfortunately, +Android's arm64 GCC 4.9.4 [1] does not agree: + +../kernel/futex.c: In function 'do_futex': +../kernel/futex.c:1658:17: warning: 'oldval' may be used uninitialized +in this function [-Wmaybe-uninitialized] + return oldval == cmparg; + ^ +In file included from ../kernel/futex.c:73:0: +../arch/arm64/include/asm/futex.h:53:6: note: 'oldval' was declared here + int oldval, ret, tmp; + ^ + +GCC fails to follow that when ret is non-zero, futex_atomic_op_inuser +returns right away, avoiding the uninitialized use that it claims. +Restoring the zero initialization works around this issue. + +[1]: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/ + +Cc: stable@vger.kernel.org +Fixes: 045afc24124d ("arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Nathan Chancellor +Signed-off-by: Catalin Marinas +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/include/asm/futex.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/include/asm/futex.h ++++ b/arch/arm64/include/asm/futex.h +@@ -50,7 +50,7 @@ futex_atomic_op_inuser(unsigned int enco + int cmp = (encoded_op >> 24) & 15; + int oparg = (int)(encoded_op << 8) >> 20; + int cmparg = (int)(encoded_op << 20) >> 20; +- int oldval, ret, tmp; ++ int oldval = 0, ret, tmp; + + if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) + oparg = 1U << (oparg & 0x1f); diff --git a/queue-3.18/series b/queue-3.18/series index 0a844395440..898cd22a1a6 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -102,3 +102,4 @@ x86-kprobes-verify-stack-frame-on-kretprobe.patch kprobes-fix-error-check-when-reusing-optimized-probes.patch sched-fair-limit-sched_cfs_period_timer-loop-to-avoi.patch device_cgroup-fix-rcu-imbalance-in-error-case.patch +arm64-futex-restore-oldval-initialization-to-work-around-buggy-compilers.patch