From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFF78C433B4 for ; Tue, 11 May 2021 22:24:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52921611AB for ; Tue, 11 May 2021 22:24:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52921611AB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D86A16B006E; Tue, 11 May 2021 18:24:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5C9E6B0070; Tue, 11 May 2021 18:24:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFCD46B0072; Tue, 11 May 2021 18:24:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id A498B6B006E for ; Tue, 11 May 2021 18:24:41 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 69F65B2B2 for ; Tue, 11 May 2021 22:24:41 +0000 (UTC) X-FDA: 78130380762.38.A249C98 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf14.hostedemail.com (Postfix) with ESMTP id 9A588C0007CA for ; Tue, 11 May 2021 22:24:16 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id n40so3969544ioz.4 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=W9A/RHsCA/0V5PACi5x6yOf8cnT2RPVmNWm0QDLw7aUPkA9LhpsDV6mZ2K/8DujCf8 yyagcXQGizqNmxh9FIUzk/tCX+Z2m2C9OrlRUb0vzt9P0I7rPZjBVu9SaOhlCDj3GFM4 +hzPimRp5AdRaoBiLcXAmdyyA08FJLpzLBqaR5b+GKz+4bbFMKhEs52TxhUyAOX7erRr KMwu5WVXKhkP5y4JytjoKKMZtauLsKFKcesLV2vXClAIsKRsDp0rR5usB8qAuVFgtdiZ Rkr3KCObssaZecqo/hqo7R+Ui0BLPMQ91RzDzWS6J85RheQoktckbiLebTLuODwoulpN AvxA== X-Gm-Message-State: AOAM531OWdvX+Bxp7xwa2/RbaRBL+14MTu75pxPA5kXzst+EH9tmP07L czRAsJq7vLu2x7KJMone3q+ebtmmmJhH6glOGmYCHw== X-Google-Smtp-Source: ABdhPJyVU7muj6jg460tt7Ak7wRhD7TDhhQ1tkM3QlSH0Z+idgPfxEVdT4JpLXFBh6GdZmj/7AjmzatmBKQjah6I6T0= 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" Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=S4CunIRV; spf=pass (imf14.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.43 as permitted sender) smtp.mailfrom=axelrasmussen@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 9A588C0007CA X-Stat-Signature: z548jnf7kmsh9aw1866zdbkb1u4i5qay Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=mail-io1-f43.google.com; client-ip=209.85.166.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620771856-364839 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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