Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1191062lqd; Thu, 25 Apr 2024 08:19:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVD133FCwlCDIKhJ3DkArmobguUdfRlUpJJPzpHXvyZ1EBQNGUh/7iZrf7VYEgcdyBxorJbbqUn46j0zaGAP9T6TXaaXEVbliAlHTrXcA== X-Google-Smtp-Source: AGHT+IHfZ4CeXPYPmhpHbB3RnBM85dI1DoDA0YtuXkJTH4nS1mk0AYrB0Bvrz+GB5beyDzkajOFp X-Received: by 2002:a05:6512:2142:b0:51b:b7:a14c with SMTP id s2-20020a056512214200b0051b00b7a14cmr3550348lfr.20.1714058385341; Thu, 25 Apr 2024 08:19:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714058385; cv=pass; d=google.com; s=arc-20160816; b=pHG3CfPsIUvWiLaJ8cYyYTkll9sx3kD0aX+iB83DT7XumFiEtRazzHf1CLhpb6Nm/j 41fBlfXSQKpY9XPDYHqDLgogSm32tcJ337q268w/tpaHlRVGd8EaWdcyjqoMlFN1hD86 2Q2l3AlTqCOOrj/hXD2v17bB01lkHECHIPTQV7bTqeg2fXk/hPhnWfNWa2l6dhqlQSBi sRJIgpfJCISM/gkxWwKVrTD4A/fn5vJ3KOlchnj4JPdp3jiYjssK4tJUr0L+mmjrAAom pvT86KeKkqaKw3rMWRTZZNy7KAHSgcJlFd4Pe54uQ3zwAD1WHzRPhiUq84Sm7ecBZQjl AY+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tCdmysF9MWE0CXzC7izlZP+QM8RV5lckKSV0SGoKIus=; fh=Iwy4q+VZTcRTgeQ8s0F9Bu+hpnJc8n0pwmMDOkEdtfo=; b=en6bp5VzRNux/btGsDjYaZuRdHg16GNqISaU4AvHDfsydZppy+AUhlu98vc5IjNUxP D66LG+96XRRLRnkcpsguUyFtS2P8Fut/j2JhBMCzyNjKMf/eJv6Cjh0ElR0dmGXHJaOx nJ40jjAxpQaV6GxwQ8nG0U4Z72ZLnWpel4+x/fI2aFQMhyL+hhSDTXyXQ2UjVKeQRXeQ rJJbd05wYYTHz5ARGGq/6kk13pCMIyH8+HuBxH50N0XODDfJn4/XdXEMp+QvPyE23WMU qsm41L6fTLKtWQtnyuZIY9/p3M2PGggxxKAxNzk617k7eEpwny5pBLtj5Jz6tK7KYxTy Xk0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@morinfr.org header.s=20170427 header.b=kKsaPGXP; arc=pass (i=1 spf=pass spfdomain=morinfr.org dkim=pass dkdomain=morinfr.org dmarc=pass fromdomain=morinfr.org); spf=pass (google.com: domain of linux-kernel+bounces-158788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=morinfr.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f26-20020a50a6da000000b00571f102339esi6680263edc.307.2024.04.25.08.19.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 08:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@morinfr.org header.s=20170427 header.b=kKsaPGXP; arc=pass (i=1 spf=pass spfdomain=morinfr.org dkim=pass dkdomain=morinfr.org dmarc=pass fromdomain=morinfr.org); spf=pass (google.com: domain of linux-kernel+bounces-158788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=morinfr.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 143AF1F22271 for ; Thu, 25 Apr 2024 15:19:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A67B014AD15; Thu, 25 Apr 2024 15:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=morinfr.org header.i=@morinfr.org header.b="kKsaPGXP" Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E20B214A0A8; Thu, 25 Apr 2024 15:19:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.27.42.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714058377; cv=none; b=n9pBbwPmh96AXRcc2PlbnWLWDC781hULBpfUsj1g8DZ84c9ZZngY8oPLR+UCa3DmEOyP9iJ65+YFY58Q+qwHgMZjBkBHxbPSt7GtU74GOoYDuqhr2bwOTjjaoA9pCWPmndcG+Ak455uvCKlH5t35SQ5vzqiezptiSdSC5vsh0JE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714058377; c=relaxed/simple; bh=Udp4TbJuoAH1fZFzgzQ2FS/97plqnMkt3dI1CULb9bk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UGSVWts/V/iZt4OhJbqlNSpXZIyYUG2xh5QU3tuWT2AjU+VaTqfvjhMKxCyTtqzV5vii4tGDILF4mOc1jltDg9SirI5AqfVKSuQzzRR3kccuhnSTskmkZL2HW7+wywV8h+CwdToH2nq7xy0Hqz/9hkaOTvUI3g4Kez+VePbo5mo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=morinfr.org; spf=pass smtp.mailfrom=morinfr.org; dkim=pass (1024-bit key) header.d=morinfr.org header.i=@morinfr.org header.b=kKsaPGXP; arc=none smtp.client-ip=212.27.42.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=morinfr.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=morinfr.org Received: from bender.morinfr.org (unknown [82.66.66.112]) by smtp2-g21.free.fr (Postfix) with ESMTPS id 892672003CC; Thu, 25 Apr 2024 17:19:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=morinfr.org ; s=20170427; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tCdmysF9MWE0CXzC7izlZP+QM8RV5lckKSV0SGoKIus=; b=kKsaPGXPV/dESdejp1+YwqKA4x u0jnWodXaYVmqRgRUWDMJAGSX3IOFtzDxI1cdtbeIhWVqrBQLXyd7ddGsPaj0fwbQ2diHIIyw3YQK NWyW4sfqdIqL4EQXINlhTskkIN/ZhO+e4F+7IXhrIEgwikAQSI6U/OMCcGkwUcvqhbWA=; Received: from guillaum by bender.morinfr.org with local (Exim 4.96) (envelope-from ) id 1s00se-001N10-2L; Thu, 25 Apr 2024 17:19:24 +0200 Date: Thu, 25 Apr 2024 17:19:24 +0200 From: Guillaume Morin To: David Hildenbrand Cc: Guillaume Morin , oleg@redhat.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, muchun.song@linux.dev Subject: Re: [RFC][PATCH] uprobe: support for private hugetlb mappings Message-ID: References: <22fcde31-16c4-42d0-ad99-568173ec4dd0@redhat.com> <8d5314ac-5afe-41d4-9d27-9512cd96d21c@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On 24 Apr 23:00, David Hildenbrand wrote: > > One issue here is that FOLL_FORCE|FOLL_WRITE is not implemented for > > hugetlb mappings. However this was also on my TODO and I have a draft > > patch that implements it. > > Yes, I documented it back then and added sanity checks in GUP code to fence > it off. Shouldn't be too hard to implement (famous last words) and would be > the cleaner thing to use here once I manage to switch over to > FOLL_WRITE|FOLL_FORCE to break COW. Yes, my patch seems to be working. The hugetlb code is pretty simple. And it allows ptrace and the proc pid mem file to work on the executable private hugetlb mappings. There is one thing I am unclear about though. hugetlb enforces that huge_pte_write() is true on FOLL_WRITE in both the fault and follow_page_mask paths. I am not sure if we can simply assume in the hugetlb code that if the pte is not writable and this is a write fault then we're in the FOLL_FORCE|FOLL_WRITE case. Or do we want to keep the checks simply not enforce it for FOLL_FORCE|FOLL_WRITE? The latter is more complicated in the fault path because there is no FAULT_FLAG_FORCE flag. -- Guillaume Morin