Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp778188rwl; Wed, 29 Mar 2023 08:20:21 -0700 (PDT) X-Google-Smtp-Source: AK7set/AZY6B29xOmQAiui6+VU+hUN3Mn6/J27joSauij1/pESCc5LyqRrVlnrSG8yK/DaHDmkhM X-Received: by 2002:a05:6a20:8b14:b0:da:c40:8d8 with SMTP id l20-20020a056a208b1400b000da0c4008d8mr18944146pzh.4.1680103221465; Wed, 29 Mar 2023 08:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680103221; cv=none; d=google.com; s=arc-20160816; b=gb/1/7hVIo6fiAVn7fdd5SGR3q4FQLTyghNJH1/ifXuvdvz9pbsdQyB+BfiosA5o0C 0iqmeslJg5pgPWxOKkb33sFU05XcFFNdhDyyoe4FDC5fKdSRJcoVvRfbRXxCW7cvp32F hAlYoORAwAIEK/8x8IKm7/aP0xaex2YfeQ0/+SZWMt3stFKQzY+PfjKoYeFWgQMz5frF 8+QAoghxfMkra2pjuUQLcOELWo94lCwywYbLGP6eRSQ3zxdIi9R1YnnIIQqDDQn/2aTx 9uwX9zWEcmPsB15YJ++4cXU9KKjbF3kfrQw8YfX0Z7fyDXVVN3+TIad1UzBrNyjcuoik 4oiA== 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=Yn7L6Gf5Ys1fnh23z7AVkJPW9NwbK9fjx3dyKcciMAc=; b=eeBw1p+3M8XlmPQhxQshVWsJeyz7PtIxL9VKKkLH6IQDqOVoW6mqfyTdo9QyDx6Yz7 b6nDhBXcsPP/4rTJNgy0R1TJOKlwzZIsZHDzUy/wrHGMeuBS6jMcBI4S3KsKzvqpEPFG XC9KWHz2tpq1CsqeTfoosecC/s7LRA6e6Vz87basM0yFDKQJHovjSRUXkeXDGAVQrmk8 AgFgoBnPnDSi+g3JJcYAIIDfeW21pRtcKWYmNoo+PACVTxmNCjRwWCMzZA5ECSK+cHGh 2rmNh/bIS7+jBocizpigh2dKwa9gnV9P8JPQJRZGlZU+Ut8Vv1YKd0cFBnpJwI75xcQs U15g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cny+JZIv; 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 t18-20020a62d152000000b00625b9e9308esi31879192pfl.299.2023.03.29.08.20.09; Wed, 29 Mar 2023 08:20:21 -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=cny+JZIv; 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 S230154AbjC2PQu (ORCPT + 99 others); Wed, 29 Mar 2023 11:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230014AbjC2PQt (ORCPT ); Wed, 29 Mar 2023 11:16:49 -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 ESMTPS id EE39A26A1 for ; Wed, 29 Mar 2023 08:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680102961; 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=Yn7L6Gf5Ys1fnh23z7AVkJPW9NwbK9fjx3dyKcciMAc=; b=cny+JZIvPYp/Wxp0J4026GopnRHawItky3fkMbANL6K3jwL/XwFAmw6svYz8FBZ1cHL6yo no/59M9gfyhh6Hg5Prht6EmtR82QoWz2QDwHRVWADvGj5+USnamKKL/RgPqD7+5ohOh+yn Oo1Tvs9oAXGMNi48PeAncMphh/M7Ua8= 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-264-EXRMXSF_PnSmrGoNDhg8iw-1; Wed, 29 Mar 2023 11:15:54 -0400 X-MC-Unique: EXRMXSF_PnSmrGoNDhg8iw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB7092814247; Wed, 29 Mar 2023 15:15:28 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.161]) by smtp.corp.redhat.com (Postfix) with SMTP id 8A94D492C3E; Wed, 29 Mar 2023 15:15:24 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 29 Mar 2023 17:15:21 +0200 (CEST) Date: Wed, 29 Mar 2023 17:15:16 +0200 From: Oleg Nesterov To: Gregory Price Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, avagin@gmail.com, peterz@infradead.org, luto@kernel.org, krisman@collabora.com, tglx@linutronix.de, corbet@lwn.net, shuah@kernel.org, catalin.marinas@arm.com, arnd@arndb.de, will@kernel.org, mark.rutland@arm.com, tongtiangen@huawei.com, robin.murphy@arm.com, Gregory Price Subject: Re: [PATCH v14 1/4] asm-generic,arm64: create task variant of access_ok Message-ID: <20230329151515.GA913@redhat.com> References: <20230328164811.2451-1-gregory.price@memverge.com> <20230328164811.2451-2-gregory.price@memverge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230328164811.2451-2-gregory.price@memverge.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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 Hmm. I am not comfortable with this change... I won't really argue because I don't have a better solution and because I think we don't really care as long as task_set_syscall_user_dispatch() is the only user of task_access_ok(), but still... OK, so this version changes set_syscall_user_dispatch() to use task_access_ok() instead of access_ok() because task != current. On 03/28, Gregory Price wrote: > > If the architecture does not implement task_access_ok, the operation > reduces to access_ok and the task argument is discarded. No, with this patch it reduces to __access_ok(). And this already doesn't look very good to me, but this is minor. > --- a/include/asm-generic/access_ok.h > +++ b/include/asm-generic/access_ok.h > @@ -45,4 +45,14 @@ static inline int __access_ok(const void __user *ptr, unsigned long size) > #define access_ok(addr, size) likely(__access_ok(addr, size)) > #endif > > +/* > + * Some architectures may have special features (such as ARM MTE) > + * that require handling if access_ok is called on a pointer from one > + * task in the context of another. On most architectures this operation > + * is equivalent to simply __access_ok. > + */ > +#ifndef task_access_ok > +#define task_access_ok(task, addr, size) likely(__access_ok(addr, size)) > +#endif Lets ignore arm64. This look as if access_ok() or __access_ok() doesn't depend on task, but this is not true in general. Say, TASK_SIZE_MAX can check is_32bit_task() test_thread_flag(TIF_32BIT...) and this uses "current". Again, we probably do not care, but I don't like the fact task_access_ok() looks as if task_access_ok(task) returns the same result as "task" calling access_ok(). Oleg.