Re: [PATCH bpf-next v2 1/2] bpf: Support private stack for bpf progs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 21, 2024 at 8:33 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>

> Aside from testing I agree with Andrii regarding rbp usage,
> it seems like it should be possible to do the following in prologue:
>
>     movabs $0x...,%rsp
>     add %gs:0x...,%rsp
>     push %rbp
>
> and there would be no need to modify translation for instructions
> accessing r10, plus debugger stack unrolling logic should still work?.
> Or am I mistaken?

It's not that simple.
Above sequence violates -mno-red-zone.
The part of the fix may look like:
movabs .., rax
add %gs.., rax
mov rbp, qword ptr [rax - ...]

mov rax, rsp
mox rax, rbp
sub rsp, ...

it's probably correct from mno-red-zone pov and
end result is maybe correct for stack unwind,
but if irq happens in the middle it won't crash,
but unwind will not work.
The main reason to use r9 is to have valid unwind
at any point of the prog.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux