[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yyhyap+Xi3UtV+T0@hirez.programming.kicks-ass.net>
Date: Mon, 19 Sep 2022 15:45:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: guoren@...nel.org
Cc: arnd@...db.de, palmer@...osinc.com, tglx@...utronix.de,
luto@...nel.org, conor.dooley@...rochip.com, heiko@...ech.de,
jszhang@...nel.org, lazyparser@...il.com, falcon@...ylab.org,
chenhuacai@...nel.org, apatel@...tanamicro.com,
atishp@...shpatra.org, palmer@...belt.com,
paul.walmsley@...ive.com, mark.rutland@....com,
zouyipeng@...wei.com, bigeasy@...utronix.de,
David.Laight@...lab.com, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
Guo Ren <guoren@...ux.alibaba.com>, keescook@...omium.org
Subject: Re: [PATCH V5 08/11] riscv: Support HAVE_IRQ_EXIT_ON_IRQ_STACK
On Sun, Sep 18, 2022 at 11:52:43AM -0400, guoren@...nel.org wrote:
> +ENTRY(call_on_stack)
> + /* Create a frame record to save our ra and fp */
> + addi sp, sp, -RISCV_SZPTR
> + REG_S ra, (sp)
> + addi sp, sp, -RISCV_SZPTR
> + REG_S fp, (sp)
> +
> + /* Save sp in fp */
> + move fp, sp
> +
> + /* Move to the new stack and call the function there */
> + li a3, IRQ_STACK_SIZE
> + add sp, a1, a3
> + jalr a2
> +
> + /*
> + * Restore sp from prev fp, and fp, ra from the frame
> + */
> + move sp, fp
> + REG_L fp, (sp)
> + addi sp, sp, RISCV_SZPTR
> + REG_L ra, (sp)
> + addi sp, sp, RISCV_SZPTR
> + ret
> +ENDPROC(call_on_stack)
IIRC x86_64 moved away from a stack-switch function like this because it
presents a convenient exploit gadget.
I'm not much of an exploit writer and I've no idea how effective our
inline stategy is, perhaps other can comment.
Powered by blists - more mailing lists