Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2885228pxb; Sat, 6 Feb 2021 11:00:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5wcKrx3JkHEY6z6kbnglAB35AmE7Inn4AmbvvWeA7+1KQBtRVTxWRMs4F9JHbDHB6Dnvm X-Received: by 2002:a17:906:8591:: with SMTP id v17mr9736537ejx.30.1612638052429; Sat, 06 Feb 2021 11:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612638052; cv=none; d=google.com; s=arc-20160816; b=w+K7p8sW2qiS+BhpUYjkWpF7u1GrfjlFZeEvsHJs+Hq3GVQkFd3btgg8C+fLVc7emk tg+u1NvAgpgFeuTDfxjrpENL/ZKapU5kWoZ1zREd9KjDa/uOmQUgUXUp20/s3hEOHlDy jwgeCByek77HYukkpHae4uP8NdxETMhLcsTe9BNLTtJfbXbOPviadgx24ehRNnqYTvrh jlPRzEKf6dB98Uh8iAQtHS3u3nVMlzvgkLG7JYKf9rlyQ3VRmEgo3TuH27SRh4B/ZUm2 1D2qHYvUbfrqcLQHAfND6AjrypUMVSpkC18byQJR0W09Y0y0rn7Ok+L4mjktE/CjFXtE EsRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+3K/ORZIshWIeyzZP4aoxZMdX04y5DfgexQ64BWXU8Y=; b=AXyv14fLoMV9WCgWN+7mTWI7GmLaqEq3JkshOMJjom+qPZJQy9vAGnOBRNGb9RcQdN kL1/CVk94GttTl/m6jb39G6fB30oF/3cXQnamqiZMc9mB2Db5Z88YVhNRMn0QiksqdHt o5NecEIX/0ukku6xEyuYE1mzhMB3VlEmDRosKXmV3Hy0Q8bIXHEA+4LRjAERzmFpCzAF nOhWiKkZ5pdBfZis9s2B5J+MsGi/T7R+BKveqyf59D9gksMpXofxlzCfPuJvqyvbXJD8 hz/UFnUusNPRuTQeGO1IGsB2ymYSaNBNOKlGVYgl+fQQIcLrexP5nlqwtHhWUoFcyMwk PLVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jEsf3S4L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si7980350edu.474.2021.02.06.11.00.27; Sat, 06 Feb 2021 11:00:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jEsf3S4L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbhBFSHn (ORCPT + 99 others); Sat, 6 Feb 2021 13:07:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44652 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbhBFSHj (ORCPT ); Sat, 6 Feb 2021 13:07:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612634773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+3K/ORZIshWIeyzZP4aoxZMdX04y5DfgexQ64BWXU8Y=; b=jEsf3S4LG2P/SINojbxkUZG7h5zPHLijVla47fWeo5rg1QRkXiHmmi/q9J7JaM94qzzpwC 5JweSlBYbpEKLcayDrnc9TLcKfXrJ4t761ViIBlhoNirJLAByzaNMXU1wUgjMk5NlB9iQ9 BRp6YsthZrkx+y1E5oYLpfJB7Us/g1s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-204-9Li4jnmTPJ-OOFFjEqd1hQ-1; Sat, 06 Feb 2021 13:06:11 -0500 X-MC-Unique: 9Li4jnmTPJ-OOFFjEqd1hQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 25DE5107ACC7; Sat, 6 Feb 2021 18:06:09 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.37]) by smtp.corp.redhat.com (Postfix) with SMTP id 43FA257; Sat, 6 Feb 2021 18:06:06 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sat, 6 Feb 2021 19:06:08 +0100 (CET) Date: Sat, 6 Feb 2021 19:06:05 +0100 From: Oleg Nesterov To: Ravi Bangoria 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 Message-ID: <20210206180604.GA8897@redhat.com> References: <20210204104703.273429-1-ravi.bangoria@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210204104703.273429-1-ravi.bangoria@linux.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.