mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: "Andy Lutomirski" <luto@amacapital.net>
Cc: <linux-kernel@vger.kernel.org>, <hpa@zytor.com>
Subject: suspicious compiler warning in vdso2c.h
Date: Tue, 16 Sep 2014 10:53:50 +0100	[thread overview]
Message-ID: <541824CE020000780003550B@mail.emea.novell.com> (raw)

Andy

following e6577a7ce9 ("x86, vdso: Move the vvar area before the
vdso text") gcc 4.3.4 tells me

.../arch/x86/vdso/vdso2c.c: In function ‘main’:
.../arch/x86/vdso/vdso2c.h:118: warning: assuming signed overflow does not occur when assuming that (X + c) < X is
always false
.../arch/x86/vdso/vdso2c.h:118: warning: assuming signed overflow does not occur when assuming that (X + c) < X is
always false

apparently because it unrolls the containing loop and finds i ==
sym_vvar_start on the first iteration. I think there was a hidden
dependency before your change on required_syms[] first two
entries matching up with special_pages[]. If that's correct, all
syms[i] within said loop would seem to need replacing by
syms[special_pages[i]] (similarly for required_syms[i] afaict, see
below draft patch), which also is in line with the loop iterating
over the array elements of special_pages[].

Question then of course is - are there any further hidden
dependencies that already got or may eventually get broken?

Jan

--- a/arch/x86/vdso/vdso2c.h
+++ b/arch/x86/vdso/vdso2c.h
@@ -109,18 +109,18 @@ static void BITSFUNC(go)(void *raw_addr,
 
 	/* Validate mapping addresses. */
 	for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) {
-		if (!syms[i])
+		if (!syms[special_pages[i]])
 			continue;  /* The mapping isn't used; ignore it. */
 
-		if (syms[i] % 4096)
+		if (syms[special_pages[i]] % 4096)
 			fail("%s must be a multiple of 4096\n",
-			     required_syms[i].name);
-		if (syms[sym_vvar_start] > syms[i] + 4096)
+			     required_syms[special_pages[i]].name);
+		if (syms[sym_vvar_start] > syms[special_pages[i]] + 4096)
 			fail("%s underruns begin_vvar\n",
-			     required_syms[i].name);
-		if (syms[i] + 4096 > 0)
+			     required_syms[special_pages[i]].name);
+		if (syms[special_pages[i]] + 4096 > 0)
 			fail("%s is on the wrong side of the vdso text\n",
-			     required_syms[i].name);
+			     required_syms[special_pages[i]].name);
 	}
 	if (syms[sym_vvar_start] % 4096)
 		fail("vvar_begin must be a multiple of 4096\n");


             reply	other threads:[~2014-09-16  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16  9:53 Jan Beulich [this message]
2014-09-16 21:16 ` Andy Lutomirski

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=541824CE020000780003550B@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®