lxip: 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

issue #5165
This commit is contained in:
Sebastian Sumpf 2024-03-26 19:51:53 +01:00 committed by Christian Helmuth
parent b78b2c7ac9
commit b30bacf86e
2 changed files with 43 additions and 0 deletions

View File

@ -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

View File

@ -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 <asm-generic/access_ok.h>
#endif /* _SHADOW__ASM_GENERIC_ACCESS_OK_H_ */