I can see there are hardened profiles for mips, yet PAX completely dorks up the kernel build; maybe there's a compile switch but I have no idea what it is. The cross toolchain is default n64 with n32/032 support, so I could use a little help understanding just wtf is going on here... Unpatched mainline builds fine, applying just the PAX patch (or trying to build hardened-sources) does not work: linux (v4.4-mips3) $ ARCH=mips CROSS_COMPILE=mips64-unknown-linux-gnueabi- make -j5 CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h Checking missing-syscalls for N32 CHK include/generated/timeconst.h CHK include/generated/bounds.h CC arch/mips/kernel/asm-offsets.s In file included from include/linux/atomic.h:4:0, from include/linux/spinlock.h:417, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/linux/stat.h:18, from include/linux/compat.h:10, from arch/mips/kernel/asm-offsets.c:11: ./arch/mips/include/asm/atomic.h: In function ‘atomic_add_return_unchecked’: ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(add, add) ^ ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(add, add) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic_add_return’: ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(add, add) ^ ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(add, add) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic_sub_return_unchecked’: ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(sub, sub) ^ ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(sub, sub) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic_sub_return’: ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(sub, sub) ^ ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro ‘__ATOMIC_OP_RETURN’ __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro ‘ATOMIC_OP_RETURN’ ATOMIC_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro ‘ATOMIC_OPS’ ATOMIC_OPS(sub, sub) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic64_add_return_unchecked’: ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(add, dadd) ^ ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(add, dadd) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic64_add_return’: ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(add, dadd) ^ ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(add, dadd) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic64_sub_return_unchecked’: ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(sub, dsub) ^ ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, asm_op##u, , ) \ ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(sub, dsub) ^ ./arch/mips/include/asm/atomic.h: In function ‘atomic64_sub_return’: ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect [-Wunused-value] result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(sub, dsub) ^ ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ result = temp; result c_op i; \ ^ ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro ‘__ATOMIC64_OP_RETURN’ __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, __OVERFLOW_EXTABLE) ^ ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro ‘ATOMIC64_OP_RETURN’ ATOMIC64_OP_RETURN(op, asm_op) ^ ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro ‘ATOMIC64_OPS’ ATOMIC64_OPS(sub, dsub) ^ Kbuild:80: recipe for target 'arch/mips/kernel/asm-offsets.s' failed make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1 arch/mips/Makefile:379: recipe for target 'archprepare' failed make: *** [archprepare] Error 2
(In reply to Steve Arnold from comment #0) > I can see there are hardened profiles for mips, yet PAX completely dorks up > the kernel build; maybe there's a compile switch but I have no idea what it > is. The cross toolchain is default n64 with n32/032 support, so I could use > a little help understanding just wtf is going on here... > > Unpatched mainline builds fine, applying just the PAX patch (or trying to > build hardened-sources) does not work: > > linux (v4.4-mips3) $ ARCH=mips CROSS_COMPILE=mips64-unknown-linux-gnueabi- > make -j5 > CHK include/config/kernel.release > CHK include/generated/uapi/linux/version.h > CHK include/generated/utsrelease.h > Checking missing-syscalls for N32 > CHK include/generated/timeconst.h > CHK include/generated/bounds.h > CC arch/mips/kernel/asm-offsets.s > In file included from include/linux/atomic.h:4:0, > from include/linux/spinlock.h:417, > from include/linux/seqlock.h:35, > from include/linux/time.h:5, > from include/linux/stat.h:18, > from include/linux/compat.h:10, > from arch/mips/kernel/asm-offsets.c:11: > ./arch/mips/include/asm/atomic.h: In function ‘atomic_add_return_unchecked’: > ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(add, add) > ^ > ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(add, add) > ^ > ./arch/mips/include/asm/atomic.h: In function ‘atomic_add_return’: > ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(add, add) > ^ > ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:204:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(add, add) > ^ > ./arch/mips/include/asm/atomic.h: In function ‘atomic_sub_return_unchecked’: > ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(sub, sub) > ^ > ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:197:38: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > #define ATOMIC_OP_RETURN(op, asm_op) __ATOMIC_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(sub, sub) > ^ > ./arch/mips/include/asm/atomic.h: In function ‘atomic_sub_return’: > ./arch/mips/include/asm/atomic.h:176:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(sub, sub) > ^ > ./arch/mips/include/asm/atomic.h:176:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:198:10: note: in expansion of macro > ‘__ATOMIC_OP_RETURN’ > __ATOMIC_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:202:2: note: in expansion of macro > ‘ATOMIC_OP_RETURN’ > ATOMIC_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:205:1: note: in expansion of macro > ‘ATOMIC_OPS’ > ATOMIC_OPS(sub, sub) > ^ > ./arch/mips/include/asm/atomic.h: In function > ‘atomic64_add_return_unchecked’: > ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(add, dadd) > ^ > ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(add, dadd) > ^ > ./arch/mips/include/asm/atomic.h: In function ‘atomic64_add_return’: > ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(add, dadd) > ^ > ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:561:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(add, dadd) > ^ > ./arch/mips/include/asm/atomic.h: In function > ‘atomic64_sub_return_unchecked’: > ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(sub, dsub) > ^ > ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:554:40: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > #define ATOMIC64_OP_RETURN(op, asm_op) __ATOMIC64_OP_RETURN(op, _unchecked, > asm_op##u, , ) \ > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(sub, dsub) > ^ > ./arch/mips/include/asm/atomic.h: In function ‘atomic64_sub_return’: > ./arch/mips/include/asm/atomic.h:533:18: warning: statement with no effect > [-Wunused-value] > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(sub, dsub) > ^ > ./arch/mips/include/asm/atomic.h:533:25: error: expected ‘;’ before ‘c_op’ > result = temp; result c_op i; \ > ^ > ./arch/mips/include/asm/atomic.h:555:12: note: in expansion of macro > ‘__ATOMIC64_OP_RETURN’ > __ATOMIC64_OP_RETURN(op, , asm_op, __OVERFLOW_POST, > __OVERFLOW_EXTABLE) > ^ > ./arch/mips/include/asm/atomic.h:559:2: note: in expansion of macro > ‘ATOMIC64_OP_RETURN’ > ATOMIC64_OP_RETURN(op, asm_op) > ^ > ./arch/mips/include/asm/atomic.h:562:1: note: in expansion of macro > ‘ATOMIC64_OPS’ > ATOMIC64_OPS(sub, dsub) > ^ > Kbuild:80: recipe for target 'arch/mips/kernel/asm-offsets.s' failed > make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1 > arch/mips/Makefile:379: recipe for target 'archprepare' failed > make: *** [archprepare] Error 2 when you say the PAX patch, what are you referrging to exactly? and what kernel are you using, hardened-sources, gentoo-sources or vanilla-sources?
Actually I mean both, hardened sources and mainline with just the PAX patch applied. Same error in both. Here's the toolchain info; seems like the profiles/APIs are a little bit out of whack, since I also had emerge failures on the "default" mips3 stage profile until I switched it to multilib/n32. Is there some actual document on the new stages/profiles besides the terse readme in distfiles? As far as the new stages, the first try of crossdev built fine but defaulted to n32, next try failed on "n64 n32" and third try built successfully with "n64 n32 o32". The PAX patch failed with all of them, including my old mips64 gcc-4.8.4. The last one is shown below. EXTRA_ECONF="--with-mips-plt --with-arch=mips64r2 --with-tune=mips64r2" crossdev -t mips64-unknown-linux-gnueabi --abis "n64 n32 o32" -v -b --b 2.25.1-r1 --g 5.3.0 --k 4.4 --l 2.22-r1 --without-headers --ex-gdb --ov-output /usr/local/mips64-cross $ mips64-unknown-linux-gnueabi-gcc -v Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/mips64-unknown-linux-gnueabi/gcc-bin/5.3.0/mips64-unknown-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/mips64-unknown-linux-gnueabi/5.3.0/lto-wrapper Target: mips64-unknown-linux-gnueabi Configured with: /var/tmp/portage/cross-mips64-unknown-linux-gnueabi/gcc-5.3.0/work/gcc-5.3.0/configure --host=x86_64-pc-linux-gnu --target=mips64-unknown-linux-gnueabi --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/mips64-unknown-linux-gnueabi/gcc-bin/5.3.0 --includedir=/usr/lib/gcc/mips64-unknown-linux-gnueabi/5.3.0/include --datadir=/usr/share/gcc-data/mips64-unknown-linux-gnueabi/5.3.0 --mandir=/usr/share/gcc-data/mips64-unknown-linux-gnueabi/5.3.0/man --infodir=/usr/share/gcc-data/mips64-unknown-linux-gnueabi/5.3.0/info --with-gxx-include-dir=/usr/lib/gcc/mips64-unknown-linux-gnueabi/5.3.0/include/g++-v5 --with-python-dir=/share/gcc-data/mips64-unknown-linux-gnueabi/5.3.0/python --enable-languages=c,c++,jit --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 5.3.0 p1.0, pie-0.6.5' --enable-esp --enable-libstdcxx-time --enable-host-shared --enable-poison-system-directories --with-sysroot=/usr/mips64-unknown-linux-gnueabi --disable-bootstrap --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --disable-altivec --disable-fixed-point --with-abi=64 --disable-libgcj --disable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libquadmath --enable-lto --without-isl --disable-libsanitizer --with-mips-plt --with-arch=mips64r2 --with-tune=mips64r2 Thread model: posix gcc version 5.3.0 (Gentoo Hardened 5.3.0 p1.0, pie-0.6.5)
This the machine info: # cat /proc/cpuinfo system type : UBNT_E100 (CN5020p1.1-500-SCP) machine : Unknown processor : 0 cpu model : Cavium Octeon+ V0.1 BogoMIPS : 1000.00 wait instruction : yes microsecond timers : yes tlb_entries : 64 extra interrupt vector : yes hardware watchpoint : yes, count: 2, address/irw mask: [0x0ffc, 0x0ffb] isa : mips2 mips3 mips4 mips5 mips64r2 ASEs implemented : shadow register sets : 1 kscratch registers : 0 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available processor : 1 cpu model : Cavium Octeon+ V0.1 BogoMIPS : 1000.00 wait instruction : yes microsecond timers : yes tlb_entries : 64 extra interrupt vector : yes hardware watchpoint : yes, count: 2, address/irw mask: [0x0ffc, 0x0ffb] isa : mips2 mips3 mips4 mips5 mips64r2 ASEs implemented : shadow register sets : 1 kscratch registers : 0 package : 0 core : 1 VCED exceptions : not available VCEI exceptions : not available
the REFCOUNT/mips code was provided by someone else and since then i kinda inherited its maintenance with the occasional hickup. can you try the following diff on top of PaX (or grsec) and report back please: --- a/arch/mips/include/asm/atomic.h 2016-01-29 17:04:51.579321521 +0100 +++ b/arch/mips/include/asm/atomic.h 2016-04-02 15:05:29.130931701 +0200 @@ -172,8 +172,6 @@ : "=&r" (result), "=&r" (temp), \ "+" GCC_OFF_SMALL_ASM() (v->counter) \ : "Ir" (i)); \ - \ - result = temp; result c_op i; \ } else { \ unsigned long flags; \ \ @@ -529,8 +527,6 @@ "=" GCC_OFF_SMALL_ASM() (v->counter) \ : "Ir" (i), GCC_OFF_SMALL_ASM() (v->counter) \ : "memory"); \ - \ - result = temp; result c_op i; \ } else { \ unsigned long flags; \ \
Sure, I can give it a try, but it looks pretty tiny compared to the awesome number of warnings the pax patch introduces on mips and arm (sort of like zero to infinity in 60 seconds). Lemme see what this does...
Tons of ugly warnings, then fails again in the Octeon crypt module due to -Werror: LD init/built-in.o CC arch/mips/cavium-octeon/cpu.o CC arch/mips/cavium-octeon/setup.o CC arch/mips/cavium-octeon/octeon-platform.o CC arch/mips/cavium-octeon/octeon-irq.o CC arch/mips/cavium-octeon/csrc-octeon.o CC arch/mips/cavium-octeon/dma-octeon.o CC arch/mips/cavium-octeon/crypto/octeon-crypto.o LD arch/mips/cavium-octeon/crypto/built-in.o CC [M] arch/mips/cavium-octeon/crypto/octeon-md5.o In file included from include/linux/cache.h:4:0, from include/linux/printk.h:8, from include/linux/kernel.h:13, from include/linux/list.h:8, from include/linux/module.h:9, from arch/mips/cavium-octeon/crypto/octeon-md5.c:25: include/linux/skbuff.h: In function ‘__skb_cow’: include/linux/kernel.h:730:17: error: comparison of distinct pointer types lacks a cast [-Werror] (void) (&_max1 == &_max2); \ ^ include/uapi/linux/kernel.h:10:47: note: in definition of macro ‘__ALIGN_KERNEL_MASK’ #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) ^ include/linux/kernel.h:49:22: note: in expansion of macro ‘__ALIGN_KERNEL’ #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) ^ include/linux/skbuff.h:2551:32: note: in expansion of macro ‘ALIGN’ return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, ^ include/linux/skbuff.h:2157:21: note: in expansion of macro ‘max’ #define NET_SKB_PAD max(_AC(32,UL), L1_CACHE_BYTES) ^ include/linux/skbuff.h:2551:45: note: in expansion of macro ‘NET_SKB_PAD’ return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, ^ include/linux/kernel.h:730:17: error: comparison of distinct pointer types lacks a cast [-Werror] (void) (&_max1 == &_max2); \ ^ include/uapi/linux/kernel.h:10:58: note: in definition of macro ‘__ALIGN_KERNEL_MASK’ #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) ^ include/linux/kernel.h:49:22: note: in expansion of macro ‘__ALIGN_KERNEL’ #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) ^ include/linux/skbuff.h:2551:32: note: in expansion of macro ‘ALIGN’ return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, ^ include/linux/skbuff.h:2157:21: note: in expansion of macro ‘max’ #define NET_SKB_PAD max(_AC(32,UL), L1_CACHE_BYTES) ^ include/linux/skbuff.h:2551:45: note: in expansion of macro ‘NET_SKB_PAD’ return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, ^ cc1: all warnings being treated as errors scripts/Makefile.build:264: recipe for target 'arch/mips/cavium-octeon/crypto/octeon-md5.o' failed make[3]: *** [arch/mips/cavium-octeon/crypto/octeon-md5.o] Error 1 scripts/Makefile.build:403: recipe for target 'arch/mips/cavium-octeon/crypto' failed make[2]: *** [arch/mips/cavium-octeon/crypto] Error 2 scripts/Makefile.build:403: recipe for target 'arch/mips/cavium-octeon' failed make[1]: *** [arch/mips/cavium-octeon] Error 2 Makefile:949: recipe for target 'arch/mips' failed make: *** [arch/mips] Error 2
I'm not sure (pax) upstream tests on or cares about anything embedded; the mainline kernel code is pretty clean these days on mips/arm until you add patches like this one...
(In reply to Steve Arnold from comment #7) > I'm not sure (pax) upstream tests on or cares about anything embedded; the > mainline kernel code is pretty clean these days on mips/arm until you add > patches like this one... uhmm, i'm that upstream ;) and i definitely care about all archs we support but i can't test everything. as for archs being clean, nothing is, the best sign of that is when someone enables -Werror, it means they don't know what they're doing. PaX (hopefully) doesn't add new warnings itself but it does enable a few by default whose result you can clearly see all over the codebase (still 'pretty clean', eh? ;). anyway, here's a fix/workaround for the L1_CACHE_BYTES one you reported above: --- a/arch/mips/include/asm/cache.h 2012-12-11 04:30:57.000000000 +0100 +++ b/arch/mips/include/asm/cache.h 2016-04-05 00:56:09.499000257 +0200 @@ -9,10 +9,11 @@ #ifndef _ASM_CACHE_H #define _ASM_CACHE_H +#include <linux/const.h> #include <kmalloc.h> #define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT -#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) +#define L1_CACHE_BYTES (_AC(1,UL) << L1_CACHE_SHIFT) #define SMP_CACHE_SHIFT L1_CACHE_SHIFT #define SMP_CACHE_BYTES L1_CACHE_BYTES
I meant Mr. PaxGuy upstream, who obviously doesn't build with a cross-compiler to test all those non-x86 files he patches. Linux-stable, all recent tags/branches I've tried: zero warnings Hardened x86/amd64 4.x has a handful on warnings in some of the "touched" security files, but builds and works afaict (at least it successfully kills things I'd like to work). Both hardened-sources and pax patch on linux-stable arm/mips, using anything recent has a metric buttload of warnings and repeated failures. I looked through the mips asm/atomic stuff until my head hurt but didn't see anything I could fix quickly, so... If you can make this pax stuff work on either embedded arch I'll send you some of my wife's cookies.
Created attachment 430022 [details] Post-kernel error missing variables One more try? This one seems a little weirder even, since the header exists in all of my toolchain builds (both native and cross) but the actual HAVE_ashrti3 definition only exists in my hardeded i686 toolchain on one single machine (plus my old gnat-gcc 4.6.3 install?). Go figure... AS arch/mips/boot/dts/cavium-octeon/octeon_3xxx.dtb.o AS arch/mips/boot/dts/cavium-octeon/octeon_68xx.dtb.o LD arch/mips/boot/dts/cavium-octeon/built-in.o rm arch/mips/boot/dts/cavium-octeon/octeon_68xx.dtb.S arch/mips/boot/dts/cavium-octeon/octeon_3xxx.dtb.S LD arch/mips/boot/dts/built-in.o CHK kernel/config_data.h LINK vmlinux LD vmlinux.o MODPOST vmlinux.o WARNING: modpost: Found 2996 writable function pointer(s). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o kernel/built-in.o: In function `do_sysinfo': sys.c:(.text+0x13dac): undefined reference to `__ashlti3' sys.c:(.text+0x13e34): undefined reference to `__ashlti3' kernel/built-in.o: In function `compat_SyS_sysinfo': (.text+0x16f4c): undefined reference to `__ashrti3' kernel/built-in.o: In function `compat_SyS_sysinfo': (.text+0x16fd8): undefined reference to `__ashrti3' kernel/built-in.o: In function `htab_map_alloc': hashtab.c:(.text+0x9468c): undefined reference to `__ashlti3' kernel/built-in.o: In function `perf_output_read': core.c:(.text+0x96b34): undefined reference to `__ashlti3' core.c:(.text+0x96d60): undefined reference to `__ashlti3' core.c:(.text+0x96fac): undefined reference to `__ashlti3' kernel/built-in.o: In function `perf_event_comm_output': core.c:(.text+0x9f528): undefined reference to `__ashlti3' kernel/built-in.o:core.c:(.text+0x9f9d4): more undefined references to `__ashlti3' follow mm/built-in.o: In function `generic_swapfile_activate': (.text+0x40728): undefined reference to `__ashrti3' mm/built-in.o: In function `ksize': (.text+0x4c5a4): undefined reference to `__ashlti3' fs/built-in.o: In function `pipe_fcntl': (.text+0xc8e8): undefined reference to `__ashlti3' fs/built-in.o: In function `__generic_block_fiemap': (.text+0x1488c): undefined reference to `__ashlti3'
Btw, the patch in comment #8 does clear up a bunch of warnings. I think it's pretty close if you can figure out this last one...
(In reply to Steve Arnold from comment #11) > Btw, the patch in comment #8 does clear up a bunch of warnings. I think > it's pretty close if you can figure out this last one... Sorry, the header file where it should be is: /usr/lib64/gcc/mipsel-unknown-linux-gnueabi/5.3.0/plugin/include/insn-flags.h
And after a guinness and some deep breaths, sorry if I was pissy. This is the final thing I need to deploy the cavium as hardened gentoo gateway, but it looks like I still have some poking/testing to do. I'm still not sure about the missing header(s) but it looks like it could be a plugin related linker error (or else plugin support is just not supposed to work on mips yet). Is it worth cloning the plugin support repo and trying that? Not sure exactly sure how to do that, but hey...
(In reply to Steve Arnold from comment #9) > I meant Mr. PaxGuy upstream, who obviously doesn't build with a > cross-compiler to test all those non-x86 files he patches. that's still me and no, i don't test everything under the sun, that's where Community Support (tm) comes in. > Linux-stable, all recent tags/branches I've tried: zero warnings you must have never tried make W=1, not to mention higher W levels (some of which PaX enables by default). > kernel/built-in.o: In function `do_sysinfo': > sys.c:(.text+0x13dac): undefined reference to `__ashlti3' that's a 128 bit shift operation that gcc delegates to libgcc (not used by the kernel) instead of emitting the asm itself. you should find out what triggers its generation by running "make kernel/sys.s" and uploading the result.
$ make ARCH=mips CROSS_COMPILE=mips64-unknown-linux-gnueabi- kernel/sys.s CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h Checking missing-syscalls for N32 CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh Checking missing-syscalls for O32 CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/bounds.h CHK include/generated/timeconst.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CC kernel/sys.s $
$ make ARCH=mips CROSS_COMPILE=mips64-unknown-linux-gnueabi- -j5 CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h Checking missing-syscalls for N32 CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh Checking missing-syscalls for O32 CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h DTB arch/mips/boot/dts/cavium-octeon/octeon_3xxx.dtb.S DTB arch/mips/boot/dts/cavium-octeon/octeon_68xx.dtb.S AS arch/mips/boot/dts/cavium-octeon/octeon_68xx.dtb.o AS arch/mips/boot/dts/cavium-octeon/octeon_3xxx.dtb.o LD arch/mips/boot/dts/cavium-octeon/built-in.o rm arch/mips/boot/dts/cavium-octeon/octeon_68xx.dtb.S arch/mips/boot/dts/cavium-octeon/octeon_3xxx.dtb.S LD arch/mips/boot/dts/built-in.o CHK kernel/config_data.h CHK include/generated/uapi/linux/version.h LINK vmlinux LD vmlinux.o MODPOST vmlinux.o WARNING: modpost: Found 3153 writable function pointer(s). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o init/built-in.o: In function `start_kernel': (.init.text+0x1730): undefined reference to `cpuset_init' init/built-in.o: In function `kernel_init_freeable': main.c:(.init.text+0x1928): undefined reference to `cpuset_init_smp' kernel/built-in.o: In function `do_sysinfo': sys.c:(.text+0x14038): undefined reference to `__ashlti3' sys.c:(.text+0x140c0): undefined reference to `__ashlti3' kernel/built-in.o: In function `compat_SyS_sysinfo': (.text+0x171f4): undefined reference to `__ashrti3' kernel/built-in.o: In function `compat_SyS_sysinfo': (.text+0x17280): undefined reference to `__ashrti3' kernel/built-in.o: In function `select_fallback_rq': core.c:(.text+0x27f30): undefined reference to `cpuset_cpus_allowed_fallback' kernel/built-in.o: In function `sched_setaffinity': (.text+0x2b8a4): undefined reference to `cpuset_cpus_allowed' kernel/built-in.o: In function `sched_setaffinity': (.text+0x2b960): undefined reference to `cpuset_cpus_allowed' kernel/built-in.o: In function `cpuset_cpu_active': core.c:(.text+0x2d988): undefined reference to `cpuset_update_active_cpus' kernel/built-in.o: In function `cpuset_cpu_inactive': core.c:(.text+0x2dae4): undefined reference to `cpuset_update_active_cpus' kernel/built-in.o: In function `htab_map_alloc': hashtab.c:(.text+0x9470c): undefined reference to `__ashlti3' kernel/built-in.o: In function `perf_output_read': core.c:(.text+0x967e4): undefined reference to `__ashlti3' core.c:(.text+0x96a10): undefined reference to `__ashlti3' core.c:(.text+0x96c5c): undefined reference to `__ashlti3' kernel/built-in.o: In function `perf_event_comm_output': core.c:(.text+0x9e5f8): undefined reference to `__ashlti3' kernel/built-in.o:core.c:(.text+0x9eaa4): more undefined references to `__ashlti3' follow kernel/built-in.o:(.rodata+0x3080): undefined reference to `cpuset_cgrp_subsys' mm/built-in.o: In function `get_page_from_freelist': page_alloc.c:(.text+0x8f8c): undefined reference to `cpusets_enabled_key' page_alloc.c:(.text+0x8f90): undefined reference to `cpusets_enabled_key' page_alloc.c:(.text+0x9544): undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `__alloc_pages_nodemask': (.text+0x9da4): undefined reference to `cpuset_memory_pressure_enabled' mm/built-in.o: In function `__alloc_pages_nodemask': (.text+0x9da8): undefined reference to `cpuset_memory_pressure_enabled' mm/built-in.o: In function `__alloc_pages_nodemask': (.text+0x9db4): undefined reference to `__cpuset_memory_pressure_bump' mm/built-in.o: In function `wakeup_kswapd': (.text+0x1481c): undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `wakeup_kswapd': (.text+0x14820): undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `wakeup_kswapd': (.text+0x14858): undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `do_try_to_free_pages': vmscan.c:(.text+0x16adc): undefined reference to `cpusets_enabled_key' vmscan.c:(.text+0x16ae0): undefined reference to `cpusets_enabled_key' vmscan.c:(.text+0x16af8): undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `generic_swapfile_activate': (.text+0x41398): undefined reference to `__ashrti3' mm/built-in.o: In function `ksize': (.text+0x482bc): undefined reference to `__ashlti3' mm/built-in.o: In function `dump_header.isra.5': oom_kill.c:(.text.unlikely+0x54): undefined reference to `cpuset_print_current_mems_allowed' mm/built-in.o: In function `build_all_zonelists_init': page_alloc.c:(.init.text+0x254): undefined reference to `cpuset_init_current_mems_allowed' mm/built-in.o:(__jump_table+0x28): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x40): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x70): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x88): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0xa0): undefined reference to `cpusets_enabled_key' fs/built-in.o: In function `pipe_fcntl': (.text+0xc928): undefined reference to `__ashlti3' fs/built-in.o: In function `__generic_block_fiemap': (.text+0x1497c): undefined reference to `__ashlti3' fs/built-in.o: In function `__getblk_slow': (.text+0x38914): undefined reference to `__ashrti3' fs/built-in.o: In function `__getblk_slow': (.text+0x389cc): undefined reference to `__ashlti3' fs/built-in.o: In function `__getblk_slow': (.text+0x38ab4): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f0d4): undefined reference to `__ashrti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f1ec): undefined reference to `__ashrti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f610): undefined reference to `__ashrti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f62c): undefined reference to `__ashrti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f65c): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f714): undefined reference to `__ashrti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3f81c): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x3ff08): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x4024c): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x40498): undefined reference to `__ashrti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x40880): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x40c14): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x4138c): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x416f0): undefined reference to `__ashlti3' fs/built-in.o: In function `__blockdev_direct_IO': (.text+0x41aa8): undefined reference to `__ashlti3' fs/built-in.o:(.text+0x41f70): more undefined references to `__ashlti3' follow fs/built-in.o: In function `do_mpage_readpage': mpage.c:(.text+0x4314c): undefined reference to `__ashrti3' mpage.c:(.text+0x43378): undefined reference to `__ashrti3' mpage.c:(.text+0x4340c): undefined reference to `__ashlti3' mpage.c:(.text+0x4355c): undefined reference to `__ashlti3' mpage.c:(.text+0x439c8): undefined reference to `__ashlti3' fs/built-in.o: In function `__mpage_writepage': mpage.c:(.text+0x43f70): undefined reference to `__ashrti3' mpage.c:(.text+0x444f8): undefined reference to `__ashlti3' fs/built-in.o: In function `proc_pid_status': (.text+0x72e04): undefined reference to `cpuset_task_status_allowed' fs/built-in.o: In function `ext4_readdir': dir.c:(.text+0x88c44): undefined reference to `__ashrti3' dir.c:(.text+0x88e44): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_file_write_iter': file.c:(.text+0x89ef8): undefined reference to `__ashrti3' file.c:(.text+0x89f44): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_llseek': (.text+0x8a444): undefined reference to `__ashrti3' fs/built-in.o:(.text+0x8a580): more undefined references to `__ashrti3' follow fs/built-in.o: In function `ext4_init_inode_table': (.text+0x8dfd0): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_init_inode_table': (.text+0x8dfec): undefined reference to `__ashlti3' fs/built-in.o: In function `mpage_map_and_submit_buffers': inode.c:(.text+0x8f404): undefined reference to `__ashlti3' fs/built-in.o: In function `mpage_release_unused_pages': inode.c:(.text+0x8f73c): undefined reference to `__ashlti3' inode.c:(.text+0x8f754): undefined reference to `__ashlti3' fs/built-in.o:inode.c:(.text+0x90e60): more undefined references to `__ashlti3' follow fs/built-in.o: In function `_ext4_get_block': inode.c:(.text+0x934e4): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_block_zero_page_range': inode.c:(.text+0x93864): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_writepages': inode.c:(.text+0x94fcc): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_punch_hole': (.text+0x95a60): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_punch_hole': (.text+0x95b58): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_append': namei.c:(.text+0x9b04c): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_find_entry': namei.c:(.text+0x9d564): undefined reference to `__ashrti3' namei.c:(.text+0x9d964): undefined reference to `__ashrti3' fs/built-in.o:super.c:(.text+0xa3cf0): more undefined references to `__ashrti3' follow fs/built-in.o: In function `ext4_fill_super': super.c:(.text+0xa9180): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_flex_group_add': resize.c:(.text+0xacf04): undefined reference to `__ashlti3' resize.c:(.text+0xacf20): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_alloc_file_blocks.isra.8': extents.c:(.text+0xb15f0): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_ext_truncate': (.text+0xb7878): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_convert_unwritten_extents': (.text+0xb7b24): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_convert_unwritten_extents': (.text+0xb7b6c): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_fiemap': (.text+0xb7f90): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_collapse_range': (.text+0xb85a8): undefined reference to `__ashrti3' fs/built-in.o:(.text+0xb86c8): more undefined references to `__ashrti3' follow fs/built-in.o: In function `ext4_mb_normalize_request.constprop.6': mballoc.c:(.text+0xbe120): undefined reference to `__ashlti3' mballoc.c:(.text+0xbe184): undefined reference to `__ashlti3' mballoc.c:(.text+0xbe1f0): undefined reference to `__ashrti3' mballoc.c:(.text+0xbe218): undefined reference to `__ashrti3' mballoc.c:(.text+0xbe788): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_free_data_callback': mballoc.c:(.text+0xc1b78): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_mb_add_groupinfo': (.text+0xc3bc8): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_free_blocks': (.text+0xc54f8): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_free_blocks': (.text+0xc5c6c): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_trim_fs': (.text+0xc6c00): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_trim_fs': (.text+0xc6de4): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_trim_fs': (.text+0xc6df4): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_move_extents': (.text+0xc8188): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_ind_truncate': (.text+0xcb138): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_mpage_readpages': (.text+0xd4be0): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_mpage_readpages': (.text+0xd4eb8): undefined reference to `__ashrti3' fs/built-in.o: In function `ext4_mpage_readpages': (.text+0xd4f4c): undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_mpage_readpages': (.text+0xd55a8): undefined reference to `__ashlti3' fs/built-in.o: In function `squashfs_read_data': (.text+0xe4e80): undefined reference to `__ashrti3' fs/built-in.o: In function `fat_scan': (.text+0xecbd8): undefined reference to `__ashlti3' fs/built-in.o: In function `fat_search_long': (.text+0xeda0c): undefined reference to `__ashlti3' fs/built-in.o: In function `fat_add_entries': (.text+0xef0b4): undefined reference to `__ashlti3' fs/built-in.o: In function `fat_scan_logstart': (.text+0xef630): undefined reference to `__ashlti3' fs/built-in.o: In function `fat_free_clusters': (.text+0xf0a78): undefined reference to `__ashlti3' fs/built-in.o:(.text+0xf0a94): more undefined references to `__ashlti3' follow fs/built-in.o: In function `fat_get_block': inode.c:(.text+0xf23d4): undefined reference to `__ashrti3' inode.c:(.text+0xf2644): undefined reference to `__ashlti3' fs/built-in.o: In function `__fat_write_inode': inode.c:(.text+0xf2894): undefined reference to `__ashrti3' fs/built-in.o: In function `__fat_nfs_get_inode': nfs.c:(.text+0xf65cc): undefined reference to `__ashrti3' fs/built-in.o: In function `proc_kcore_init': kcore.c:(.init.text+0x254c): undefined reference to `__ashlti3' block/built-in.o: In function `blk_mq_init_rq_map': blk-mq.c:(.text+0x13670): undefined reference to `__ashlti3' lib/built-in.o: In function `__kfifo_alloc': (.text+0xa0c4): undefined reference to `__ashlti3' lib/built-in.o: In function `bucket_table_alloc': rhashtable.c:(.text+0xdb90): undefined reference to `__ashlti3' drivers/built-in.o: In function `dma_common_contiguous_remap': (.text+0x46dac): undefined reference to `__ashlti3' drivers/built-in.o:at24.c:(.text+0x4c6b4): more undefined references to `__ashlti3' follow drivers/built-in.o: In function `allocate_partition': mtdpart.c:(.text+0x87850): undefined reference to `__ashrti3' net/built-in.o: In function `alloc_skb_with_frags': (.text+0x10b0c): undefined reference to `__ashlti3' net/built-in.o: In function `ethtool_get_sset_info': ethtool.c:(.text+0x2cb8c): undefined reference to `__ashlti3' net/built-in.o: In function `inet_ehash_locks_alloc': (.text+0x72288): undefined reference to `__ashlti3' net/built-in.o: In function `tcp_net_metrics_init': tcp_metrics.c:(.text+0x96a3c): undefined reference to `__ashlti3' Makefile:922: recipe for target 'vmlinux' failed make: *** [vmlinux] Error 1
Created attachment 430032 [details] most recent config file config for above build output
Okay, I went back to the defconfig and did mrproper (again) and now it's much shorter, and with new symbols. This is strictly the cavium_octeon_defconfig with the pax patch applied/enabled (and the couple of patches you posted here). CC net/sunrpc/auth_gss/gss_generic_token.o CC net/ipv4/ipconfig.o LD net/sunrpc/sunrpc.o CC net/sunrpc/auth_gss/gss_mech_switch.o CC net/sunrpc/auth_gss/svcauth_gss.o CC net/ipv4/inet_diag.o CC net/sunrpc/auth_gss/gss_rpc_upcall.o CC net/sunrpc/auth_gss/gss_rpc_xdr.o CC net/ipv4/tcp_diag.o CC net/ipv4/tcp_cubic.o CC net/ipv4/xfrm4_policy.o CC net/ipv4/xfrm4_state.o CC net/ipv4/xfrm4_input.o LD net/sunrpc/auth_gss/auth_rpcgss.o LD net/sunrpc/auth_gss/built-in.o LD net/sunrpc/built-in.o CC net/ipv4/xfrm4_output.o CC net/ipv4/xfrm4_protocol.o LD net/ipv4/built-in.o LD net/built-in.o LINK vmlinux LD vmlinux.o MODPOST vmlinux.o WARNING: modpost: Found 3005 writable function pointer(s). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o mm/built-in.o: In function `huge_page_size': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/hugetlb.h:383: undefined reference to `__ashlti3' mm/built-in.o: In function `__roundup_pow_of_two': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/log2.h:63: undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_max_size': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/super.c:2332: undefined reference to `__ashlti3' fs/built-in.o: In function `ext4_mb_normalize_request': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/mballoc.c:3088: undefined reference to `__ashrti3' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/mballoc.c:3101: undefined reference to `__ashrti3' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/mballoc.c:3102: undefined reference to `__ashrti3' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/mballoc.c:3093: undefined reference to `__ashrti3' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/mballoc.c:3097: undefined reference to `__ashlti3' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/ext4/mballoc.c:3098: undefined reference to `__ashlti3' fs/built-in.o: In function `proc_kcore_init': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/proc/kcore.c:638: undefined reference to `__ashlti3' drivers/built-in.o: In function `mtd_div_by_eb': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/mtd/mtd.h:325: undefined reference to `__ashrti3' net/built-in.o: In function `tcp_net_metrics_init': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/net/ipv4/tcp_metrics.c:1149: undefined reference to `__ashlti3' Makefile:933: recipe for target 'vmlinux' failed make: *** [vmlinux] Error 1
Created attachment 430034 [details] defconfig plus pax Check the toolchain config, maybe it's a linker issue?
by result i meant the .s file, not the make output ;). anyway, with your latest config it seems that kernel/sys.c is clean, so let's see fs/ext4/super.s and fs/ext4/mballoc.s instead. also can you try to disable the size overflow plugin to see if these 128 bit shifts go away then?
Okay, first breakfast then more testing... And I kind of expect the latter to go away if I disable the overflow setting, but there aren't many options left in the mips pax config and I was hoping to keep them all enabled.
Created attachment 430856 [details] super.c generated from super.s I'm assuming this is what you wanted; all specific *.s compiles are clean like previous one.
Created attachment 430858 [details] generated super.s mballoc.s and sys.s Sorry, should've been the other way 'round... And... generated source files too big.
thanks, the problem is due to the size overflow instrumentation and the kernel not (yet) providing 128 bit shift helpers. i'll see if i can cook up something, in the meantime you'll have to disable the size overflow config option.
Created attachment 430914 [details, diff] add ashrti3/ashlti3 helpers to mips can you try the attached patch on top of the rest? (with the size overflow plugin enabled this time)
kernel and modules build with simple config, albeit with a few warnings and messages about "function foo missing from hash table" or some such; I'll have to a clean build and capture the output. On a related note, seems like one of the patches broke cupsets cgroups module; kernel won't build with that enabled (undefined refs). Checking a more useful config now, so far only cpusets broke.
Oops, it killed the kernel: CPU1 revision is: 000d0601 (Cavium Octeon+) Brought up 2 CPUs devtmpfs: initialized clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns NET: Registered protocol family 16 Not in host mode, PCI Controller not initialized vgaarb: loaded SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb clocksource: Switched to clocksource OCTEON_CVMCOUNT PAX: size overflow detected in function kcore_update_ram fs/proc/kcore.c:130 cicus.296_73 max, count: 81, decl: size; num: 0; context: proc_dir_entry; CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.0-dirty #4 Stack : 0000000000000038 ffffffff8194c85a 0000000000000000 ffffffff81182a24 0000000000000000 0000000000000000 0000000000000038 ffffffff811834dc 0000000000000001 0000000000000000 0000000000000000 0000000000000001 ffffffff81880000 ffffffff81950000 0000000000000000 000000000000000b 0000000000000096 0000000000000000 ffffffff81183718 ffffffff817207c8 800000041e858000 0000000000000000 0000000000000001 ffffffff81947af8 ffffffff81830000 ffffffff8191a868 000000ff92ad65a1 ffffffff811c8e0c ffffffff81880000 800000041e83fb60 000000000000fc00 ffffffff813c4fc0 ffffffff81718590 ffffffff8118423c 000000000000004f ffffffff81718590 0000000000000000 ffffffff81121f74 0000000000000000 0000000000000000 ... Call Trace: [<ffffffff81121f74>] show_stack+0x50/0x84 [<ffffffff813c4fc0>] dump_stack+0x80/0xe0 [<ffffffff8123daa4>] report_size_overflow+0x30/0x38 [<ffffffff812a6840>] kcore_update_ram+0x170/0x1a0 [<ffffffff818edb40>] proc_kcore_init+0x164/0x1a8 [<ffffffff81100594>] do_one_initcall+0x100/0x1bc [<ffffffff818c497c>] kernel_init_freeable+0x21c/0x394 [<ffffffff816475e4>] kernel_init+0x10/0xfc [<ffffffff8111cacc>] ret_from_kernel_thread+0x14/0x1c note: swapper/0[1] exited with preempt_count 1 Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
(In reply to Steve Arnold from comment #26) > kernel and modules build with simple config, albeit with a few warnings and > messages about "function foo missing from hash table" or some such; I'll > have to a clean build and capture the output. those are messages from the overflow plugin that indicate missed opportunities for instrumentation. if you can upload the logs we'll incorporate them. > On a related note, seems like one of the patches broke cupsets cgroups > module; kernel won't build with that enabled (undefined refs). Checking a > more useful config now, so far only cpusets broke. do you have logs about it?
(In reply to Steve Arnold from comment #27) > PAX: size overflow detected in function kcore_update_ram fs/proc/kcore.c:130 cicus.296_73 max, > count: 81, decl: size; num: 0; context: proc_dir_entry; this is a kernel problem where a size_t is converted to a loff_t which can't represent all values of size_t (i wonder if mips should define kc_vaddr_to_offset). can you post the output of "readelf -eW /proc/kcore" on a normal kernel?
# readelf -eW /proc/kcore ELF Header: Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: CORE (Core file) Machine: MIPS R3000 Version: 0x1 Entry point address: 0x0 Start of program headers: 64 (bytes into file) Start of section headers: 0 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 7 Size of section headers: 0 (bytes) Number of section headers: 0 Section header string table index: 0 There are no sections in this file. Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align NOTE 0x0001c8 0x0000000000000000 0x0000000000000000 0x001024 0x000000 0 LOAD 0x7fffffff80002000 0xffffffff80000000 0x0000000000000000 0x7ffffffc 0x7ffffffc RWE 0x1000 LOAD 0x4000000000004000 0xc000000000002000 0x0000000000000000 0x000000feffffe000 0x000000feffffe000 RWE 0x1000 LOAD 0x1102000 0x8000000001100000 0x0000000000000000 0x1770000 0x1770000 RWE 0x1000 LOAD 0x2902000 0x8000000002900000 0x0000000000000000 0x5800000 0x5800000 RWE 0x1000 LOAD 0x8202000 0x8000000008200000 0x0000000000000000 0x7c00000 0x7c00000 RWE 0x1000 LOAD 0x0000000410002000 0x8000000410000000 0x0000000000000000 0xfc00000 0xfc00000 RWE 0x1000
(In reply to Steve Arnold from comment #30) > Program Headers: > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align > LOAD 0x7fffffff80002000 0xffffffff80000000 0x0000000000000000 0x7ffffffc 0x7ffffffc RWE 0x1000 this is the problematic PT_LOAD segment as its end address crosses LONG_MAX (0x8000000000001ffc) and cannot be represented by a loff_t. i wonder, since this is barely 'wrong', what does this range represent and more importantly, could it be fixed/changed to not cause a signed integer overflow? can you ask some mips maintainers perhaps?
Created attachment 431300 [details] cgroups cpusets enabled fail log
Created attachment 431302 [details] pax enabled no cpusets successful build log Note this kernel doesn't boot with the following config either.
Created attachment 431304 [details] kernel config all pax enabled no cpusets
(In reply to Steve Arnold from comment #32) > Created attachment 431300 [details] > cgroups cpusets enabled fail log i don't see how PaX could cause this, if CONFIG_CPUSETS is enabled then kernel/cpuset.c will be compiled as well (it wasn't according to your log) which has the definition of cpuset_init among others. are you sure that you built from a clean tree and didn't mix object files from different configs?
(In reply to PaX Team from comment #31) > LOAD 0x7fffffff80002000 0xffffffff80000000 0x0000000000000000 0x7ffffffc 0x7ffffffc RWE 0x1000 so this is CKSEG0 added by arch/mips/mm/init.c:mem_init and since mips doesn't define its own kc_vaddr_to_offset translation, PAGE_OFFSET is used to convert it to a file offset and trigger a signed overflow later. given that this kclist_add call already fakes the segment's size, i guess i could fake it a bit more to avoid the overflow on the file offset as well. can you try this and see if it helps: --- a/arch/mips/mm/init.c 2015-11-03 01:48:52.379329663 +0100 +++ b/arch/mips/mm/init.c 2016-04-21 00:39:30.749834361 +0200 @@ -468,10 +468,10 @@ #ifdef CONFIG_64BIT if ((unsigned long) &_text > (unsigned long) CKSEG0) - /* The -4 is a hack so that user tools don't have to handle + /* The -0x2000-4 is a hack so that user tools don't have to handle the overflow. */ kclist_add(&kcore_kseg0, (void *) CKSEG0, - 0x80000000 - 4, KCORE_TEXT); + 0x80000000 - 0x2000 - 4, KCORE_TEXT); #endif } #endif /* !CONFIG_NEED_MULTIPLE_NODES */
I like the way you think... I'll test it right after the afternoon mtg.
Mrproper should clean things up, but it still fails with cpuset: LD [M] drivers/usb/storage/ums-realtek.o LD [M] drivers/usb/storage/ums-sddr55.o LD [M] drivers/usb/storage/ums-sddr09.o LD [M] drivers/usb/storage/ums-usbat.o LD drivers/usb/built-in.o LD drivers/built-in.o LINK vmlinux LD vmlinux.o MODPOST vmlinux.o WARNING: modpost: Found 3456 writable function pointer(s). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o init/built-in.o: In function `start_kernel': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/init/main.c:676: undefined reference to `cpuset_init' init/built-in.o: In function `do_basic_setup': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/init/main.c:889: undefined reference to `cpuset_init_smp' kernel/built-in.o: In function `select_fallback_rq': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/kernel/sched/core.c:1587: undefined reference to `cpuset_cpus_allowed_fallback' kernel/built-in.o: In function `sched_setaffinity': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/kernel/sched/core.c:4444: undefined reference to `cpuset_cpus_allowed' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/kernel/sched/core.c:4468: undefined reference to `cpuset_cpus_allowed' kernel/built-in.o: In function `cpuset_cpu_active': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/kernel/sched/core.c:7267: undefined reference to `cpuset_update_active_cpus' kernel/built-in.o: In function `cpuset_cpu_inactive': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/kernel/sched/core.c:7298: undefined reference to `cpuset_update_active_cpus' kernel/built-in.o:(.rodata+0x3558): undefined reference to `cpuset_cgrp_subsys' mm/built-in.o: In function `get_page_from_freelist': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/page_alloc.c:2539: undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `atomic_read': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/./arch/mips/include/asm/atomic.h:51: undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `cpuset_node_allowed': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/cpuset.h:55: undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `__perform_reclaim': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/page_alloc.c:2867: undefined reference to `cpuset_memory_pressure_enabled' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/page_alloc.c:2867: undefined reference to `cpuset_memory_pressure_enabled' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/page_alloc.c:2867: undefined reference to `__cpuset_memory_pressure_bump' mm/built-in.o: In function `wakeup_kswapd': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/vmscan.c:3515: undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `atomic_read': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/./arch/mips/include/asm/atomic.h:51: undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `cpuset_node_allowed': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/cpuset.h:55: undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `atomic_read': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/./arch/mips/include/asm/atomic.h:51: undefined reference to `cpusets_enabled_key' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/./arch/mips/include/asm/atomic.h:51: undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `cpuset_node_allowed': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/cpuset.h:55: undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `atomic_read': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/./arch/mips/include/asm/atomic.h:51: undefined reference to `cpusets_enabled_key' /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/./arch/mips/include/asm/atomic.h:51: undefined reference to `cpusets_enabled_key' mm/built-in.o: In function `cpuset_node_allowed': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/include/linux/cpuset.h:55: undefined reference to `__cpuset_node_allowed' mm/built-in.o: In function `build_all_zonelists_init': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/page_alloc.c:4383: undefined reference to `cpuset_init_current_mems_allowed' mm/built-in.o: In function `dump_header': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/mm/oom_kill.c:393: undefined reference to `cpuset_print_current_mems_allowed' mm/built-in.o:(__jump_table+0x70): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x88): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x118): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x148): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x160): undefined reference to `cpusets_enabled_key' mm/built-in.o:(__jump_table+0x670): more undefined references to `cpusets_enabled_key' follow fs/built-in.o: In function `proc_pid_status': /home/sarnold/my_stuff/home/hardware/Edge/gentoo/linux/fs/proc/array.c:385: undefined reference to `cpuset_task_status_allowed' fs/built-in.o:(.rodata+0x4a80): undefined reference to `proc_cpuset_show' fs/built-in.o:(.rodata+0x52f8): undefined reference to `proc_cpuset_show' Makefile:933: recipe for target 'vmlinux' failed make: *** [vmlinux] Error 1
Aaaand... with cpuset disabled (otherwise config is the same) it all compiles but the kernel still does not boot: Looking for valid bootloader image.... Jumping to start of image at address 0xbfc80000 U-Boot 1.1.1 (UBNT Build ID: 4493936-g009d77b) (Build time: Sep 20 2012 - 15:48:51) BIST check passed. UBNT_E100 r1:2, r2:14, serial #: DC9FDB289600 Core clock: 500 MHz, DDR clock: 266 MHz (532 Mhz data rate) DRAM: 512 MB Clearing DRAM....... done Flash: 4 MB Net: octeth0, octeth1, octeth2 USB: (port 0) scanning bus for devices... 1 USB Devices found scanning bus for storage devices... Device 0: Vendor: SanDisk Prod.: Cruzer Fit Rev: 1.27 Type: Removable Hard Disk Capacity: 29812.5 MB = 29.1 GB (61056064 x 512) 0 reading vmlinux.64 ...................................................... 10982744 bytes read argv[2]: coremask=0x3 argv[3]: endbootargs ELF file is 64 bit Allocating memory for ELF segment: addr: 0xffffffff81100000 (adjusted to: 0x1100000), size 0x27663b0 Allocated memory for ELF segment: addr: 0xffffffff81100000, size 0x27663b0 Processing PHDR 0 Loading a77e00 bytes at ffffffff81100000 Clearing 1cee5b0 bytes at ffffffff81b77e00 ## Loading Linux kernel with entry point: 0xffffffff8172cfd0 ... Bootloader: Done loading app on coremask: 0x3 Initializing cgroup subsys cpu Initializing cgroup subsys cpuacct Linux version 4.4.0-dirty (sarnold@rama) (gcc version 5.3.0 (Gentoo Hardened 5.3.0 p1.0, pie-0.6.5) ) #2 SMP PREEMPT Thu Apr 28 15:59:06 PDT 2016 CVMSEG size: 2 cache lines (256 bytes) bootconsole [early0] enabled CPU0 revision is: 000d0601 (Cavium Octeon+) Checking for the multiply/shift bug... no. Checking for the daddiu bug... no. Determined physical RAM map: memory: 0000000004800000 @ 0000000003900000 (usable) memory: 0000000007c00000 @ 0000000008200000 (usable) memory: 000000000fc00000 @ 0000000410000000 (usable) memory: 00000000027663b0 @ 0000000001100000 (usable) Wasting 278528 bytes for tracking 4352 unused pages Initrd not found or empty - disabling initrd Using internal Device Tree. software IO TLB [mem 0x08200000-0x0c200000] (64MB) mapped at [8000000008200000-800000000c1fffff] Zone ranges: DMA32 [mem 0x0000000001100000-0x00000000efffffff] Normal [mem 0x00000000f0000000-0x000000041fbfffff] Movable zone start for each node Early memory node ranges node 0: [mem 0x0000000001100000-0x0000000003865fff] node 0: [mem 0x0000000003900000-0x00000000080fffff] node 0: [mem 0x0000000008200000-0x000000000fdfffff] node 0: [mem 0x0000000410000000-0x000000041fbfffff] Initmem setup node 0 [mem 0x0000000001100000-0x000000041fbfffff] cma: Reserved 64 MiB at 0x000000041bc00000 Primary instruction cache 32kB, virtually tagged, 4 way, 64 sets, linesize 128 bytes. Primary data cache 16kB, 64-way, 2 sets, linesize 128 bytes. PERCPU: Embedded 16 pages/cpu @800000000c2fb000 s28160 r8192 d29184 u65536 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 122824 Kernel command line: root=/dev/sda2 rootwait rw mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@1024k(eeprom) console=ttyS0,115200 net.ifnames=0 cma=64M rootfstype=ext4 fixrtc PID hash table entries: 2048 (order: 2, 16384 bytes) Dentry cache hash table entries: 65536 (order: 7, 524288 bytes) Inode-cache hash table entries: 32768 (order: 6, 262144 bytes) Memory: 317516K/499096K available (6368K kernel code, 843K rwdata, 2668K rodata, 812K init, 29592K bss, 116044K reserved, 65536K cma-reserved) SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 Running RCU self tests Preemptible hierarchical RCU implementation. RCU lockdep checking is enabled. Build-time adjustment of leaf fanout to 64. RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=2. RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2 NR_IRQS:512 clocksource: OCTEON_CVMCOUNT: mask: 0xffffffffffffffff max_cycles: 0xe6a171a037, max_idle_ns: 881590485102 ns Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar ... MAX_LOCKDEP_SUBCLASSES: 8 ... MAX_LOCK_DEPTH: 48 ... MAX_LOCKDEP_KEYS: 8191 ... CLASSHASH_SIZE: 4096 ... MAX_LOCKDEP_ENTRIES: 32768 ... MAX_LOCKDEP_CHAINS: 65536 ... CHAINHASH_SIZE: 32768 memory used by lock dependency info: 8159 kB per task-struct memory footprint: 1920 bytes Calibrating delay loop (skipped) preset value.. 1000.00 BogoMIPS (lpj=5000000) pid_max: default: 32768 minimum: 501 Security Framework initialized Mount-cache hash table entries: 1024 (order: 1, 8192 bytes) Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes) Initializing cgroup subsys io Initializing cgroup subsys memory Initializing cgroup subsys devices Initializing cgroup subsys freezer Initializing cgroup subsys hugetlb Initializing cgroup subsys pids Checking for the daddi bug... no. ftrace: allocating 18531 entries in 73 pages SMP: Booting CPU01 (CoreId 1)... CPU1 revision is: 000d0601 (Cavium Octeon+) Brought up 2 CPUs devtmpfs: initialized clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns prandom: seed boundary self test passed prandom: 100 self tests passed NET: Registered protocol family 16 Not in host mode, PCI Controller not initialized vgaarb: loaded SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb random: nonblocking pool is initialized INFO: task swapper/0:1 blocked for more than 120 seconds. Not tainted 4.4.0-dirty #2 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. swapper/0 D ffffffff8172eb34 0 1 0 0x00100000 Stack : 0000000000000000 ffffffff81a20000 0000000000000000 ffffffff81b8f558 7fffffffffffffff 7fffffffffffffff 800000041b887c30 ffffffff81a20000 ffffffff81a20000 0000000000000000 0000000000000000 ffffffff81b2a968 ffffe4a954c314d9 ffffffff8172eb34 800000041b887c48 ffffffff81733784 0000000000000002 0000000000000007 800000041b8b0000 0000c00000000000 0000000000000006 800000041b8b07d8 0000000000000000 ffffffff81b2a968 ffffe4a954c314d9 ffffffff8119f008 0000000000000000 800000041b8b0000 ffffffff81734acc b95bc24aa1ab45ff 800000041b887c28 7fffffffffffffff 800000041b887c30 ffffffff81a20000 0000000000000002 0000000000000000 0000000000000000 ffffffff81b2a968 ffffe4a954c314d9 ffffffff8172f7b8 ... Call Trace: [<ffffffff8172e4f8>] __schedule+0x8cc/0xd18 [<ffffffff8172eb34>] schedule+0x78/0x94 [<ffffffff81733784>] schedule_timeout+0x64/0x358 [<ffffffff8172f7b8>] wait_for_common+0x168/0x1b8 [<ffffffff811f6978>] __stop_cpus+0x64/0xa0 [<ffffffff811f6f94>] stop_cpus+0x4c/0x74 [<ffffffff811f70e4>] stop_machine+0x128/0x168 [<ffffffff811cdb78>] timekeeping_notify+0x48/0x70 [<ffffffff811d00ec>] __clocksource_select+0x12c/0x174 [<ffffffff81acfd74>] clocksource_done_booting+0x68/0x84 [<ffffffff811005c4>] do_one_initcall+0x118/0x1e4 [<ffffffff81ab6a2c>] kernel_init_freeable+0x220/0x398 [<ffffffff8172d374>] kernel_init+0x20/0x10c [<ffffffff8111dd0c>] ret_from_kernel_thread+0x14/0x1c 3 locks held by swapper/0/1: #0: (clocksource_mutex){+.+...}, at: [<ffffffff81acfd50>] clocksource_done_booting+0x44/0x84 #1: (cpu_hotplug.lock){++++++}, at: [<ffffffff81148d2c>] get_online_cpus+0x30/0xa8 #2: (stop_cpus_mutex){+.+...}, at: [<ffffffff811f6f84>] stop_cpus+0x3c/0x74
Hardened-sources is no longer supported.