All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: mpe@ellerman.id.au, rostedt@goodmis.org, paulus@samba.org,
	jniethe5@gmail.com, naveen.n.rao@linux.ibm.com,
	sandipan@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] powerpc/uprobes: Validation for prefixed instruction
Date: Sat, 6 Feb 2021 19:06:05 +0100	[thread overview]
Message-ID: <20210206180604.GA8897@redhat.com> (raw)
In-Reply-To: <20210204104703.273429-1-ravi.bangoria@linux.ibm.com>

On 02/04, Ravi Bangoria wrote:
>
> +static int get_instr(struct mm_struct *mm, unsigned long addr, u32 *instr)
> +{
> +	struct page *page;
> +	struct vm_area_struct *vma;
> +	void *kaddr;
> +	unsigned int gup_flags = FOLL_FORCE | FOLL_SPLIT_PMD;
> +
> +	if (get_user_pages_remote(mm, addr, 1, gup_flags, &page, &vma, NULL) <= 0)
> +		return -EINVAL;

"vma" is not used, and I don't think you need FOLL_SPLIT_PMD.

Otherwise I can't really comment this ppc-specific change.

To be honest, I don't even understand why do we need this fix. Sure, the
breakpoint in the middle of 64-bit insn won't work, why do we care? The
user should know what does he do.

Not to mention we can't really trust get_user_pages() in that this page
can be modified by mm owner or debugger...

But I won't argue.

Oleg.


WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	paulus@samba.org, sandipan@linux.ibm.com, jniethe5@gmail.com,
	naveen.n.rao@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] powerpc/uprobes: Validation for prefixed instruction
Date: Sat, 6 Feb 2021 19:06:05 +0100	[thread overview]
Message-ID: <20210206180604.GA8897@redhat.com> (raw)
In-Reply-To: <20210204104703.273429-1-ravi.bangoria@linux.ibm.com>

On 02/04, Ravi Bangoria wrote:
>
> +static int get_instr(struct mm_struct *mm, unsigned long addr, u32 *instr)
> +{
> +	struct page *page;
> +	struct vm_area_struct *vma;
> +	void *kaddr;
> +	unsigned int gup_flags = FOLL_FORCE | FOLL_SPLIT_PMD;
> +
> +	if (get_user_pages_remote(mm, addr, 1, gup_flags, &page, &vma, NULL) <= 0)
> +		return -EINVAL;

"vma" is not used, and I don't think you need FOLL_SPLIT_PMD.

Otherwise I can't really comment this ppc-specific change.

To be honest, I don't even understand why do we need this fix. Sure, the
breakpoint in the middle of 64-bit insn won't work, why do we care? The
user should know what does he do.

Not to mention we can't really trust get_user_pages() in that this page
can be modified by mm owner or debugger...

But I won't argue.

Oleg.


  parent reply	other threads:[~2021-02-06 18:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 10:47 [PATCH v2] powerpc/uprobes: Validation for prefixed instruction Ravi Bangoria
2021-02-04 10:47 ` Ravi Bangoria
2021-02-04 10:49 ` Ravi Bangoria
2021-02-04 10:49   ` Ravi Bangoria
2021-02-04 13:15   ` Naveen N. Rao
2021-02-04 13:15     ` Naveen N. Rao
2021-02-08 11:08     ` Ravi Bangoria
2021-02-08 11:08       ` Ravi Bangoria
2021-02-04 14:19   ` Ananth N Mavinakayanahalli
2021-02-04 13:08 ` Naveen N. Rao
2021-02-04 13:08   ` Naveen N. Rao
2021-02-04 16:12   ` Naveen N. Rao
2021-02-04 16:12     ` Naveen N. Rao
2021-02-08 11:10     ` Ravi Bangoria
2021-02-08 11:10       ` Ravi Bangoria
2021-02-08 11:13   ` Ravi Bangoria
2021-02-08 11:13     ` Ravi Bangoria
2021-02-06 18:06 ` Oleg Nesterov [this message]
2021-02-06 18:06   ` Oleg Nesterov
2021-02-08 11:06   ` Ravi Bangoria
2021-02-08 11:06     ` Ravi Bangoria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210206180604.GA8897@redhat.com \
    --to=oleg@redhat.com \
    --cc=jniethe5@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=paulus@samba.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=sandipan@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.