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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 63062C433E1 for ; Tue, 2 Jun 2020 17:44:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50660206E2 for ; Tue, 2 Jun 2020 17:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbgFBRoh (ORCPT ); Tue, 2 Jun 2020 13:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbgFBRoh (ORCPT ); Tue, 2 Jun 2020 13:44:37 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2FA6C05BD1E; Tue, 2 Jun 2020 10:44:36 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.93 #3 (Red Hat Linux)) id 1jgAxi-0023MS-U1; Tue, 02 Jun 2020 17:44:31 +0000 Date: Tue, 2 Jun 2020 18:44:30 +0100 From: Al Viro To: Linus Torvalds Cc: Jason Wang , "Michael S. Tsirkin" , Linux Kernel Mailing List , Netdev Subject: Re: [PATCH RFC] uaccess: user_access_begin_after_access_ok() Message-ID: <20200602174430.GN23230@ZenIV.linux.org.uk> References: <20200602084257.134555-1-mst@redhat.com> <20200602163306.GM23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Jun 02, 2020 at 10:18:09AM -0700, Linus Torvalds wrote: > You have exactly two cases: > > (a) the access_ok() would be right above the code and can't be missed > > (b) not (c) what you really want is not quite access_ok(). Again, that "not quite access_ok()" should be right next to STAC, and come from the same primitive - I'm not saying the current model is anywhere near sane. We need a range-checking primitive right next to memory access; it's just that for KVM and vhost we might want a different check and, for things like s390 and sparc (mips as well, in some configs), potentially different part that would do the memory access itself as well.