Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp994548rwl; Wed, 29 Mar 2023 11:03:41 -0700 (PDT) X-Google-Smtp-Source: AKy350bPchstRDKvZCTJrKee8eHVzq4m1pOZN9NF7m3ql9x9gm4zQbYdRyd6XSyvAt+EmRrIIDpE X-Received: by 2002:a17:907:d68f:b0:8c3:3439:24d9 with SMTP id wf15-20020a170907d68f00b008c3343924d9mr21782954ejc.24.1680113021365; Wed, 29 Mar 2023 11:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680113021; cv=none; d=google.com; s=arc-20160816; b=0tAUExGnurtOOEXZGFRYQysRI31vDkl6K//mh+mJBSBG3Yw4WBHCAWpE3Ulm49z6uQ mIr7/hs66O5DY2u8DklHYIowVqQWdYcq++RYEfUZFRL4elDr/2jRYaayFFZEDFDRPEAj YakPV27vcYNHM1WkLvHhHRTxqrQhpJdqJ8RnMhEnWxmE+DIQHw9WvcQnxf3nzWmMx+hE B7Tp0W9DmxxbN1pPNlRc6fbgM2srNUjGfv4670QoQY+KLWu/QV2FJiMm8esnGuZ8uIZC pPXbn5TJE+vCRrCAhdQkHA3AOKzSv5qAhsBmHlDDyRC7jKTQMCUCPJAWxcrS8QZBNpah iHqw== 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=Bjdk/0Vi9XEk8rAPBToebWaS2lMtqxl+/fQ8ndI4Fq4=; b=wv9VcFpDMs1Ifqg4DTv5FNpP4R8S3Tl6dkfFMh7blt7avSXz/dJJ8hN27+GlCVhVnJ Rl11yIPmByUNHCw/rqZNFqDF425na53klttd1HwPfRNbYkkEPqF6ruvouOI6Cp2wVStl hPacHcj+CmS0OqyLipaPjlquaPROvqGAs/beXi4TxYkZILhjYdhiqt8z45qu3A44oGV3 P1wT5PWNXcl1zWtOVnJFvMB3uXsOPcgI+t6TfXuk10wRELrn7HB+1Tvbos3ZqesdNIHU MjmPnKEX6JDTQ5CPy93mJJC/iVCb1W7gvpQwmPE3fwr4UlO8CbBA8dKzzxJt+3JbPI1y +szw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GM5J+ntd; 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 u3-20020a056402064300b005024afeb6f8si5579135edx.625.2023.03.29.11.03.14; Wed, 29 Mar 2023 11:03:41 -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=GM5J+ntd; 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 S229871AbjC2SAH (ORCPT + 99 others); Wed, 29 Mar 2023 14:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbjC2R77 (ORCPT ); Wed, 29 Mar 2023 13:59:59 -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 CBF294C05 for ; Wed, 29 Mar 2023 10:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680112749; 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=Bjdk/0Vi9XEk8rAPBToebWaS2lMtqxl+/fQ8ndI4Fq4=; b=GM5J+ntdlRaK5AftLwWQoL8pgdLFTguwrq2RKwKOBaKHUrI01eaiat5ChJoW+P8eJpFyla Q1IC0E5OxhxkeTnFIaBFCpb0zyYwfISk9j8rBFiEWFhh4PIGQTF8teVnMu519fOUbYNH7r esjapr4r8W4tKs/izHuTStZ3c0nlpLM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-203-kbDiB8jMMXGxsU4Z-OuJDA-1; Wed, 29 Mar 2023 13:59:04 -0400 X-MC-Unique: kbDiB8jMMXGxsU4Z-OuJDA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D201E3C0C8A6; Wed, 29 Mar 2023 17:59:03 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.161]) by smtp.corp.redhat.com (Postfix) with SMTP id B68761121330; Wed, 29 Mar 2023 17:58:59 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 29 Mar 2023 19:58:56 +0200 (CEST) Date: Wed, 29 Mar 2023 19:58:51 +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: <20230329175850.GA8425@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> <20230329171322.GB4477@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.3 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/29, Gregory Price wrote: > > On Wed, Mar 29, 2023 at 07:13:22PM +0200, Oleg Nesterov wrote: > > > > - if (selector && !access_ok(selector, sizeof(*selector))) > > - return -EFAULT; > > - > > break; > > default: > > return -EINVAL; > > > > The result of this would be either a task calling via prctl or a tracer > calling via ptrace would be capable of setting selector to a bad pointer > and producing a SIGSEGV on the next system call. Yes, > It's a pretty small footgun, but maybe that's reasonable? I hope this is reasonable, > From a user perspective, debugging this behavior would be nightmarish. > Your call to prctl/ptrace would succeed and the process would continue > to execute until the next syscall - at which point you incur a SIGSEGV, Yes. But how does this differ from the case when, for example, user does prtcl(PR_SET_SYSCALL_USER_DISPATCH, selector = 1) ? Or another bad address < TASK_SIZE? access_ok() will happily succeed, then later syscall_user_dispatch() will equally trigger SIGSEGV. Oleg.