Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp886513ybk; Wed, 13 May 2020 16:06:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5uTBl8WfAJADlPiCq/KB1NHu8YTjhPTpUfJ/86lD+APhel1iT9hFo7fEFg4wX9ox7kEYk X-Received: by 2002:aa7:d0d9:: with SMTP id u25mr1599741edo.377.1589411200466; Wed, 13 May 2020 16:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589411200; cv=none; d=google.com; s=arc-20160816; b=dZaISMpvr09Ali9xbWVCOj31DNQ0e5MkqnyrwlaF5pZ/RZzToD57Sl1/k2RiEplnb5 YZ4VTvEd+Xx+N6CjN34VN2JHZVUaX76cfK6DxfqtXCu8nZFmlF3iGILM/FVzPqHjSK75 QdMu2g0BWrfZ0kP24dJAPeD7+Pyj2rwuXYWLJ+q7mblewg1/T0USYu7TuuXQrRCTW7rh v1TTnTrnqnvH3dFsJVQr++uex9lKC2ATkCWDJ5dwa/ejHHguLdZC05mt2TZq9On//taA RKZT02xKuPy+8pLg1GCdI4elUAOzebOlQhQ9inkbtTmrLslPwnVKyabI2srlOoq3sQSA Ecxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ANXSyrOoz+K7OuFqVF3qInP75G80DG8bO5BLU7+1ppA=; b=BA0YtB6oER0E1ClMNAWD9NMET+WQ0QrGn3MDMu69+SsSPhMcy1wFYA6maoGLt7Jmtq 9uA8qFLWOcX2Lji2VNDQ76+WubDzP4CU4/U/br0fkoYRscPzpEAJoGj+aS/n8h39W+3Z 9WZg6ggxOZ7CSAMzu/+O1JgfsqYdQg6KGRMl+rb3KwWV1q8FJ18yBgNlK4DPXBLukzM6 sol6IUo3TlcIA/JvXGjyNQbWH8oszejC6avv7l0PS25PgvfSmX48QxNn/7EAHaYSkEP0 f54VnwU02+1A5ZvD2JP1qjPgYQIT0jq1eOJzvQcVbtF3eyFNSPFMTtbcBAC7U2VxS9zk tS2w== 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 k13si617921edn.344.2020.05.13.16.06.16; Wed, 13 May 2020 16:06:40 -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 S1732348AbgEMXEn (ORCPT + 99 others); Wed, 13 May 2020 19:04:43 -0400 Received: from www62.your-server.de ([213.133.104.62]:36932 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731815AbgEMXEn (ORCPT ); Wed, 13 May 2020 19:04:43 -0400 Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1jZ0QZ-0006AE-Sk; Thu, 14 May 2020 01:04:39 +0200 Received: from [178.196.57.75] (helo=pc-9.home) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZ0QZ-000IG3-GK; Thu, 14 May 2020 01:04:39 +0200 Subject: Re: clean up and streamline probe_kernel_* and friends v2 To: Christoph Hellwig , x86@kernel.org, Alexei Starovoitov , Masami Hiramatsu , Linus Torvalds , Andrew Morton Cc: linux-parisc@vger.kernel.org, linux-um@lists.infradead.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20200513160038.2482415-1-hch@lst.de> From: Daniel Borkmann Message-ID: <10c58b09-5ece-e49f-a7c8-2aa6dfd22fb4@iogearbox.net> Date: Thu, 14 May 2020 01:04:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200513160038.2482415-1-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.2/25811/Wed May 13 14:11:53 2020) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/13/20 6:00 PM, Christoph Hellwig wrote: > Hi all, > > this series start cleaning up the safe kernel and user memory probing > helpers in mm/maccess.c, and then allows architectures to implement > the kernel probing without overriding the address space limit and > temporarily allowing access to user memory. It then switches x86 > over to this new mechanism by reusing the unsafe_* uaccess logic. > > This version also switches to the saner copy_{from,to}_kernel_nofault > naming suggested by Linus. > > I kept the x86 helprs as-is without calling unsage_{get,put}_user as > that avoids a number of hard to trace casts, and it will still work > with the asm-goto based version easily. Aside from comments on list, the series looks reasonable to me. For BPF the bpf_probe_read() helper would be slightly penalized for probing user memory given we now test on copy_from_kernel_nofault() first and if that fails only then fall back to copy_from_user_nofault(), but it seems small enough that it shouldn't matter too much and aside from that we have the newer bpf_probe_read_kernel() and bpf_probe_read_user() anyway that BPF progs should use instead, so I think it's okay. For patch 14 and patch 15, do you roughly know the performance gain with the new probe_kernel_read_loop() + arch_kernel_read() approach? Thanks, Daniel