Skip to content

Commit 5db6db0

Browse files
committed
Merge branch 'work.uaccess' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull uaccess unification updates from Al Viro: "This is the uaccess unification pile. It's _not_ the end of uaccess work, but the next batch of that will go into the next cycle. This one mostly takes copy_from_user() and friends out of arch/* and gets the zero-padding behaviour in sync for all architectures. Dealing with the nocache/writethrough mess is for the next cycle; fortunately, that's x86-only. Same for cleanups in iov_iter.c (I am sold on access_ok() in there, BTW; just not in this pile), same for reducing __copy_... callsites, strn*... stuff, etc. - there will be a pile about as large as this one in the next merge window. This one sat in -next for weeks. -3KLoC" * 'work.uaccess' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (96 commits) HAVE_ARCH_HARDENED_USERCOPY is unconditional now CONFIG_ARCH_HAS_RAW_COPY_USER is unconditional now m32r: switch to RAW_COPY_USER hexagon: switch to RAW_COPY_USER microblaze: switch to RAW_COPY_USER get rid of padding, switch to RAW_COPY_USER ia64: get rid of copy_in_user() ia64: sanitize __access_ok() ia64: get rid of 'segment' argument of __do_{get,put}_user() ia64: get rid of 'segment' argument of __{get,put}_user_check() ia64: add extable.h powerpc: get rid of zeroing, switch to RAW_COPY_USER esas2r: don't open-code memdup_user() alpha: fix stack smashing in old_adjtimex(2) don't open-code kernel_setsockopt() mips: switch to RAW_COPY_USER mips: get rid of tail-zeroing in primitives mips: make copy_from_user() zero tail explicitly mips: clean and reorder the forest of macros... mips: consolidate __invoke_... wrappers ...
2 parents 5fab100 + 2fefc97 commit 5db6db0

176 files changed

Lines changed: 1458 additions & 4335 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/alpha/include/asm/extable.h‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#ifndef _ASM_EXTABLE_H
2+
#define _ASM_EXTABLE_H
3+
4+
/*
5+
* About the exception table:
6+
*
7+
* - insn is a 32-bit pc-relative offset from the faulting insn.
8+
* - nextinsn is a 16-bit offset off of the faulting instruction
9+
* (not off of the *next* instruction as branches are).
10+
* - errreg is the register in which to place -EFAULT.
11+
* - valreg is the final target register for the load sequence
12+
* and will be zeroed.
13+
*
14+
* Either errreg or valreg may be $31, in which case nothing happens.
15+
*
16+
* The exception fixup information "just so happens" to be arranged
17+
* as in a MEM format instruction. This lets us emit our three
18+
* values like so:
19+
*
20+
* lda valreg, nextinsn(errreg)
21+
*
22+
*/
23+
24+
struct exception_table_entry
25+
{
26+
signed int insn;
27+
union exception_fixup {
28+
unsigned unit;
29+
struct {
30+
signed int nextinsn : 16;
31+
unsigned int errreg : 5;
32+
unsigned int valreg : 5;
33+
} bits;
34+
} fixup;
35+
};
36+
37+
/* Returns the new pc */
38+
#define fixup_exception(map_reg, _fixup, pc) \
39+
({ \
40+
if ((_fixup)->fixup.bits.valreg != 31) \
41+
map_reg((_fixup)->fixup.bits.valreg) = 0; \
42+
if ((_fixup)->fixup.bits.errreg != 31) \
43+
map_reg((_fixup)->fixup.bits.errreg) = -EFAULT; \
44+
(pc) + (_fixup)->fixup.bits.nextinsn; \
45+
})
46+
47+
#define ARCH_HAS_RELATIVE_EXTABLE
48+
49+
#define swap_ex_entry_fixup(a, b, tmp, delta) \
50+
do { \
51+
(a)->fixup.unit = (b)->fixup.unit; \
52+
(b)->fixup.unit = (tmp).fixup.unit; \
53+
} while (0)
54+
55+
#endif

‎arch/alpha/include/asm/futex.h‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@
1919
"3: .subsection 2\n" \
2020
"4: br 1b\n" \
2121
" .previous\n" \
22-
" .section __ex_table,\"a\"\n" \
23-
" .long 1b-.\n" \
24-
" lda $31,3b-1b(%1)\n" \
25-
" .long 2b-.\n" \
26-
" lda $31,3b-2b(%1)\n" \
27-
" .previous\n" \
22+
EXC(1b,3b,%1,$31) \
23+
EXC(2b,3b,%1,$31) \
2824
: "=&r" (oldval), "=&r"(ret) \
2925
: "r" (uaddr), "r"(oparg) \
3026
: "memory")
@@ -101,12 +97,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
10197
"3: .subsection 2\n"
10298
"4: br 1b\n"
10399
" .previous\n"
104-
" .section __ex_table,\"a\"\n"
105-
" .long 1b-.\n"
106-
" lda $31,3b-1b(%0)\n"
107-
" .long 2b-.\n"
108-
" lda $31,3b-2b(%0)\n"
109-
" .previous\n"
100+
EXC(1b,3b,%0,$31)
101+
EXC(2b,3b,%0,$31)
110102
: "+r"(ret), "=&r"(prev), "=&r"(cmp)
111103
: "r"(uaddr), "r"((long)(int)oldval), "r"(newval)
112104
: "memory");

0 commit comments

Comments
 (0)