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=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no 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 45469C4338F for ; Thu, 12 Aug 2021 19:24:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFEDF610A3 for ; Thu, 12 Aug 2021 19:24:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CFEDF610A3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 2210D8D0002; Thu, 12 Aug 2021 15:24:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AB298D0001; Thu, 12 Aug 2021 15:24:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 023918D0002; Thu, 12 Aug 2021 15:24:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id D89968D0001 for ; Thu, 12 Aug 2021 15:24:09 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 899E3253AE for ; Thu, 12 Aug 2021 19:24:09 +0000 (UTC) X-FDA: 78467404218.29.137D1EB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 06591D01F578 for ; Thu, 12 Aug 2021 19:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628796248; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8N86vzBdNfGIw1497CO2pBCfWWqdNZr9GKs8Sj+sQpI=; b=jFP/4/XE5EnMJQbStHGSXY8FWcqJI3qSfLVJ5M1qgjeCR/kDMZ/ixHZeiYDBxuZk5U7rxm iAtRQ2C7+bXdCYUOPc+k7+QpVbtcuy3iqRg/2YgdxMW6ssNWQR5MTFPtXkgPf6FU8UYPyM ThDP8H8SD6iVs49VFjFSQ43ZEw7k64U= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-WuiTpBGYM2mPqtQyuqJ68A-1; Thu, 12 Aug 2021 15:24:05 -0400 X-MC-Unique: WuiTpBGYM2mPqtQyuqJ68A-1 Received: by mail-wm1-f71.google.com with SMTP id t12-20020a05600c198c00b002e6bf2ee83dso342419wmq.1 for ; Thu, 12 Aug 2021 12:24:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=8N86vzBdNfGIw1497CO2pBCfWWqdNZr9GKs8Sj+sQpI=; b=AheOhOYP8aIXoNwfyBkkfxp3YECrLrsRSg3pp/bSVdLDKoFjRLgul55i86wofFPIFU sag0mqfB4lW1AU1ArGRfAdqGbPOPisYNaD7TWrWoOET/+A/OxIB5rCd0zgUdxRgZ/JaU x4MOIc6w6vGWw5JaYTTc4NqHmuvqcTl/hQ67L2fj3vuqmYk+FgYVj1XhXa6r3FRsFbzR /UIsxfOsTTPC1W0fw7IAeM449R1i0EIQHmZuT417ju+ZQakVOyYTDbwJzL9V4/ZYTOih Dbtop/b9ujGs+n+peWS5l/rNznkT9zVaKv6EyR4FapWgfH7FMX/ixT5Bjm6FoG8Wwt9V b4og== X-Gm-Message-State: AOAM532aZPHxT3JsoQeFgxeA2529i8a7u/J69/+el5RHJvFbTPS0LGHz eEAT58dEkgaylEojwUVdzvrbZXY0ond10XdVy5IjsnrLFqfC4VL2njwWSsiqswd/l32ojEoqE09 X3EtbHk53bOxGXA/yEhVY4ZLsRroPUaFRzQTv2K3nIMvKeajg6BOuysAPc9E= X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr160578wmg.40.1628796244054; Thu, 12 Aug 2021 12:24:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoi73TjuPhfXBY9qVs1gNFHq5iS0Cg54p1SYixusgscxJCJ6YZqkOPk8ytKcP9LVXjwJLvRw== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr160487wmg.40.1628796243648; Thu, 12 Aug 2021 12:24:03 -0700 (PDT) Received: from [192.168.3.132] (p4ff23d8b.dip0.t-ipconnect.de. [79.242.61.139]) by smtp.gmail.com with ESMTPSA id m10sm3080907wro.63.2021.08.12.12.24.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Aug 2021 12:24:02 -0700 (PDT) Subject: Re: [PATCH v1 0/7] Remove in-tree usage of MAP_DENYWRITE To: Linus Torvalds , "Eric W. Biederman" Cc: Andy Lutomirski , Linux Kernel Mailing List , 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 , =?UTF-8?Q?Christian_K=c3=b6nig?= , linux-unionfs@vger.kernel.org, Linux API , the arch/x86 maintainers , linux-fsdevel , Linux-MM References: <20210812084348.6521-1-david@redhat.com> <87o8a2d0wf.fsf@disp2133> <60db2e61-6b00-44fa-b718-e4361fcc238c@www.fastmail.com> <87lf56bllc.fsf@disp2133> From: David Hildenbrand Organization: Red Hat Message-ID: <0ab1a811-4040-2657-7b48-b39ada300749@redhat.com> Date: Thu, 12 Aug 2021 21:24:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 06591D01F578 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="jFP/4/XE"; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Stat-Signature: g7kyb85f47ug1ahjrjps7ysb4ur7xx65 X-HE-Tag: 1628796248-199773 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 12.08.21 20:10, Linus Torvalds wrote: > On Thu, Aug 12, 2021 at 7:48 AM Eric W. Biederman wrote: >> >> 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) > > No. That would be horrible for the usual bloated GUI libraries. It > might help some (dynamic page faults are not cheap either), but it > would hurt a lot. Right, we most certainly don't want to waste system ram / swap space, memory for page tables, and degrade performance just because some corner-case nasty user space could harm itself. > > This is definitely a "if you overwrite a system library while it's > being used, you get to keep both pieces" situation. Right, play stupid games, win stupid prices. I agree that if there would be an efficient way to detect+handle such overwrites gracefully, it would be great to have the kernel support that. ETXTBUSY as implemented with this series (but also before this series) is really only a minimalistic approach to help detect some issues regarding the main executable. -- Thanks, David / dhildenb