Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3930026pxj; Tue, 11 May 2021 15:26:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvnazHNiAyGKvj83D1QTyrwntsnmo3FDdkiXwAjtyhL7A0uJX9XTy30hZBEGxdjjPy+xw8 X-Received: by 2002:a05:6402:50d2:: with SMTP id h18mr4413717edb.10.1620771969199; Tue, 11 May 2021 15:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620771969; cv=none; d=google.com; s=arc-20160816; b=GF/VpTsroprm1kPWwudTsa8LcsdNqLUgVKuSSGXyYczdTcIetVf3G2X/82mnVfOazI hrbySYDACGXc7QbCbny7+DcoDSnuc317AxaUVhwE8wYJc339+eKgR7PQ/iK3FIbjrlsl BY/8qXuy5X+warhEpgkpF+gQsDiHsf25noTIgK0dmhyHZ56R+bYT6YmNqcIZ1LBcfIbI Q35jwzN7sob/fAylh4H88UylRvwWYlqNuzCcVCDnvcv/bhYyt5oGI/Q06uTnFc9H0ZVt HKDWUGXG8RtlokrrRThxmsGWbQ3iSRdlF5Ci+EJ++Gt1/rs1gS6UsOP3g4RUJw0NFuMa xhFw== 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=e7udKTzo5uQZqNjObTNB6UA4nLmncb2xfLc5gKzOgoI=; b=zHE1YxrAUQGQjTUIy0e+07Ijk1nPkUNumUY3aqvV2VwkCiQRmRaWjfQg36RZWYueE5 6wq6FBa+OsfEtoAcD7U4Rw6ddgFKyAt9gCQfV64GskEKoG4YYdXVfKvrqoAuCN2dugvV klB4lEG8IFCtkxnjKupnLtYvxj4YDMdsnLO/xwCdClPu8eqX8W37GgmAkzOuwdR/pffD yP9nQBBbH0BqQ068mnNe6fiJk4cj/9CLrrJFayhCJytmEg7647hXfbaMF78HAPraCQu1 7bkG7IFOenPm7SUIz6So9L3B8cEf9Pl7XQERIWLlveHqNdw2xTU3y0s4F0SwPb5tpvKc tAug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=S4CunIRV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si16027692ejm.402.2021.05.11.15.25.41; Tue, 11 May 2021 15:26:09 -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=@google.com header.s=20161025 header.b=S4CunIRV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbhEKWZs (ORCPT + 99 others); Tue, 11 May 2021 18:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEKWZr (ORCPT ); Tue, 11 May 2021 18:25:47 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A32C061574 for ; Tue, 11 May 2021 15:24:40 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id t3so19689189iol.5 for ; Tue, 11 May 2021 15:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=e7udKTzo5uQZqNjObTNB6UA4nLmncb2xfLc5gKzOgoI=; b=S4CunIRVCOoCTIsC5PY+66+xpOc4qR6h0uWlajU/X6pvUDvf4TiDX2iQ/yk/9GiEWH 0YRwPde+q68uOYKU5aO25MOA9TfLr71lVsYMs2xg3lQLGsQH+VFzF73U1KE17XYT3/7m xrtANrUMvBpvmkVdWzmChhuLrGbSy7ojd7cq/qMGE7vM5o5f4MxN20cQ0VjlNWy/bfk0 4QH7QZUXVPNFp/AUkQCPyD7Qqm5rR8Sm/XRI6xeDtXJgr5/9EC5b+5Ijz4l9fH+3ezr9 8OyeA3w6obRFchydBtNsQXQutBUZYVB9fwMjA6T2u+ZanFI9x3XcgtNIUiLmDXGGQgY0 oT1w== 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=e7udKTzo5uQZqNjObTNB6UA4nLmncb2xfLc5gKzOgoI=; b=V8nrUaS55VWmvdNqftcFZAVKe0fSnwCQyrH7POaakba5k+EoIgmFoYa8RiOF0v4LqE Yu7PoWPo4O8lytaBVciYo4/+gho3zfcJK4Qm7Ti9Ou46BZj1lqqiyNCUI0J7gjZkgwSd +OjCEul4MvSj58gZ6RGz5Xn6QbISj8scc3rZPcMsFBx5UvUCb6S0KJJApSFTlvTYAAlr ArGz1X6y81/JIRZSXdO6Ppg6Y25YfgIbhT2jk3ceiP4aOxMZQ3SRF+bBfUQ529LhGbj4 MJWr78AqrLythkXT2nJOnk4gvfhabXzKAZeFfvPbncMVHqu1ptyZeVVIOkMXYOzLjDHt WU8g== X-Gm-Message-State: AOAM530DMDE0sHu9iqpIurcVeeM6TuqlY9S4+e/WelLFfAjcT01Iv5Ww lFn2ZwFBqkC6ESPz5AO4Exn3hY6wowxbpWTqmENFlA== X-Received: by 2002:a02:a381:: with SMTP id y1mr29186423jak.1.1620771880329; Tue, 11 May 2021 15:24:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Axel Rasmussen Date: Tue, 11 May 2021 15:24:03 -0700 Message-ID: Subject: Re: Userspace notifications for observing userfaultfd faults To: "Robert O'Callahan" 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 Tue, May 11, 2021 at 3:15 PM Robert O'Callahan wrote: > > 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. True, it would not be a stable ABI. That could be solved by adding a real tracepoint, instead of just relying on a kprobe on a particular function. But, I don't think that solves the concern around permissions. I am no expert on perf_count_sw_page_faults and similar, so I'll leave it up to others to give an opinion on extending that. > > Rob