Skip to content

Commit 4cb6066

Browse files
committed
sparc: Kill user copy check code.
For whatever reason GCC isn't able to figure things out in the control flow (in particular when min() and max() expressions are involved) on sparc as well as it can on x86. So lots of useless incorrect user copy warnings get spewed and the full-on compile failure mode of the user copy checks were never usable on sparc at all. People can debug these kinds of problems on x86. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b11287e commit 4cb6066

File tree

3 files changed

+5
-47
lines changed

3 files changed

+5
-47
lines changed

arch/sparc/Kconfig.debug

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,4 @@ config FRAME_POINTER
3030
depends on MCOUNT
3131
default y
3232

33-
config DEBUG_STRICT_USER_COPY_CHECKS
34-
bool "Strict copy size checks"
35-
depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
36-
---help---
37-
Enabling this option turns a certain set of sanity checks for user
38-
copy operations into compile time failures.
39-
40-
The copy_from_user() etc checks are there to help test if there
41-
are sufficient security checks on the length argument of
42-
the copy operation, by having gcc prove that the argument is
43-
within bounds.
44-
45-
If unsure, or if you run an older (pre 4.4) gcc, say N.
46-
4733
endmenu

arch/sparc/include/asm/uaccess_32.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,23 +260,8 @@ static inline unsigned long __copy_to_user(void __user *to, const void *from, un
260260
return __copy_user(to, (__force void __user *) from, n);
261261
}
262262

263-
extern void copy_from_user_overflow(void)
264-
#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
265-
__compiletime_error("copy_from_user() buffer size is not provably correct")
266-
#else
267-
__compiletime_warning("copy_from_user() buffer size is not provably correct")
268-
#endif
269-
;
270-
271263
static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
272264
{
273-
int sz = __compiletime_object_size(to);
274-
275-
if (unlikely(sz != -1 && sz < n)) {
276-
copy_from_user_overflow();
277-
return n;
278-
}
279-
280265
if (n && __access_ok((unsigned long) from, n))
281266
return __copy_user((__force void __user *) to, from, n);
282267
else

arch/sparc/include/asm/uaccess_64.h

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,6 @@ __asm__ __volatile__( \
205205

206206
extern int __get_user_bad(void);
207207

208-
extern void copy_from_user_overflow(void)
209-
#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
210-
__compiletime_error("copy_from_user() buffer size is not provably correct")
211-
#else
212-
__compiletime_warning("copy_from_user() buffer size is not provably correct")
213-
#endif
214-
;
215-
216208
extern unsigned long __must_check ___copy_from_user(void *to,
217209
const void __user *from,
218210
unsigned long size);
@@ -221,16 +213,11 @@ extern unsigned long copy_from_user_fixup(void *to, const void __user *from,
221213
static inline unsigned long __must_check
222214
copy_from_user(void *to, const void __user *from, unsigned long size)
223215
{
224-
int sz = __compiletime_object_size(to);
225-
unsigned long ret = size;
226-
227-
if (likely(sz == -1 || sz >= size)) {
228-
ret = ___copy_from_user(to, from, size);
229-
if (unlikely(ret))
230-
ret = copy_from_user_fixup(to, from, size);
231-
} else {
232-
copy_from_user_overflow();
233-
}
216+
unsigned long ret = ___copy_from_user(to, from, size);
217+
218+
if (unlikely(ret))
219+
ret = copy_from_user_fixup(to, from, size);
220+
234221
return ret;
235222
}
236223
#define __copy_from_user copy_from_user

0 commit comments

Comments
 (0)