aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2014-07-30 17:59:49 -0400
committerIngo Molnar <mingo@kernel.org>2014-09-24 03:55:38 -0400
commitf12c1f9002d27374fd205f6e692891116ca22272 (patch)
tree72969fd94198bb5fa4429b7e36c870a7b820e67e /arch/x86
parentf3670394c29ff3730638762c1760fd2f624e6d7b (diff)
x86/vdso: Fix vdso2c's special_pages[] error checking
Stephen Rothwell's compiler did something amazing: it unrolled a loop, discovered that one iteration of that loop contained an always-true test, and emitted a warning that will IMO only serve to convince people to disable the warning. That bogus warning caused me to wonder what prompted such an absurdity from his compiler, and I discovered that the code in question was, in fact, completely wrong -- I was looking things up in the wrong array. This affects 3.16 as well, but the only effect is to screw up the error checking a bit. vdso2c's output is unaffected. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/53d96ad5.80ywqrbs33ZBCQej%25akpm@linux-foundation.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/vdso/vdso2c.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h
index fd57829b30d8..0224987556ce 100644
--- a/arch/x86/vdso/vdso2c.h
+++ b/arch/x86/vdso/vdso2c.h
@@ -109,16 +109,18 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
109 109
110 /* Validate mapping addresses. */ 110 /* Validate mapping addresses. */
111 for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { 111 for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) {
112 if (!syms[i]) 112 INT_BITS symval = syms[special_pages[i]];
113
114 if (!symval)
113 continue; /* The mapping isn't used; ignore it. */ 115 continue; /* The mapping isn't used; ignore it. */
114 116
115 if (syms[i] % 4096) 117 if (symval % 4096)
116 fail("%s must be a multiple of 4096\n", 118 fail("%s must be a multiple of 4096\n",
117 required_syms[i].name); 119 required_syms[i].name);
118 if (syms[sym_vvar_start] > syms[i] + 4096) 120 if (symval + 4096 < syms[sym_vvar_start])
119 fail("%s underruns begin_vvar\n", 121 fail("%s underruns vvar_start\n",
120 required_syms[i].name); 122 required_syms[i].name);
121 if (syms[i] + 4096 > 0) 123 if (symval + 4096 > 0)
122 fail("%s is on the wrong side of the vdso text\n", 124 fail("%s is on the wrong side of the vdso text\n",
123 required_syms[i].name); 125 required_syms[i].name);
124 } 126 }