Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp748390ybg; Tue, 9 Jun 2020 11:47:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMu36vRZZHFjNvE5xDVaB/kODnWn7DEz7FeGTZkjpSa7OUkte3ME8KrfnodpOGzJZOFPFr X-Received: by 2002:a17:906:17c1:: with SMTP id u1mr28275131eje.47.1591728479220; Tue, 09 Jun 2020 11:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591728479; cv=none; d=google.com; s=arc-20160816; b=Oo5y3YX63s7sO2T/iNQ+V5F9igndotUfetOKFct6Z3E5FSZ5ttpt0dLWUYrk6hsENX T9JuRRDrjxbYp2VbEq4ZJnKAjkaC0dlucYe4nrXqAhpBYP6e66Fq6lSbIsq74qqqBdUT uFw2Fh53S331a6p40qWnrHiWh0NBEM07BfHgcHvpfX4gELo6e4qcG0/Be3T0GfxGesEB YgFEHkxyR0og/AvbdASLAPEcwVa+SXRlHk8ogI5bGuLYviXhndnRWkrTQBYdM2999uDX mtGixUTMEI4jRZcsjd3j6SdLM7V/foWMO1gA60zi0cVibJ5YUBP9NNKWZ+kj3OBEpppC AXpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=B1sEIvfkMOS6/GK8GVwqY60qEoMOQ5uyuaPVNdDcnPA=; b=lCh57tBM2E7XDPxoStm/VyFrHXwPE2zZ5szb1BR813k4k1fWU3K6F/o0laSE4v4+/I JheJBfye90/1TXIeg6bPTyLJj1bfr2sPnO8WHVR3WgVRvPxKl+XV40jFoVU7bEBR3dy0 U7jdGo83a6Ypfpw6MNkHOloG779sJsOSq6hvED7Yb4hExpd/8EJ4fsYTsRbv4RcGYRRT l1eIozHK0SAgESywsmIHYuzZJTEhOxxoA/fCJtrvOFo6JrZhMjSSjnegPluy6UZydo7x Q0x00rbKgzHMhK0+DhTKVKmilw/XgYD/oNh0PLRi84mmF6Be0AG7mulr+/lkZsFGAVRg COyQ== ARC-Authentication-Results: i=1; mx.google.com; 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 qk2si1920737ejb.271.2020.06.09.11.47.36; Tue, 09 Jun 2020 11:47:59 -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; 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 S1730516AbgFIOW5 (ORCPT + 99 others); Tue, 9 Jun 2020 10:22:57 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:33217 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729300AbgFIOW4 (ORCPT ); Tue, 9 Jun 2020 10:22:56 -0400 Received: from mail-qv1-f50.google.com ([209.85.219.50]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MowSu-1j9t9G2UcY-00qT1I for ; Tue, 09 Jun 2020 16:22:52 +0200 Received: by mail-qv1-f50.google.com with SMTP id ec10so10148765qvb.5 for ; Tue, 09 Jun 2020 07:22:52 -0700 (PDT) X-Gm-Message-State: AOAM532/5D1xi6PARJUidZLITM3bep6H9HVKKlJUVeInJFHfQiw7kkKs TeZK3FtinAfi63RbrLEO4hXR46ksyBr4vXCxYpM= X-Received: by 2002:ad4:4b33:: with SMTP id s19mr3849476qvw.211.1591712571533; Tue, 09 Jun 2020 07:22:51 -0700 (PDT) MIME-Version: 1.0 References: <20200514133545.GA5020@afzalpc> <20200516060624.GA6371@afzalpc> <20200607125932.GA4576@afzalpc> <20200608111834.GB5736@afzalpc> <20200608151727.GA5017@afzalpc> <20200609121506.GA7846@afzalpc> In-Reply-To: <20200609121506.GA7846@afzalpc> From: Arnd Bergmann Date: Tue, 9 Jun 2020 16:22:34 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: ARM: vmsplit 4g/4g To: afzal mohammed Cc: Russell King , Linux ARM , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:dYKT4xLZJZzUO8UrZZkxtVwWMkYUu72Ces2H0O/ea5kH26b5FtR /unv/1zrXT3kyKLS0J287yhzxa+ByK9PTMR8hmSupj386h+30jEYvOn34tKlRhNuaLY4FhM ascVsWdQ0RScJrvw//1anza1z7NJlekYUQj0DrXlIayLG0l+SaeHobj6+rdxRdkeI9jY2U+ kaMUF+dEGfOC1gqGLJjaw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:phX8Nb+0Bg0=:fwxf5ymuX67quHzFmeQUDa 0PfY1J6frCXXv+o+OQgC0xqBhGHju5jy41uFz8YmaD8T0wpfqUGSq/l0CI3Er1oxwspP4vjL7 3Spmr4evB5pnNr37wDxngJmAsXldNJShQEpGuOLT0ptHv5gpKRgusHgMjdjwEOt+vWlfhBjIy Nqms7sWUXfZm3K6wAdp/Ix1AQK2kTb0qfhsKh8QvVXV2x/kpzTrO7CWU+EnmvLGw/dibGm0G/ qifaX8EWzYQ4GHOKLX1rZ5PqNPxvxwGb5u4R0Pq9zAe53abXjvcF+1uz87F5OH4teFEH7D0Or Ha01c6ql3PG603llV3va0K8a/OT/u6mGqaSbKJWXzcqGYHMtCycIcs6Eu4/Dj4k3Eknx2Q4kK 5ACf5dPazPtxAHdHeRAXkz/EQrdZV0kzMCs2rftInLZz5JbxcW2g1vyu2EsC4Db2SE2tBWDGh ZcvEzR7psjltiXithikChKkQERDJVz/5sxngVLKBdQvLkc72Gu6i9/226B/D3+TIgsWFpDIe1 y9I/h2nKV5em18zPh9pyO+JAVlNtQyHOVAKQ2RWq/u8wJeGIGjE/UVtIaqcSAsMF4eF5AGSV6 oZ92nTmMryFaYyhPoEEM0lSmQ/FXVnkWiVeZAhDA0rPzIeNlwuVNe/6/EGvEobDTmDkdCOV9x e8E63uJLhFKKPJur6+7YhdhC6SSLw4BZ6WjqWl5MeToBxLmKkPADITX7Ax4P3kTlJI0qGj+Af Pmqmcg/mNEINnr5Op+EWuuU+6+C+Qsmg86bfPRK4rHvY/0lz4hs9wdutZg3+nmKj68+mnh3De eU03Oz/N1+veqONrNaAMOulZaEdfDNBBDfMM9kR8X7fpEbnqHg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 9, 2020 at 2:15 PM afzal mohammed wrote: > On Mon, Jun 08, 2020 at 08:47:27PM +0530, afzal mohammed wrote: > > On Mon, Jun 08, 2020 at 04:43:57PM +0200, Arnd Bergmann wrote: > > > > There is another difference: get_user_pages_fast() does not return > > > a vm_area_struct pointer, which is where you would check the access > > > permissions. I suppose those pointers could not be returned to callers > > > that don't already hold the mmap_sem. > > > > Ok, thanks for the details, i need to familiarize better with mm. > > i was & now more confused w.r.t checking access permission using > vm_area_struct to deny write on a read only user page. > > i have been using get_user_pages_fast() w/ FOLL_WRITE in copy_to_user. > Isn't that sufficient ?, afaiu, get_user_pages_fast() will ensure that > w/ FOLL_WRITE, pte has write permission, else no struct page * is > handed back to the caller. Ah, that does make a lot of sense, I had just never used that flag myself so I wasn't aware of this. > Am i missing something or wrong in the analysis ? As far as I can tell, you are absolutely right, and get_user_pages_fast() is the best way to handle this correctly and efficiently. Arnd