diff --git a/repos/dde_linux/lib/mk/spec/arm_v8/lxip.mk b/repos/dde_linux/lib/mk/spec/arm_v8/lxip.mk index 349d17fcbd..909a0b4415 100644 --- a/repos/dde_linux/lib/mk/spec/arm_v8/lxip.mk +++ b/repos/dde_linux/lib/mk/spec/arm_v8/lxip.mk @@ -2,4 +2,12 @@ SPEC_ARCH := arm_v8 SRC_C += lx_emul/shadow/arch/arm64/kernel/smp.c +# +# On arm64 the uaccess.h header uses __access_ok() prior to including +# our shadow header. Since this issue affects multiple complation units +# use a global compiler flag to point to the actual function we intend +# to be used. +# +CC_OPT += -D__access_ok=___access_ok + include $(REP_DIR)/lib/mk/lxip.inc diff --git a/repos/dde_linux/src/lib/lxip/shadow/asm-generic/access_ok.h b/repos/dde_linux/src/lib/lxip/shadow/asm-generic/access_ok.h new file mode 100644 index 0000000000..cea7d1a551 --- /dev/null +++ b/repos/dde_linux/src/lib/lxip/shadow/asm-generic/access_ok.h @@ -0,0 +1,35 @@ +/* + * \brief This file shadows asm-generic/acess_ok.h + * \author Sebastian Sumpf + * \date 2024-03-26 + */ + +/* + * Copyright (C) 2024 Genode Labs GmbH + * + * This file is distributed under the terms of the GNU General Public License + * version 2. + */ + +#ifndef _SHADOW__ASM_GENERIC_ACCESS_OK_H_ +#define _SHADOW__ASM_GENERIC_ACCESS_OK_H_ + +/* + * The IP stack checks "user" pointer access, for example, for iov's using + * 'access_ok' which in turn calls '__access_ok'. The function checks if the + * pointer is below TASK_SIZE_MAX, which is usually a big value on 64 bit + * systems, but 3GB on 32 bit systems. Because the IP stack is mostly used with + * Genode's libc, where pointers on some kernels (base-linux) can be >3GB and we + * don't want to make an additional copy of each buffer/iov interacting with the + * IP stack, we short circuit the function + */ +static inline int ___access_ok(const void *ptr, unsigned long size) +{ + return 1; +} + +#define __access_ok ___access_ok + +#include_next + +#endif /* _SHADOW__ASM_GENERIC_ACCESS_OK_H_ */