Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3924915pxj; Tue, 11 May 2021 15:17:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw68GOW0I+wH0D69B5stmgik9a422TymBzIeL8fc5Cr99UXY4rXwrpkXi05idVH4Ct3H4/4 X-Received: by 2002:aa7:c495:: with SMTP id m21mr39029956edq.123.1620771432969; Tue, 11 May 2021 15:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620771432; cv=none; d=google.com; s=arc-20160816; b=b5yszizmlGD2ELCM28NLq6fFDovBmJtfcyg/ClTFPCkltuqvgtRIpBwzYFjNPcutJo gxrYxGrINB/f6oAir3cNzeA/GOj4VEgUY5AFLWpDrKxhnP36oV2AG9ryd/bgXfCwOKxI 3eberDGNdXtnvwzXOPz6got5adGCg1VIEDUzfdh/J/ydYbPSwLqeKZh3TBBa4SsB7v/u yvl30EtkSgmk6YRwJpPs5YLTKyAcYB+AuKJlwY/m8ukd1iffR9WzEabfJZ19pZ0aaiqD gM5/tXSPxsCcwObqEeExakwFnJRY50mE0CtopC90cvo3QbXSWUjovbR+2usA670e21Aa LlLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=9APnGG9XDlJhvDOfUIsq0WVU3gMNJ2g3qgJEUxydNUg=; b=isQpLtJdrNt0LVkpO14EAbI2qwVpeM9RaJt55ylvNvfajo/luxu4o7yCsC3VhtwGIr 4up8rKF+dwUilvBSHNHWK653bNCKy6r9dblmZZ+r2bEfDaybUElI9bFpaO8tNZbGsxjw gstjenNu5apnry24RsmStn1L1kD0BFsum6K12T+tnAUb9y6alKX6qI2Jojk8ocfiD1hN GVyNnfL9DYkSluutTm/5vArLSXiVuGbZHAiUng3MClIwcZQJqyi+tUlNGiZW7CsW0vFP 0jsYdGgiQBbCfh/e4ox1+ykancsNYpj50vE0HGNC1tJ7A63CAO8IC/rUvMJ5wbQr3J0Y CoYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pernos.co header.s=google header.b=I3q6I778; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pernos.co Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si17887296ejv.738.2021.05.11.15.16.46; Tue, 11 May 2021 15:17:12 -0700 (PDT) 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=@pernos.co header.s=google header.b=I3q6I778; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pernos.co Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbhEKWQn (ORCPT + 99 others); Tue, 11 May 2021 18:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbhEKWQm (ORCPT ); Tue, 11 May 2021 18:16:42 -0400 Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA67FC061574 for ; Tue, 11 May 2021 15:15:35 -0700 (PDT) Received: by mail-ua1-x932.google.com with SMTP id h1so6864219uar.0 for ; Tue, 11 May 2021 15:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pernos.co; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9APnGG9XDlJhvDOfUIsq0WVU3gMNJ2g3qgJEUxydNUg=; b=I3q6I778Ko853XpTutbwmhvj2DKUu5ahO1ZPdz/ndvEFPNrXNJXKgpsDjpzdSwS3nR ruVb+G6BDMDvMnC5REh4QVHaVDV/X2cEvZ/p7Q+wSh6jB48ZKgm+dsaDTDBbDvo219+F QDVjRFr2vafsSx2o7fVZH0F4kYuSSVnK3e6uI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9APnGG9XDlJhvDOfUIsq0WVU3gMNJ2g3qgJEUxydNUg=; b=VFbo4fOfEg/u+lwMi7KzZNWRb+fFaSE0kss1wGM9hbDyPmfigS06Dug1rSWmlxRwjV 4zp7Fj3LGfJRlJCSrGJMryN+NIrgROx+J1BQl3fjgCtuE5kysE5ptE4EB6UPbY9q9w5W HTLizFdyLk/tBqvUQiOBUH31D3mK+lb810sZoz/RypAiHLsxSsqFJkqP8Y+dBcEkV4FC KzZBYjDxewdyUp9rsGcW6d5QXYSg1DN+pUpF4g4nqtieE8S10Xj8QUZDWRqGh3AeQyeS d9SvhA0L9ylxL3du8jx7ODKSGE093U3yk+j+RVjuMxU9xcDyKxkjnC+PkYFcEUhL5dtn hO0w== X-Gm-Message-State: AOAM531ofzP+YItndmRa/YcNFtASaSGxVPVdV2V+yXbZEpoxHbF6vTTS 8WZj1+9q1VMG6Tv6bhx5m2uwUDEShWRZIAvu X-Received: by 2002:ab0:2a83:: with SMTP id h3mr5526425uar.18.1620771334569; Tue, 11 May 2021 15:15:34 -0700 (PDT) Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com. [209.85.221.178]) by smtp.gmail.com with ESMTPSA id u140sm2410295vku.46.2021.05.11.15.15.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 15:15:33 -0700 (PDT) Received: by mail-vk1-f178.google.com with SMTP id b21so4375733vkb.4 for ; Tue, 11 May 2021 15:15:32 -0700 (PDT) X-Received: by 2002:a1f:fe0b:: with SMTP id l11mr5646538vki.24.1620771332590; Tue, 11 May 2021 15:15:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Robert O'Callahan" Date: Wed, 12 May 2021 10:15:21 +1200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Userspace notifications for observing userfaultfd faults To: Axel Rasmussen Cc: Andrea Arcangeli , Andrew Morton , Hugh Dickins , Peter Xu , Ingo Molnar , Linux-MM , LKML , Kyle Huey Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 6:12 AM Axel Rasmussen wrote: > Is some combination of bpf and kprobes a possible solution? There are > some seemingly relevant examples here: > https://github.com/iovisor/bpftrace/blob/master/docs/tutorial_one_liners.md > > I haven't tried it, but it seems like attaching to handle_userfault() > would give similar information to perf_count_sw_page_faults, but for > userfaults. That would probably work in some cases, but as Kyle said that requires privileges and currently rr can run unprivileged (if you set perf_event_paranoid to 1 or less) and usually does. Also, AFAIK, kprobing handle_userfault would not be a stable ABI. Rob