Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1202267pxj; Fri, 4 Jun 2021 08:27:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDkbwQXlDUXvdxS1r2Y1SxMblC/qpovV/kf5UkX8M+Zp4LRftJyE5u5Qv4pk3bzLidTcQx X-Received: by 2002:a50:ee02:: with SMTP id g2mr5244814eds.333.1622820453458; Fri, 04 Jun 2021 08:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622820453; cv=none; d=google.com; s=arc-20160816; b=cm3wE7Ulnp2RWnS6WFJnoFYuOAKjQMDBmw35pkyCU0AttUS5MlI16n2G4KxbVBhyo4 8OQQwef5UOzIz45YsASxZnvUETDtnpljSe25SmH1KYfCHFf0W/wXLqApaPnDTYW+TKWH 1BZnTp9tEhR5XNxSIBFzJws8/vhcNheOboWU77C4Xjdng5o7L78vMfFLw57Zo9NKSpWT Ez5hosg4UFHCA5pIapg6Ai0AzEumRhaIJBNlF13kSGgqYnmvSLf5osILPSHQ5H1hBI6E RYYAw49P2AoH+tu47MELH6bH1R2r8RHYgeZ4sNh1CwByt5XsGRYuM9jHagGzd/TkTRw8 5LhA== 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=ij2m//i2vBsvWVnhGZ0XX68OI3bOnqi+sqV2qYh6ilE=; b=jtkhBPTGAQylzEBrf9oGKhfY5W90zNA1HWrp3HR0IEYpZEqGDolHoyQVCsTNVGnyYL jhG8b9G38p33HHgAyxKW0ZazkrWe7+mmgXGF4yfn2zVOwRRVj3Lifksn6JesObC0yYqJ xBgtwnY3gRTxYDFIpSSTjPnus0EPIvLdIPd8zx/EAjjCYv0YYbV0FtLsPzWYSNPYq7yP 4k/ahxTXwDSSTAi3TYc0Tc/eim0/h38iUesWmk137smp6soIpT3Nutndm2sDNZWNEJ3B +XFmyehh8X0tJjHvKBSusZ9/kUOhKsLvSumjSy5D1y2Pqrq54DkJmBggSr2GAj7kWI2G VEIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=0a0ckhen; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si4948590ejs.331.2021.06.04.08.26.58; Fri, 04 Jun 2021 08:27:33 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=0a0ckhen; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbhFDP0p (ORCPT + 99 others); Fri, 4 Jun 2021 11:26:45 -0400 Received: from mail-lf1-f45.google.com ([209.85.167.45]:47071 "EHLO mail-lf1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbhFDP0p (ORCPT ); Fri, 4 Jun 2021 11:26:45 -0400 Received: by mail-lf1-f45.google.com with SMTP id i9so14612236lfe.13 for ; Fri, 04 Jun 2021 08:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ij2m//i2vBsvWVnhGZ0XX68OI3bOnqi+sqV2qYh6ilE=; b=0a0ckhenY104NwViOzux/nsF7MNxKyTmqDt4G3pYeg6N05gBAHLJ1e167QtHn+tanr l8jqrm/IaCj4GSXMxQ7nHM6w0q/WNVAK8h4GtYe7z8y2idNAJ6tXLaOFhy/DulQj2QRp DC2B8mE+JPu3LcDhNvivHczs3p0QQc3uTbyom6kOciHY5sRoMwEdQabF5td7wcD9qonk Xj5j+SAtQaGJsFdIzhQWJuD4sPLe0Fh8ecxyF70FaMeIkknYs4EkZr8M6uaUrwZ/UbIW pVwjp69OKq4ls0OmKT4wBQzA3BoUyebi02nVubEAtu2tBtr7NWntpSkAdXhkBDt62mVS WO8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ij2m//i2vBsvWVnhGZ0XX68OI3bOnqi+sqV2qYh6ilE=; b=rLsgayhRu7RjyAzIFv64CTPlzMDmczf5t7oQ8m9ac+ZptDyzgxsBostryGBy6FdBDb TI+KJp5fKGVEKC+MYJ39jIUr2Wt/dVp9RHNYR9E9ZU5raCW4T7Mh7eEf3VTaRU8TqxZc Y+XEgZuqZAvGQVbn9hG5UP6GXlNXIctZwG63aH5xneddN98X5alWzL0TlPIY6AABo8Er KGBj3plUbqbXqt1OuNgGsBNjT4pCLoMDC/2IYkp79jSppKZ1I2WFs6eoml04Dj7cfFLd AdcFbGNep9WhEVF2ng4igh7UHAlXO9NqiblQucicUVDZB74UMHDFmmpvPlS3Ed5auvTX nw3w== X-Gm-Message-State: AOAM531cD9RhDCKpHPZhQMDdZTmL/ma1XWT5N45b1gNJMLa948Kkl6/M 0lCjWSit6GVGZf/Le60viebalA== X-Received: by 2002:ac2:4899:: with SMTP id x25mr2636953lfc.372.1622820236389; Fri, 04 Jun 2021 08:23:56 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id l15sm496245ljc.35.2021.06.04.08.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 08:23:55 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id D566B1027A9; Fri, 4 Jun 2021 18:24:07 +0300 (+03) Date: Fri, 4 Jun 2021 18:24:07 +0300 From: "Kirill A. Shutemov" To: Ming Lin Cc: Linus Torvalds , Hugh Dickins , Simon Ser , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v2 2/2] mm: adds NOSIGBUS extension to mmap() Message-ID: <20210604152407.ouchyfuxjvchfroe@box> References: <1622792602-40459-1-git-send-email-mlin@kernel.org> <1622792602-40459-3-git-send-email-mlin@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622792602-40459-3-git-send-email-mlin@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 04, 2021 at 12:43:22AM -0700, Ming Lin wrote: > Adds new flag MAP_NOSIGBUS of mmap() to specify the behavior of > "don't SIGBUS on fault". Right now, this flag is only allowed > for private mapping. That's not what your use case asks for. SIGBUS can be generated for a number of reasons, not only on fault beyond end-of-file. vmf_error() would convert any errno, except ENOMEM to VM_FAULT_SIGBUS. Do you want to ignore -EIO or -ENOSPC? I don't think so. > For MAP_NOSIGBUS mapping, map in the zero page on read fault > or fill a freshly allocated page with zeroes on write fault. I don't like the resulting semantics: if you had a read fault beyond EOF and got zero page, you will still see zero page even if the file grows. Yes, it's allowed by POSIX for MAP_PRIVATE to get out-of-sync with the file, but it's not what users used to. It might be enough for the use case, but I would rather avoid one-user features. -- Kirill A. Shutemov