* suspicious compiler warning in vdso2c.h
@ 2014-09-16 9:53 Jan Beulich
2014-09-16 21:16 ` Andy Lutomirski
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2014-09-16 9:53 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: linux-kernel, hpa
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");
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: suspicious compiler warning in vdso2c.h
2014-09-16 9:53 suspicious compiler warning in vdso2c.h Jan Beulich
@ 2014-09-16 21:16 ` Andy Lutomirski
0 siblings, 0 replies; 2+ messages in thread
From: Andy Lutomirski @ 2014-09-16 21:16 UTC (permalink / raw)
To: Jan Beulich; +Cc: H. Peter Anvin, linux-kernel
On Sep 16, 2014 2:53 AM, "Jan Beulich" <JBeulich@suse.com> wrote:
>
> 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
Yes. There's a more or less equivalent fix sitting in -mm.
--Andy
>
> 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");
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-16 21:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-16 9:53 suspicious compiler warning in vdso2c.h Jan Beulich
2014-09-16 21:16 ` Andy Lutomirski
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®