All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: linux-next: build warning after merge of the tip tree
Date: Mon, 13 Apr 2020 10:01:12 +1000	[thread overview]
Message-ID: <20200413100112.2e114e24@canb.auug.org.au> (raw)
In-Reply-To: <874ku2q18k.fsf@nanos.tec.linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 3663 bytes --]

Hi Thomas,

On Thu, 02 Apr 2020 00:39:55 +0200 Thomas Gleixner <tglx@linutronix.de> wrote:
>
> Stephen Rothwell <sfr@canb.auug.org.au> writes:
> > On Wed, 01 Apr 2020 12:25:25 +0200 Thomas Gleixner <tglx@linutronix.de> wrote:  
> >> Me neither. Which compiler version?  
> >
> > arm-linux-gnueabi-gcc (Debian 9.2.1-21) 9.2.1 20191130
> >  
> >> I'm using arm-linux-gnueabi-gcc (Debian 8.3.0-2) 8.3.0 which does not
> >> show that oddity.  
> >
> > I assume it is because of the change to arch_futex_atomic_op_inuser()
> > for arm and the compiler is not clever enough to work out that the early
> > return from arch_futex_atomic_op_inuser() means that oldval is not
> > referenced in its caller.  
> 
> Actually no. It's the ASM part which causes this. With the following
> hack applied it compiles:
> 
> diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
> index e133da303a98..2c6b40f71009 100644
> --- a/arch/arm/include/asm/futex.h
> +++ b/arch/arm/include/asm/futex.h
> @@ -132,7 +132,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
>  static inline int
>  arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
>  {
> -	int oldval = 0, ret, tmp;
> +	int oldval = 0, ret;
>  
>  	if (!access_ok(uaddr, sizeof(u32)))
>  		return -EFAULT;
> @@ -142,6 +142,7 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
>  #endif
>  
>  	switch (op) {
> +#if 0
>  	case FUTEX_OP_SET:
>  		__futex_atomic_op("mov	%0, %4", ret, oldval, tmp, uaddr, oparg);
>  		break;
> @@ -157,6 +158,7 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
>  	case FUTEX_OP_XOR:
>  		__futex_atomic_op("eor	%0, %1, %4", ret, oldval, tmp, uaddr, oparg);
>  		break;
> +#endif
>  	default:
>  		ret = -ENOSYS;
>  	}
> 
> but with this is emits the warning:
> 
> diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
> index e133da303a98..5191d7b61b83 100644
> --- a/arch/arm/include/asm/futex.h
> +++ b/arch/arm/include/asm/futex.h
> @@ -145,6 +145,7 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
>  	case FUTEX_OP_SET:
>  		__futex_atomic_op("mov	%0, %4", ret, oldval, tmp, uaddr, oparg);
>  		break;
> +#if 0
>  	case FUTEX_OP_ADD:
>  		__futex_atomic_op("add	%0, %1, %4", ret, oldval, tmp, uaddr, oparg);
>  		break;
> @@ -157,6 +158,7 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
>  	case FUTEX_OP_XOR:
>  		__futex_atomic_op("eor	%0, %1, %4", ret, oldval, tmp, uaddr, oparg);
>  		break;
> +#endif
>  	default:
>  		ret = -ENOSYS;
>  	}
> 
> and the below proves it:
> 
> diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
> index e133da303a98..a9151884bc85 100644
> --- a/arch/arm/include/asm/futex.h
> +++ b/arch/arm/include/asm/futex.h
> @@ -165,8 +165,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
>  	preempt_enable();
>  #endif
>  
> -	if (!ret)
> -		*oval = oldval;
> +	/*
> +	 * Store unconditionally. If ret != 0 the extra store is the least
> +	 * of the worries but GCC cannot figure out that __futex_atomic_op()
> +	 * is either setting ret to -EFAULT or storing the old value in
> +	 * oldval which results in a uninitialized warning at the call site.
> +	 */
> +	*oval = oldval;
>  
>  	return ret;
>  }
> 
> I think that's the right thing to do anyway. The conditional is pointless.

Thanks for the analysis.

I am still getting this warning, now from Linus' tree builds.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-04-13  0:01 UTC|newest]

Thread overview: 173+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  2:47 linux-next: build warning after merge of the tip tree Stephen Rothwell
2020-03-31 21:57 ` Stephen Rothwell
2020-04-01 10:25   ` Thomas Gleixner
2020-04-01 22:00     ` Stephen Rothwell
2020-04-01 22:39       ` Thomas Gleixner
2020-04-13  0:01         ` Stephen Rothwell [this message]
2020-04-14  8:42           ` Thomas Gleixner
2020-04-14  9:07           ` ARM: futex: Address build warning Thomas Gleixner
2020-05-06 22:19             ` Stephen Rothwell
2020-05-06 22:19               ` Stephen Rothwell
2020-05-06 22:45             ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2024-02-01  0:14 linux-next: build warning after merge of the tip tree Stephen Rothwell
2024-02-01  5:25 ` Xin Li
2024-02-01  8:59 ` Xin Li
2024-02-01 14:15   ` Borislav Petkov
2023-01-13  1:53 Stephen Rothwell
2022-10-24  0:28 Stephen Rothwell
2022-10-24  8:59 ` Peter Zijlstra
2021-10-28 12:26 Stephen Rothwell
2021-10-28 12:58 ` Borislav Petkov
2021-10-28 15:24   ` Bae, Chang Seok
2021-09-29  5:00 Stephen Rothwell
2021-09-29  7:43 ` Peter Zijlstra
2021-09-21  3:50 Stephen Rothwell
2021-09-20  1:33 Stephen Rothwell
2021-09-20  6:55 ` Yafang Shao
2021-09-20  8:30   ` Stephen Rothwell
2021-09-20  8:57     ` Stephen Rothwell
2021-09-20 11:18 ` Peter Zijlstra
2021-10-06  3:06   ` Stephen Rothwell
2021-10-06  6:59     ` Peter Zijlstra
2021-09-17  1:58 Stephen Rothwell
2021-09-17  8:23 ` Peter Zijlstra
2021-09-17 15:58   ` Paul E. McKenney
2021-11-23  5:21   ` Stephen Rothwell
2021-09-20  1:38 ` Stephen Rothwell
2021-10-21  3:03   ` Stephen Rothwell
2021-10-21  8:57     ` Peter Zijlstra
2021-10-21  8:58       ` Juergen Gross
2021-08-13  7:48 Stephen Rothwell
2021-08-13  7:08 Stephen Rothwell
2020-12-14  5:48 Stephen Rothwell
2020-12-14  7:32 ` Ard Biesheuvel
2020-11-05  7:06 Stephen Rothwell
2020-11-06  4:35 ` Stephen Rothwell
2020-10-28  3:23 Stephen Rothwell
2020-11-15 22:17 ` Stephen Rothwell
2020-11-15 22:23 ` Balbir Singh
2020-11-17  5:21   ` Balbir Singh
2020-11-23  7:23     ` Stephen Rothwell
2020-10-08  4:28 Stephen Rothwell
2020-10-08  9:02 ` Borislav Petkov
2020-09-25  9:36 Stephen Rothwell
2020-09-14  3:22 Stephen Rothwell
2020-09-14 20:11 ` Kees Cook
2020-09-14 22:35   ` Stephen Rothwell
2020-10-01 11:02     ` Stephen Rothwell
2020-10-02 22:46       ` Kees Cook
2020-10-03 21:54 ` Kees Cook
2020-10-03 23:24   ` Stephen Rothwell
2020-10-04  7:42     ` Kees Cook
2020-10-04  8:27     ` Kees Cook
2020-10-04 10:00       ` Stephen Rothwell
2020-10-05  2:44         ` Kees Cook
2020-10-14 22:25           ` Stephen Rothwell
2020-10-14 23:10             ` Kees Cook
2020-10-15  0:19               ` Stephen Rothwell
2020-05-21 11:56 Stephen Rothwell
2020-05-19  6:57 Stephen Rothwell
2020-05-19  7:12 ` Steve French
2020-04-28  6:29 Stephen Rothwell
2020-01-20  5:38 Stephen Rothwell
2020-01-20  6:00 ` Viresh Kumar
2020-01-07  5:43 Stephen Rothwell
2020-01-07  7:16 ` Ingo Molnar
2020-01-07  7:22   ` Shile Zhang
2019-07-26  3:05 Stephen Rothwell
2019-07-26  4:49 ` Josh Poimboeuf
2019-07-26  5:49   ` Stephen Rothwell
2018-11-06  0:46 Stephen Rothwell
2018-12-19  0:55 ` Stephen Rothwell
2018-09-11  3:53 Stephen Rothwell
2018-09-12 19:35 ` Thomas Gleixner
2018-03-23  2:28 Stephen Rothwell
2018-03-23  8:31 ` Christoph Hellwig
2018-03-23  9:57   ` Stephen Rothwell
2018-03-16  5:37 Stephen Rothwell
2018-03-16  5:52 ` Dou Liyang
2018-03-16  6:04   ` Dou Liyang
2018-03-16  7:55 ` Thomas Gleixner
2018-01-10  4:41 Stephen Rothwell
2017-09-27  3:42 Stephen Rothwell
2017-09-27 11:50 ` Prarit Bhargava
2017-06-28  7:15 Stephen Rothwell
2017-06-23  3:58 Stephen Rothwell
2017-06-23  4:00 ` Stephen Rothwell
2017-06-23  4:10   ` Michael Ellerman
2017-06-23  4:22     ` Stephen Rothwell
2016-12-14  2:28 Stephen Rothwell
2016-12-14  7:24 ` Ingo Molnar
2016-12-14  8:05   ` Richard Weinberger
2016-12-14  8:26     ` Stephen Rothwell
2016-12-14  8:10   ` Stephen Rothwell
2016-07-24  5:32 Stephen Rothwell
2016-07-25  7:16 ` Thomas Gleixner
2016-07-25 13:11   ` Daniel Lezcano
2016-07-25 14:53     ` Rich Felker
2016-07-25 16:42       ` Mark Brown
2016-07-25 17:54         ` Rich Felker
2016-07-25 14:48   ` Rich Felker
2016-04-07  5:26 Stephen Rothwell
2016-04-07  8:48 ` Ingo Molnar
2016-04-07 12:03   ` Stephen Rothwell
2015-05-12  3:35 Stephen Rothwell
2014-08-05  0:58 Stephen Rothwell
2014-07-18  5:00 Stephen Rothwell
2014-07-18 19:16 ` H. Peter Anvin
2014-07-18 19:57   ` Andy Lutomirski
2014-07-18 20:05     ` H. Peter Anvin
2014-07-18 20:08       ` Andy Lutomirski
2014-07-18 20:15         ` H. Peter Anvin
2014-07-18 20:20           ` Andy Lutomirski
2014-07-18 20:50             ` H. Peter Anvin
2014-06-16  1:57 Stephen Rothwell
2014-06-20  4:24 ` Stephen Rothwell
2014-06-20  4:30   ` H. Peter Anvin
2014-06-20  4:35     ` Stephen Rothwell
2014-03-06  6:12 Stephen Rothwell
2014-02-24  4:17 Stephen Rothwell
2014-02-24  5:56 ` Stephen Rothwell
2014-02-24  6:12   ` Andrew Morton
2014-02-24  6:23     ` Stephen Rothwell
2014-02-24 15:48 ` Andi Kleen
2014-02-24 15:51   ` H. Peter Anvin
2014-03-06  4:00 ` Stephen Rothwell
2014-03-28  5:52   ` Stephen Rothwell
2014-03-31  9:45     ` Thomas Gleixner
2014-03-31 10:57       ` Stephen Rothwell
2014-04-01  0:26         ` Stephen Rothwell
2014-04-01  1:56           ` H. Peter Anvin
2013-08-19  4:26 Stephen Rothwell
2013-08-19  6:58 ` Ingo Molnar
2013-08-20  0:52   ` Andi Kleen
2013-08-20  6:42     ` Ingo Molnar
2013-08-30  8:55       ` Stephen Rothwell
2013-08-30 20:42         ` Andi Kleen
2013-08-31  6:41           ` Ingo Molnar
2013-02-02  5:58 Stephen Rothwell
2013-02-02  5:55 Stephen Rothwell
2013-02-02  5:51 Stephen Rothwell
2013-01-30 11:41 Stephen Rothwell
2012-10-01 14:54 Stephen Rothwell
2012-10-01 16:10 ` Josh Triplett
2012-09-27  7:46 Stephen Rothwell
2011-09-14  6:34 Stephen Rothwell
2011-09-14  7:49 ` Yong Zhang
2011-09-14  9:37 ` Thomas Gleixner
2011-09-14  9:43   ` Shan Hai
2011-09-14  6:22 Stephen Rothwell
2010-11-29  1:11 Stephen Rothwell
2010-09-03  2:10 Stephen Rothwell
2010-09-03  2:12 ` Stephen Rothwell
2010-09-03  9:04   ` Wu Fengguang
2010-09-03 10:07     ` Haicheng Li
2010-05-17  5:58 Stephen Rothwell
2010-03-17  3:57 Stephen Rothwell
2010-03-17  4:00 ` KOSAKI Motohiro
2010-03-17  4:52   ` Stephen Rothwell
2010-03-17  7:02 ` Ingo Molnar
2010-03-17  8:02   ` KOSAKI Motohiro
2010-02-23  5:01 Stephen Rothwell
2010-02-23  8:52 ` Yinghai Lu
2010-02-23 10:43   ` Stephen Rothwell

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=20200413100112.2e114e24@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /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.