[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2ba0bee2-972a-0374-8ec8-75a91e1217b4@loongson.cn>
Date: Thu, 24 Oct 2024 17:03:12 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Huacai Chen <chenhuacai@...nel.org>, Josh Poimboeuf
<jpoimboe@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
loongarch@...ts.linux.dev, bpf <bpf@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 4/6] bpf, core: Add weak arch_prepare_goto()
On 10/16/2024 02:36 AM, Alexei Starovoitov wrote:
> On Tue, Oct 15, 2024 at 4:50 AM Tiezhu Yang <yangtiezhu@...ngson.cn> wrote:
>>
>> The objtool program needs to analysis the control flow of each
>> object file generated by compiler toolchain, it needs to know
>> all the locations that a branch instruction may jump into.
...
>> + arch_prepare_goto();
>> goto *jumptable[insn->code];
>
> That looks fragile. There is no guarantee that compiler will keep
> asm statement next to indirect goto.
> It has all rights to move/copy such goto around.
> There are other parts in the kernel which are not annotated either:
> drm_exec_retry_on_contention(),
> drivers/misc/lkdtm/cfi.c
>
> You're arguing that it's hard to properly in the compiler,
> but that's the only option. It has to be done by the compiler.
Thank you very much for your reply. I will drop this patch
and try to find a proper way to handle this case.
By the way, I spent more time to test and analysis with gcc
and clang on x86 and loongarch, it needs to fix some corner
issues for the other patches compiled with clang.
Anyway, I will submit v2 series without changing bpf file,
patch #4 and patch #5 will be removed.
Thanks,
Tiezhu
Powered by blists - more mailing lists