[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <07c3e17e-df5a-884a-ac5d-f38cf40f2ad9@linux.ibm.com>
Date: Thu, 17 Sep 2020 10:25:43 -0300
From: Rogerio Alves <rcardoso@...ux.ibm.com>
To: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>, mpe@...erman.id.au,
christophe.leroy@....fr
Cc: mikey@...ling.org, jniethe5@...il.com, pedromfc@...ux.ibm.com,
linux-kernel@...r.kernel.org, paulus@...ba.org,
rogealve@...ux.ibm.com, naveen.n.rao@...ux.vnet.ibm.com,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v6 3/8] powerpc/watchpoint/ptrace: Fix SETHWDEBUG when
CONFIG_HAVE_HW_BREAKPOINT=N
On 9/2/20 1:29 AM, Ravi Bangoria wrote:
> When kernel is compiled with CONFIG_HAVE_HW_BREAKPOINT=N, user can
> still create watchpoint using PPC_PTRACE_SETHWDEBUG, with limited
> functionalities. But, such watchpoints are never firing because of
> the missing privilege settings. Fix that.
>
> It's safe to set HW_BRK_TYPE_PRIV_ALL because we don't really leak
> any kernel address in signal info. Setting HW_BRK_TYPE_PRIV_ALL will
> also help to find scenarios when kernel accesses user memory.
>
> Reported-by: Pedro Miraglia Franco de Carvalho <pedromfc@...ux.ibm.com>
> Suggested-by: Pedro Miraglia Franco de Carvalho <pedromfc@...ux.ibm.com>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Tested-by: Rogerio Alves <rcardoso@...ux.ibm.com>
> ---
> arch/powerpc/kernel/ptrace/ptrace-noadv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/ptrace/ptrace-noadv.c b/arch/powerpc/kernel/ptrace/ptrace-noadv.c
> index 697c7e4b5877..57a0ab822334 100644
> --- a/arch/powerpc/kernel/ptrace/ptrace-noadv.c
> +++ b/arch/powerpc/kernel/ptrace/ptrace-noadv.c
> @@ -217,7 +217,7 @@ long ppc_set_hwdebug(struct task_struct *child, struct ppc_hw_breakpoint *bp_inf
> return -EIO;
>
> brk.address = ALIGN_DOWN(bp_info->addr, HW_BREAKPOINT_SIZE);
> - brk.type = HW_BRK_TYPE_TRANSLATE;
> + brk.type = HW_BRK_TYPE_TRANSLATE | HW_BRK_TYPE_PRIV_ALL;
> brk.len = DABR_MAX_LEN;
> if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ)
> brk.type |= HW_BRK_TYPE_READ;
>
Powered by blists - more mailing lists