Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp222324rwd; Wed, 17 May 2023 17:33:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4x5c4TUXiFMz0m46duYJNIM9PX25WVfl7OIgEUhGimzTjeuuuuKd/5AApvCr0fu2Ih/Znj X-Received: by 2002:a17:90a:1b42:b0:252:89bc:1cd9 with SMTP id q60-20020a17090a1b4200b0025289bc1cd9mr606731pjq.20.1684370037206; Wed, 17 May 2023 17:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684370037; cv=none; d=google.com; s=arc-20160816; b=NWwtw/nm0j6xedBbFFTp5rjJyb5caUqAWndEOwWb2w8AGJze5yi64LD/zhc8jvfJYg sK8Ct7nqZMRMh3cWsf0HXvSEo0w30erloBC/VST17gQP17RKfP7q1lEmQShBi6jq7KVm +LVJ/rwT1gfBEJ1egGPYrNSCx2UxSenxVUr0X9JAblG/+k/fZwCKhKh9/Hj2QV0V+2Xb da2ukSlkQhY4kNCCxpFINM4P9FI05IKRXD5IzMzCpCLuQ41dDJlZM0GEUzuTomPOz6Yh nUVOuY7Ei9V77IWtW7987v//ZczPK0OLsxaBvw4vSG//ZfzfQKPFoc6VL8ZD3fDw7Y6z jtHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ctm+oHZ88OJx9RdDqhhRf0OhM0Skp+u6Ga9xqH4ST4w=; b=F0xmWRQ5kzsVEGdhbXrMLFk8eao7ktlJaUjvegFbUm6lOLgErv7G0S3orHa2BS8eOC r/ehMAvvu81O8PnRTTKP8Kb7qXh8+m3YQmUuUva8hzGqnt9873o+M0asfCLjKeDJoVI+ bCBD8zw0UDv4nr3FtNpai1ff98AgNER/tX/xFooaL3r9GV0N+3B7OtSLvE0MBsI4aE3Q HWWiO+wdN/uGsvmvf978Q/f8sfAA0YXvvWb6jAVXEurXDW+lK8ePHmLcGwmCxnCi1ZJh CAXZr2LCBInHSbiF5RwHwKL8kAibny+e1H/I3rlKZfqb4dV98vkHDR7HbK16knh3/A3Q MjPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G5EM1hyd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a637309000000b005323e5a006csi89331pgc.411.2023.05.17.17.33.44; Wed, 17 May 2023 17:33:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G5EM1hyd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229712AbjERAVZ (ORCPT + 99 others); Wed, 17 May 2023 20:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbjERAVX (ORCPT ); Wed, 17 May 2023 20:21:23 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDA33C0A for ; Wed, 17 May 2023 17:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684369235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ctm+oHZ88OJx9RdDqhhRf0OhM0Skp+u6Ga9xqH4ST4w=; b=G5EM1hydzjK4aiv0Zjxb/QHhDhKGZSVtSVvezitqviHaQiwDftfqXE/JnQtYlsTMCRiRHX VytIXszDTyDe3erUhOtNdTmldgx1go0fe922bXwj6QWLZQakxoRLeJ65TLlFYgBNrcF308 HkVtDNnMDeK3nSeqj0i9xYRN7e0e2BM= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-435-NNgaTRexPzOlaiPzsE2RWA-1; Wed, 17 May 2023 20:20:34 -0400 X-MC-Unique: NNgaTRexPzOlaiPzsE2RWA-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-3f38280ec63so2543731cf.1 for ; Wed, 17 May 2023 17:20:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684369234; x=1686961234; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Ctm+oHZ88OJx9RdDqhhRf0OhM0Skp+u6Ga9xqH4ST4w=; b=jCW3AlQv9q2v909go7LwXT/bqs54e3ahOUj0gBBRKMbjcDXgkznR3VUSLSBdx40myR 1Pf1i330EN2YHVEIsIuAY/Pn9iVyl/NWC4lK53BC2x4zaZy12y5gOI812+9H+0sanHhv vD0FeXQfKAGfm3lxAoE6fW6ER9N6POX0AI+ohMpCGsT1faY+j/isKZ/+RMfmDflFqIE5 2yYHV4mqsbdrhABMu+QroYAWZUcY7dQ4CXCoRcCUHyatGVUFosMy/L0SzKDsIhYccvBg tZncTpfCgLwNizw4uUZzd0LjAVHFnfMYs0Wf7lbqsn2iL8coi0pXPxvABBQOOXo+ZCtE IugQ== X-Gm-Message-State: AC+VfDxAEsMIH0QCcQnIaSyt/nYT+sg88RBz5axo2HoBaaYVdTFBWXJQ tzyWGXRcqNEXyydhP7VRKlHtq/E440yrUXY0TUR+iO4qxkDfM2c3kKB7jwrENLLivBgy+UGlKsb 3RCfgDHtIOR6wBYQ+czFVXkrl X-Received: by 2002:ac8:5707:0:b0:3e3:1d31:e37 with SMTP id 7-20020ac85707000000b003e31d310e37mr8013657qtw.1.1684369233896; Wed, 17 May 2023 17:20:33 -0700 (PDT) X-Received: by 2002:ac8:5707:0:b0:3e3:1d31:e37 with SMTP id 7-20020ac85707000000b003e31d310e37mr8013634qtw.1.1684369233657; Wed, 17 May 2023 17:20:33 -0700 (PDT) Received: from x1n (bras-base-aurron9127w-grc-62-70-24-86-62.dsl.bell.ca. [70.24.86.62]) by smtp.gmail.com with ESMTPSA id c8-20020ac853c8000000b003e69c51cf53sm65569qtq.72.2023.05.17.17.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 17:20:32 -0700 (PDT) Date: Wed, 17 May 2023 20:20:31 -0400 From: Peter Xu To: Axel Rasmussen Cc: James Houghton , Alexander Viro , Andrew Morton , Christian Brauner , David Hildenbrand , Hongchen Zhang , Huang Ying , "Liam R. Howlett" , Miaohe Lin , "Mike Rapoport (IBM)" , Nadav Amit , Naoya Horiguchi , Shuah Khan , ZhangPeng , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Anish Moorthy , Jiaqi Yan Subject: Re: [PATCH 1/3] mm: userfaultfd: add new UFFDIO_SIGBUS ioctl Message-ID: References: <20230511182426.1898675-1-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Axel, On Wed, May 17, 2023 at 03:28:36PM -0700, Axel Rasmussen wrote: > I do plan a v2, if for no other reason than to update the > documentation. Happy to add a cover letter with it as well. > > +Jiaqi back to CC, this is one piece of a larger memory poisoning / > recovery design Jiaqi is working on, so he may have some ideas why > MADV_HWPOISON or MADV_PGER will or won't work. > > One idea is, at least for our use case, we have to have the range be > userfaultfd registered, because we need to intercept the first access > and check at that point whether or not it should be poisoned. But, I > think in principle a scheme like this could work: > > 1. Intercept first access with UFFD > 2. Issue MADV_HWPOISON or MADV_PGERR or etc to put a pte denoting the > poisoned page in place > 3. UFFDIO_WAKE to have the faulting thread retry, see the new entry, and SIGBUS > > It's arguably slightly weird, since normally UFFD events are resolved > with UFFDIO_* operations, but I don't see why it *couldn't* work. > > Then again I am not super familiar with MADV_HWPOISON, I will have to > do a bit of reading to understand if its semantics are the same > (future accesses to this address get SIGBUS). Yes, it'll be great if this can be checked up before sending v2. What you said match exactly what I was in mind. I hope it will already work, or we can always discuss what is missing. -- Peter Xu