lkml.org 
[lkml]   [2020]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 13/19] x86/signal: Check if vdso_image_32 is mapped before trying to land on it
On Mon, Nov 23, 2020 at 4:29 PM Dmitry Safonov <dima@arista.com> wrote:
>
> Provide current_has_vdso_image_32() helper and check it apriory landing
> attempt on vdso vma.
> The helper is a macro, not a static inline funciton to avoid
> linux/sched/task_stack.h inclusion in asm/vdso.h.

Can you make this more general? For example:

current_has_vdso(&vdso_image_whatever)

also:

> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> index 18d8f17f755c..d9ab58cc765b 100644
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -142,11 +142,16 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
> /* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
> __visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
> {
> + unsigned long landing_pad;
> +
> + if (!current_has_vdso_image_32())
> + force_sigsegv(SIGSEGV);

Falling through seems incorrect here. I would instead write 0 to rip,
do the force_sigsegv(), and exit, making sure that exiting goes
through the correct path.

\
 
 \ /
  Last update: 2020-11-25 00:45    [W:0.149 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site