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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D87DC25B06 for ; Tue, 9 Aug 2022 20:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343631AbiHIUYB (ORCPT ); Tue, 9 Aug 2022 16:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232905AbiHIUX4 (ORCPT ); Tue, 9 Aug 2022 16:23:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FEF726576 for ; Tue, 9 Aug 2022 13:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660076633; 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=ks5e3vG8/bg6ecSj9dekO7KiLf2ruNOcJnb5Pq8KV1g=; b=G7i6KRDVmDhDlvLYDV+YmRKbcSSN366qhLou1T/9Hw758g12LesiFTUMshWQxdHWuEGaCK EdRW5Sm5thzb6VCz4crHiytCBiPFjPU//em5XWRXbbYfgEVGfZXWbgM4ZoZ22DxS8a0ULL Wxz6nXwn9mzEgizgfywrhGh6OjIPyFw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-18-1gSF9p7UP1S6VV3EC6hkng-1; Tue, 09 Aug 2022 16:23:52 -0400 X-MC-Unique: 1gSF9p7UP1S6VV3EC6hkng-1 Received: by mail-wm1-f69.google.com with SMTP id r10-20020a1c440a000000b003a538a648a9so3587641wma.5 for ; Tue, 09 Aug 2022 13:23:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc; bh=ks5e3vG8/bg6ecSj9dekO7KiLf2ruNOcJnb5Pq8KV1g=; b=B9dXvWeYBbeXIxDFAnviABcSSB8dY4hkpXQ+rU3W8MkmZzFH8HTCm24OwcegHYwSie HIUJDnPlRowVO+OQZ9W27Pd5Ia2/M3pz4UqrAlCzCywL2N6uq1nbXzUrdpcs2pHNS5o2 Ca6aDO3DRxDG9pgf9A6oljMsXYcz436OEP6ACAURuY5VwoloCG4PPioGQQSQBP22OTll fIK5kHlBYKK8NT+BNVdKfQLnwOnvXOHrL+dj+O4seJwpKJbTQBrawVVQb/hxJBWX44mw 9XXzV738tyKOH+u4oLcJevuzpVZfrEiwQXioD/hqCikuCMJtWsPIIJtcxOFXxOejBCJ0 J/Aw== X-Gm-Message-State: ACgBeo1EwIFPhzshjrYmi2FPPtGqaSb4fnp4DCd86gG83hSuTueWx0SJ lmWxcLR1ifURbXRWl99jTBHFmhantjlClMooST+ciojRwytge3NwIZX2HHyoBh6ewjA5dDtKTO7 OACbCMrk96dhoJB3bMHXWWhaU X-Received: by 2002:a7b:c003:0:b0:39c:5642:e415 with SMTP id c3-20020a7bc003000000b0039c5642e415mr103187wmb.111.1660076630662; Tue, 09 Aug 2022 13:23:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MME3AJynexSREakjc/wtM1ePCr1r4osXSZ1oZmWn8F0r7gEvOHDAhoGVLa2hTVXuiIT2gIQ== X-Received: by 2002:a7b:c003:0:b0:39c:5642:e415 with SMTP id c3-20020a7bc003000000b0039c5642e415mr103178wmb.111.1660076630387; Tue, 09 Aug 2022 13:23:50 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:3700:aed2:a0f8:c270:7f30? (p200300cbc7053700aed2a0f8c2707f30.dip0.t-ipconnect.de. [2003:cb:c705:3700:aed2:a0f8:c270:7f30]) by smtp.gmail.com with ESMTPSA id q11-20020a5d658b000000b0021e4bc9edbfsm11591467wru.112.2022.08.09.13.23.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Aug 2022 13:23:50 -0700 (PDT) Message-ID: <915e2f40-b94a-cef4-7aa7-a402e93dae68@redhat.com> Date: Tue, 9 Aug 2022 22:23:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v1] mm/gup: fix FOLL_FORCE COW security issue and remove FOLL_COW Content-Language: en-US To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Andrew Morton , Greg Kroah-Hartman , Axel Rasmussen , Peter Xu , Hugh Dickins , Andrea Arcangeli , Matthew Wilcox , Vlastimil Babka , John Hubbard , Jason Gunthorpe References: <20220808073232.8808-1-david@redhat.com> <91e18a2f-c93d-00b8-7c1b-6d8493c3b2d5@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09.08.22 22:20, Linus Torvalds wrote: > On Tue, Aug 9, 2022 at 1:14 PM Linus Torvalds > wrote: >> >> But as there are two bits, I'm sure somebody ends up touching one and >> not the other. > > Ugh. The nommu code certainly does odd things here. That just looks wrong. > > And the hugetlb code does something horrible too, but never *sets* it, > so it looks like some odd subset of VM_SHARED. mm/mmap.c:do_mmap() contains the magic bit switch (flags & MAP_TYPE) { case MAP_SHARED: ... case MAP_SHARED_VALIDATE: ... vm_flags |= VM_SHARED | VM_MAYSHARE; if (!(file->f_mode & FMODE_WRITE)) vm_flags &= ~(VM_MAYWRITE | VM_SHARED); fallthrough; VM_SHARED semantics are confusing. -- Thanks, David / dhildenb