From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752030AbdAYRod (ORCPT ); Wed, 25 Jan 2017 12:44:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbdAYRob (ORCPT ); Wed, 25 Jan 2017 12:44:31 -0500 Message-ID: <1485366269.29861.0.camel@redhat.com> Subject: Re: [PATCH 01/12] uprobes: split THPs before trying replace them From: Rik van Riel To: Srikar Dronamraju , "Kirill A. Shutemov" Cc: Andrew Morton , "Kirill A. Shutemov" , Andrea Arcangeli , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oleg Nesterov , Peter Zijlstra Date: Wed, 25 Jan 2017 12:44:29 -0500 In-Reply-To: <20170125165522.GA11569@linux.vnet.ibm.com> References: <20170124162824.91275-1-kirill.shutemov@linux.intel.com> <20170124162824.91275-2-kirill.shutemov@linux.intel.com> <20170124132849.73135e8c6e9572be00dbbe79@linux-foundation.org> <20170124222217.GB19920@node.shutemov.name> <20170125165522.GA11569@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-nf7sxNz0ss/8KVmzHIUD" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 25 Jan 2017 17:44:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-nf7sxNz0ss/8KVmzHIUD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2017-01-25 at 08:55 -0800, Srikar Dronamraju wrote: > >=20 > > >=20 > > >=20 > > > >=20 > > > > For THPs page_check_address() always fails. It's better to > > > > split them > > > > first before trying to replace. > > > So what does this mean.=C2=A0=C2=A0uprobes simply fails to work when = trying > > > to > > > place a probe into a THP memory region? > > Looks like we can end up with endless retry loop in > > uprobe_write_opcode(). > >=20 > > >=20 > > > How come nobody noticed (and reported) this when using the > > > feature? > > I guess it's not often used for anon memory. > >=20 > The first time the breakpoint is hit on a page, it replaces the text > page with anon page.=C2=A0=C2=A0Now lets assume we insert breakpoints in = all > the > pages in a range. Here each page is individually replaced by a non > THP > anonpage. (since we dont have bulk breakpoint insertion support, > breakpoint insertion happens one at a time). Now the only interesting > case may be when each of these replaced pages happen to be physically > contiguous so that THP kicks in to replace all of these pages with > one > THP page. Can happen in practice? >=20 > Are there any other cases that I have missed? A JIT compiler placing executable code in anonymous memory before executing it, and a debugger trying to insert a uprobe in one of those areas? Not common, but I suppose it could be done. --=20 All rights reversed --=-nf7sxNz0ss/8KVmzHIUD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJYiOP9AAoJEM553pKExN6Dh9IH/j1lFxNybTM4bDL0C5IxF5LU 9R11ofS0yoPTP/JHeTXcUuU/Z2mQrHp0yKnaB7IIhIZZrU5zTpyn3bmazpGrS+yT q0h+x0wk7qIS+zT0TH0xyepHcLghCY6PAvsJuQbf1R2ojgnnYCCvYgw1IptAEgyR 3R1VONEZMHL1gm82xkCvMwEOOkA1k4t9AJIDgP7USiDDugnB31cZTgbYpsb6rDiT MTDs003hMteBFDDuYwmgGm6sou45DRv6ARN8+Fepw3fQi8V9iZQlb992sN9DQIDT T7CeImAL8fb5YKl9E8U9b7y1vW9B58FdgLka2zKwkrKv0d7srbHTqvsg42F9asQ= =wovX -----END PGP SIGNATURE----- --=-nf7sxNz0ss/8KVmzHIUD--