Commit 880fd21c authored by Chen Jiahao's avatar Chen Jiahao Committed by Jinjie Ruan
Browse files

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: default avatarChen Jiahao <chenjiahao16@huawei.com>
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
parent a1bf0bff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment