Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp933161rwl; Wed, 29 Mar 2023 10:14:48 -0700 (PDT) X-Google-Smtp-Source: AKy350Z13NX4bZlCEfoLNCfkF08vGqWHkewztdtKdHXuNmdOA3I9AhJ9x1OmwifRXOBmdoNp/db+ X-Received: by 2002:a62:18d0:0:b0:624:894d:c494 with SMTP id 199-20020a6218d0000000b00624894dc494mr17549820pfy.19.1680110088424; Wed, 29 Mar 2023 10:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680110088; cv=none; d=google.com; s=arc-20160816; b=ptzi3js6DG4be9ybanCCbCxU1Cg1j6nDWaDhLULv2v6IY6i8mLxAkaDhfrvMIbs/s5 sggz9BDS0X5Yo6YmGXlNwj9dGn9szUiBv7gzQQ5EYPQIhhU5WFEEySNLvz9nNvgfLkwY tlFkXsOUwiGbgG7K30/zis2CBqLbpXODPZwWBU4FgDcxpSSYQl0eQFDG2ulCnOsJJRcS e7TbxV/57Oxd/R/TKRFQ3D0wpPJBYcdiXQBrGr1HARjmKdSMbcIcAK6VxKkVgMFXDhnB Fnx9xSdKcXYEAQJ9ambTilhfeltSDpR+xZfaiUJSGdftVCACZ2r/7vVQRPXpXMzRFBYP 2nug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2HKY/Ux5TNZKEBOMV/tb21I2tofWYzDVBz54QvkxgBg=; b=BDdN8Lbs3713Qi8eHJ5T8aCTpmrr6//EllbUdR/RGST9FVwafhPNh4p43I6KTEe1c8 dg6+eKFfBCA7bURqsSq3I3BA3r395pc2TAXWpKY6qzaRbgA3vZZ6vZoRcko9rR9yB+Eg R1FLpg2Y+FlN8slFrk6BFkhb13DMxZdNWrcYbHxMnkGciIX59wx6lKul45PSaASo+cTo acpqFm+grojujL9HsjOco424yANoDs1Kp9pltDAijnXjpZTihE9kCm2Qmd+/OzNVo4eA CuOGIvcfKRQNyPq2xopWIw9cNMMckWW4afoDPxoHQlh3Gi/l2dfaYAhbszMG5uiTQA9B G/Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WtsA3B1a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w189-20020a6262c6000000b006275424eab1si9593910pfb.139.2023.03.29.10.14.35; Wed, 29 Mar 2023 10:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WtsA3B1a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231133AbjC2ROZ (ORCPT + 99 others); Wed, 29 Mar 2023 13:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbjC2ROX (ORCPT ); Wed, 29 Mar 2023 13:14:23 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27A5A4C3A for ; Wed, 29 Mar 2023 10:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680110020; 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=2HKY/Ux5TNZKEBOMV/tb21I2tofWYzDVBz54QvkxgBg=; b=WtsA3B1aJnf7bD5X6IwYWRVVk3psww+ELsqNfhMamRLiRTkqwXZ6cyZn7pg9RqOiMPAHuP 5ZwC6KilNb0ge2IMyAQ2dc/zlGbjqb28tDa6tDBT2pIIvpOs1aoiRABrORxt472F4ZycjC JJovdbsxfnDnCLVq4fAJsppVka9CJns= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-93-wDlX7MaCPTeV1v8QlV9ksg-1; Wed, 29 Mar 2023 13:13:36 -0400 X-MC-Unique: wDlX7MaCPTeV1v8QlV9ksg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B37485A588; Wed, 29 Mar 2023 17:13:35 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.161]) by smtp.corp.redhat.com (Postfix) with SMTP id 32E7F4020C82; Wed, 29 Mar 2023 17:13:30 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 29 Mar 2023 19:13:27 +0200 (CEST) Date: Wed, 29 Mar 2023 19:13:22 +0200 From: Oleg Nesterov To: Gregory Price Cc: Arnd Bergmann , Gregory Price , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linux-Arch , avagin@gmail.com, Peter Zijlstra , Andy Lutomirski , krisman@collabora.com, Thomas Gleixner , Jonathan Corbet , shuah , Catalin Marinas , Will Deacon , Mark Rutland , tongtiangen@huawei.com, Robin Murphy Subject: Re: [PATCH v14 1/4] asm-generic,arm64: create task variant of access_ok Message-ID: <20230329171322.GB4477@redhat.com> References: <20230328164811.2451-1-gregory.price@memverge.com> <20230328164811.2451-2-gregory.price@memverge.com> <20230329151515.GA913@redhat.com> <9a456346-e207-44e1-873e-40d21334e01b@app.fastmail.com> <20230329160322.GA4477@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/28, Gregory Price wrote: > > Not sure how I should proceed here, Can't we just kill this access_ok() in set_syscall_user_dispatch() ? I don't think it buys too much. Oleg. diff --git a/kernel/entry/syscall_user_dispatch.c b/kernel/entry/syscall_user_dispatch.c index 0b6379adff6b..d2e516ece52b 100644 --- a/kernel/entry/syscall_user_dispatch.c +++ b/kernel/entry/syscall_user_dispatch.c @@ -43,11 +43,7 @@ bool syscall_user_dispatch(struct pt_regs *regs) return false; if (likely(sd->selector)) { - /* - * access_ok() is performed once, at prctl time, when - * the selector is loaded by userspace. - */ - if (unlikely(__get_user(state, sd->selector))) { + if (unlikely(get_user(state, sd->selector))) { force_exit_sig(SIGSEGV); return true; } @@ -86,9 +82,6 @@ int set_syscall_user_dispatch(unsigned long mode, unsigned long offset, if (offset && offset + len <= offset) return -EINVAL; - if (selector && !access_ok(selector, sizeof(*selector))) - return -EFAULT; - break; default: return -EINVAL;