I ran in to a couple problems building with grsec and 4.3.3 for arm5. It's probably easiest to explain with the errors and patches I hacked up to fix it.
- Code: Select all
In file included from /mnt/scratch/fixes/linux-4.3.3/include/linux/atomic.h:4:0,
from /mnt/scratch/fixes/linux-4.3.3/include/linux/spinlock.h:417,
from /mnt/scratch/fixes/linux-4.3.3/include/linux/seqlock.h:35,
from /mnt/scratch/fixes/linux-4.3.3/include/linux/time.h:5,
from /mnt/scratch/fixes/linux-4.3.3/include/uapi/linux/timex.h:56,
from /mnt/scratch/fixes/linux-4.3.3/include/linux/timex.h:56,
from /mnt/scratch/fixes/linux-4.3.3/include/linux/sched.h:19,
from /mnt/scratch/fixes/linux-4.3.3/arch/arm/kernel/asm-offsets.c:14:
/mnt/scratch/fixes/linux-4.3.3/arch/arm/include/asm/atomic.h: In function ‘atomic_inc_and_test_unchecked’:
/mnt/scratch/fixes/linux-4.3.3/arch/arm/include/asm/atomic.h:326:9: error: implicit declaration of function ‘atomic_add_return_unchecked_relaxed’ [-Werror=implicit-function-declaration]
return atomic_add_return_unchecked_relaxed(1, v) == 0;
^
There is probably a more elegant fix, assuming this isn't just outright wrong:
- Code: Select all
--- linux-4.3.3/arch/arm/include/asm/atomic.h 2015-12-27 01:57:10.042670349 -0600
+++ /mnt/scratch/linux-4.3.3/arch/arm/include/asm/atomic.h 2015-12-27 01:58:20.369607745 -0600
@@ -323,13 +323,21 @@
#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0)
static inline int atomic_inc_and_test_unchecked(atomic_unchecked_t *v)
{
+#if __LINUX_ARM_ARCH__ >= 6
return atomic_add_return_unchecked_relaxed(1, v) == 0;
+#else
+ return atomic_add_return_unchecked(1, v) == 0;
+#endif
}
#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
#define atomic_inc_return(v) (atomic_add_return(1, v))
static inline int atomic_inc_return_unchecked(atomic_unchecked_t *v)
{
+#if __LINUX_ARM_ARCH__ >= 6
return atomic_add_return_unchecked_relaxed(1, v);
+#else
+ return atomic_add_return_unchecked(1, v);
+#endif
}
#define atomic_dec_return(v) (atomic_sub_return(1, v))
#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
Also this
- Code: Select all
In file included from /mnt/scratch/fixes/linux-4.3.3/arch/arm/include/asm/uaccess.h:18:0,
from /mnt/scratch/fixes/linux-4.3.3/include/linux/uaccess.h:5,
from /mnt/scratch/fixes/linux-4.3.3/arch/arm/kernel/ptrace.c:22:
/mnt/scratch/fixes/linux-4.3.3/arch/arm/include/asm/uaccess.h: In function ‘set_fs’:
/mnt/scratch/fixes/linux-4.3.3/arch/arm/include/asm/uaccess.h:103:36: error: ‘DOMAIN_KERNELCLIENT’ undeclared (first use in this function)
modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_KERNELCLIENT : DOMAIN_MANAGER);
^
I think may have been a mistake here?
- Code: Select all
--- linux-4.3.3/arch/arm/include/asm/domain.h 2015-12-27 01:50:09.544023866 -0600
+++ /mnt/scratch/linux-4.3.3/arch/arm/include/asm/domain.h 2015-12-26 16:09:01.330864530 -0600
@@ -69,9 +69,9 @@
#define DOMAIN_USERCLIENT 1
#define DOMAIN_VECTORS DOMAIN_USER
#endif
-#define DOMAIN_KERNELCLIENT 1
#endif
+#define DOMAIN_KERNELCLIENT 1
#define domain_mask(dom) ((3) << (2 * (dom)))
#define domain_val(dom,type) ((type) << (2 * (dom)))
I've only just started running a kernel with the above changes, it hasn't blown up yet. I hope this is helpful. And thanks!