arm64: set 32-bit compatible TASK_SIZE_MAX to fix U32 libc_write_01 error
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8JVJ3 CVE: NA ------------------------------- In U32 mode, the testcase libc_write_01 failed as below: [INFO][libc_write_01.c][29][main]:ret=4093 [INFO][libc_write_01.c][30][main]:size_max=-1 libc_write_01_u32: libc_write_01.c:31: main: Assertion `ret==-1' failed. Aborted The error here is due to the __range_ok check of "addr + size <= TASK_SIZE_MAX" is not performed as expectation. For U32 testcase libc_write_01, the specified "addr + size" is greater than 32-bit limit and should return -EFAULT, but TASK_SIZE_MAX still defined as UL(1) << VA_BITS in U32 mode, which is much greater than "addr + size" and cannot catch the overflow error. Fix above testcase failure by defining TASK_SIZE_MAX as 32-bit limit. Since is_compat_task() check leads to performance reduction by 4.89% on libMicro, the fix is wrapped by CONFIG_COMPAT_TASK_SIZE with default n. The performance will not be affected unless open this config manually. Fixes: cb478b93 ("arm64: replace is_compat_task() with is_ilp32_compat_task() in TASK_SIZE_MAX") Signed-off-by:Chen Jiahao <chenjiahao16@huawei.com> Signed-off-by:
Jinjie Ruan <ruanjinjie@huawei.com>
Loading
Please sign in to comment