Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp165808pxb; Thu, 12 Aug 2021 13:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrxUEerqOxZ3Q7/SPtDMekrowT9WX46o9VajnssPbmd4RK0KEVLIxSJ1lH9BgGPrNp4Aca X-Received: by 2002:a17:906:7b53:: with SMTP id n19mr5483870ejo.14.1628799802544; Thu, 12 Aug 2021 13:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628799802; cv=none; d=google.com; s=arc-20160816; b=SWSJRmsYV2jdpHu10usKXUZTEXqa1IvCZuBCwz3seuQA4Rt0T6oWgi/t9YR7dRRHMe 6/NMtXXMtK2GsJiIUIxGHSeBQWqXuRTQ27XPtpXkl3cXPeb4CPPawZaaHKvwhXWyQssR Sa1oy0hiIB0GS1pOyYbFgLDsmdg/DUTF7Rzsf2R2bw+cPec5US4rCOrgM5dQyUOi6/tk 5Jxbcoz5siVUWFqqdbHInJoPMCsDJqhQefmEUX+FAdU6nE1tQc//QjeFDWEkZGghHCn4 cypq1UXJeV1HpYiFNfxjTw0pS9BPSJSSWhv7wQbS0LVLxNVb2VWZPBbl9RqnBShJtpw9 F0Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=S+E4q/M54NKHA7t+0+yZiG5e1rXRHCWENhzfTmuDkeE=; b=K8HCSQTKDDM0oe+VpwETX3Qhgbbtrkon+PYAZYiLj+/TkW3MPQlk4oXuULZ7e0Iz+k 5Br1sO9SM/tOcnITbPGy3Wy30BwW56EBXitifzW2QTFBbSXkYQDvgTjJCP3RybjmxzXa g/EPuvhzedb7q4Na11xwpSmBkvooLN53nqRUv+Zhap+8ZJVg0btf1PYHH1MjyjKV96/J jZYT0Yn3dDvJhLuNQH5Ue8fc1ew9la6gaurySMSmW6qXCbwE1DuDxI4TcxQbDxH17+JC dWbpaojr8MQgRGGVpBqY2R209sPmnnkBB3z9AdWoBQZ3Glzjo5Oo91cBIHNYW2wmx/Mo Pc2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GqZ+WDpe; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb6si1043274edb.399.2021.08.12.13.22.59; Thu, 12 Aug 2021 13:23:22 -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=@redhat.com header.s=mimecast20190719 header.b=GqZ+WDpe; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237526AbhHLSQe (ORCPT + 99 others); Thu, 12 Aug 2021 14:16:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60422 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233283AbhHLSQd (ORCPT ); Thu, 12 Aug 2021 14:16:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628792167; 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=S+E4q/M54NKHA7t+0+yZiG5e1rXRHCWENhzfTmuDkeE=; b=GqZ+WDpefX3W/oKDLXRKiYP0ZwfUA7HnkgsyqftD75NLNcWBAokzTggJ8vPepAb3jHP+4q Zk+VTHr9Sx/eU7Qy/8XOiMfy6/52whqXRy02s2ip3wXIneJbR1GiVmCWZIykcpdZqtDAW+ wlkdQiyeK1s0vD43uj0o08GqfMnOakI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-gDhWt0HiO3W_TydA5ZQu8w-1; Thu, 12 Aug 2021 14:16:04 -0400 X-MC-Unique: gDhWt0HiO3W_TydA5ZQu8w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A87080124F; Thu, 12 Aug 2021 18:16:03 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB15D1017CE5; Thu, 12 Aug 2021 18:15:42 +0000 (UTC) From: Florian Weimer To: ebiederm@xmission.com (Eric W. Biederman) Cc: "Andy Lutomirski" , "David Hildenbrand" , "Linux Kernel Mailing List" , "Linus Torvalds" , "Andrew Morton" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H. Peter Anvin" , "Al Viro" , "Alexey Dobriyan" , "Steven Rostedt" , "Peter Zijlstra (Intel)" , "Arnaldo Carvalho de Melo" , "Mark Rutland" , "Alexander Shishkin" , "Jiri Olsa" , "Namhyung Kim" , "Petr Mladek" , "Sergey Senozhatsky" , "Andy Shevchenko" , "Rasmus Villemoes" , "Kees Cook" , "Greg Ungerer" , "Geert Uytterhoeven" , "Mike Rapoport" , "Vlastimil Babka" , "Vincenzo Frascino" , "Chinwen Chang" , "Michel Lespinasse" , "Catalin Marinas" , "Matthew Wilcox (Oracle)" , "Huang Ying" , "Jann Horn" , "Feng Tang" , "Kevin Brodsky" , "Michael Ellerman" , "Shawn Anastasio" , "Steven Price" , "Nicholas Piggin" , "Christian Brauner" , "Jens Axboe" , "Gabriel Krisman Bertazi" , "Peter Xu" , "Suren Baghdasaryan" , "Shakeel Butt" , "Marco Elver" , "Daniel Jordan" , "Nicolas Viennot" , "Thomas Cedeno" , "Collin Fijalkovich" , "Michal Hocko" , "Miklos Szeredi" , "Chengguang Xu" , Christian =?utf-8?Q?K=C3=B6nig?= , linux-unionfs@vger.kernel.org, "Linux API" , "the arch/x86 maintainers" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 0/7] Remove in-tree usage of MAP_DENYWRITE References: <20210812084348.6521-1-david@redhat.com> <87o8a2d0wf.fsf@disp2133> <60db2e61-6b00-44fa-b718-e4361fcc238c@www.fastmail.com> <87lf56bllc.fsf@disp2133> Date: Thu, 12 Aug 2021 20:15:40 +0200 In-Reply-To: <87lf56bllc.fsf@disp2133> (Eric W. Biederman's message of "Thu, 12 Aug 2021 12:48:31 -0500") Message-ID: <87lf56edgz.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Eric W. Biederman: > Given that MAP_PRIVATE for shared libraries is our strategy for handling > writes to shared libraries perhaps we just need to use MAP_POPULATE or a > new related flag (perhaps MAP_PRIVATE_NOW) that just makes certain that > everything mapped from the executable is guaranteed to be visible from > the time of the mmap, and any changes from the filesystem side after > that are guaranteed to cause a copy on write. I think this is called MAP_COPY: If we could get that functionality, we would certainly use it in the glibc dynamic loader. And it's not just dynamic loaders that would benefit. But I assume there are some rather thorny issues around semantics. If the changed areas of the file are in the page cache already, everything is okay. But if parts of the file are changed or discarded that are not, they would have to be read in first, which is rather awkward. That's why I suggested the signal for all future accesses. It seems more tractable and addresses the largest issue (the difficulty of figuring out why some processes crash occasionally). Thanks, Florian