Re: [PATCH] usercopy: delete __noreturn from usercopy_abort

From: Jiangfeng Xiao
Date: Mon Mar 04 2024 - 21:56:24 EST




On 2024/3/4 23:15, Jann Horn wrote:
> On Mon, Mar 4, 2024 at 3:02 AM Jiangfeng Xiao <xiaojiangfeng@xxxxxxxxxx> wrote:
>> When the last instruction of a noreturn function is a call
>> to another function, the return address falls outside
>> of the function boundary. This seems to cause kernel
>> to interrupt the backtrace.
> [...]
>> Delete __noreturn from usercopy_abort,
>
> This sounds like the actual bug is in the backtracing logic? I don't
> think removing __noreturn annotations from an individual function is a
> good fix, since the same thing can happen with other __noreturn
> functions depending on what choices the compiler makes.
> .
>
Yes, you make a point. This may be a bug is in the backtracing logic, but
the kernel backtracing always parses symbols using (lr) instead of (lr-4).
This may be due to historical reasons or more comprehensive considerations.
In addition, modifying the implementation logic of the kernel backtracing
has a great impact. Therefore, I do not dare to modify the implementation
logic of the kernel backtracing.

Not all noreturn functions are ended with calling other functions.
Therefore, only a few individual functions may have the same problem.
In addition, deleting '__noreturn' from usercopy_abort does not
change the internal behavior of usercopy_abort function.
Therefore, there is no risk. Deleting '__noreturn' from usercopy_abort
is the solution that I can think of with minimal impact and minimum risk.

If you will submit a better patch to solve this problem,
I would like to learn from you. Thank you.