All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	stable@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: futex: Restore oldval initialization to work around buggy compilers
Date: Wed, 17 Apr 2019 11:01:02 +0200	[thread overview]
Message-ID: <20190417090102.GA11773@kroah.com> (raw)
In-Reply-To: <20190417072121.4450-1-natechancellor@gmail.com>

On Wed, Apr 17, 2019 at 12:21:21AM -0700, Nathan Chancellor wrote:
> 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")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] arm64: futex: Restore oldval initialization to work around buggy compilers
Date: Wed, 17 Apr 2019 11:01:02 +0200	[thread overview]
Message-ID: <20190417090102.GA11773@kroah.com> (raw)
In-Reply-To: <20190417072121.4450-1-natechancellor@gmail.com>

On Wed, Apr 17, 2019 at 12:21:21AM -0700, Nathan Chancellor wrote:
> 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")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

  reply	other threads:[~2019-04-17  9:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  7:21 [PATCH] arm64: futex: Restore oldval initialization to work around buggy compilers Nathan Chancellor
2019-04-17  7:21 ` Nathan Chancellor
2019-04-17  9:01 ` Greg Kroah-Hartman [this message]
2019-04-17  9:01   ` Greg Kroah-Hartman
2019-04-17  9:53 ` Catalin Marinas
2019-04-17  9:53   ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190417090102.GA11773@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.