Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1834125ybn; Thu, 26 Sep 2019 02:57:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTo0KaujDIDuLv4nNlx985aAYd7PbJ5llKk8u8Xo16yOB4nTupui85gdqenX4waTL4kpcX X-Received: by 2002:a50:e613:: with SMTP id y19mr2570981edm.290.1569491864573; Thu, 26 Sep 2019 02:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569491864; cv=none; d=google.com; s=arc-20160816; b=Mpn3sfSa/+4h2t646loI9eQhvHii5ZbxbcT/VyXGEegxYA48OmWvZhRh0REr01sgpB NqGC4sHIJeoz9vvHyzH8WD//bgkxNKuOqVVQJbNWHfTyfuu0XCMMLP4xfhrLV/yHDqxR 0nHt32k/VVlEy16DCknbwFsXcDgLSLApAhmHKUDxbhxtgxIor2Ml9IZ00Ik3s+usqCeL iEdAMausMoyDRNTTscrN1rZ9xDDhLdQ9MkMI/uppPGiUbyd9KVRbXSWRD6jXLuWOSVBv Cn3mxRmjfzZagCYcDioGwhf2mMS2r1I07MjeemZ3/MxoGIU+7O94QsWN4rSqKH8sf7Y7 WNeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=m3ItCLkP0Wm4Ak+WGr3LTNj+4g3loXe1oyLTxRsQI8c=; b=cjPCnnDZ2J1XH0gckClIdUee1NxJwQD3GF+sy7UiEqKpTNODYVD4BCRzO0E4oLDJED 33Wl5YS1SJ4BknYhKPe7aPomcvWzZjdUXo4387ys/XOZB/YQxKclwW45yJsV0wCwL5qY L0bd6MSXS3NCvDDg3K5oTzCt567LPpLAEOzp/I7XphQpsq7T8sMky7USfxu7GaCrKH1T hR42T1Uz1QZJ6Rds+Ytr9GSru6on32rhSmlGee0GydwmVfUxikXk5FdC9kSS59XgDx0v za/+PAV4wE4AOxjxcnwwYZUHFMUtZerzCKfjlDfy/ILvP2eI976GE4CFmnXw9I/I39Ew IhSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hW5iXNvw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si749532ejm.122.2019.09.26.02.57.21; Thu, 26 Sep 2019 02:57:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hW5iXNvw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732714AbfIYUXu (ORCPT + 99 others); Wed, 25 Sep 2019 16:23:50 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44065 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728474AbfIYUXt (ORCPT ); Wed, 25 Sep 2019 16:23:49 -0400 Received: by mail-lj1-f193.google.com with SMTP id m13so7035018ljj.11 for ; Wed, 25 Sep 2019 13:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m3ItCLkP0Wm4Ak+WGr3LTNj+4g3loXe1oyLTxRsQI8c=; b=hW5iXNvwQEuj3rT9IzVABGFeZs+xpuh7yW8suXDxSXXGJmlalPZbpXpj5zZHxO8o2h HCKtkg3kL0s9BxkQL1hAY/aXPMPIiZufFScpxUWfUWlQwP0BaCIeD26THZhs6rp5ZF5B ZT9ScEXwfZBf7u3fO0vG9M1bHCrFQHfGAS+O0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m3ItCLkP0Wm4Ak+WGr3LTNj+4g3loXe1oyLTxRsQI8c=; b=RgnsxWVlQhNW3/TbNFRgkEaWWb5H50Jnq/gTGYNHDniycUFdcgnPG7w/aht4VEHPWo RwkGJR16hzYMhRt56W3j1sJI57mEuDBqH5v7A0sXOkzrwa97Cua95bXuwWSmlPPjI+je s2i6QsNlqzPI/uZAxSv5LjcRdpL/FXtT7YmnyJrI58JWyTLCIovSK8KB5gShMSDpbKDP PRs7KqrKDZ2gupp/XjOrewfmaYL9Wy9an2lVXyN9rdWsHnIi+dPkRgotsxSt/CZQY733 mZEPx7ibCURbvbzgBzXht35AIIdLKfcuFNY0u2lNTXmoV26YU5A3vD81mzfXXrxtMBZZ UZ0Q== X-Gm-Message-State: APjAAAXpE1gmCanc+0CPvz8xvTXjibFzgqME+fw1iLC4U4cJj3D4bdoF VdHhC++UqqKav8Et8OsDU9eWlOzuYzk= X-Received: by 2002:a2e:9b5a:: with SMTP id o26mr116374ljj.158.1569443026117; Wed, 25 Sep 2019 13:23:46 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id w30sm7463lfn.82.2019.09.25.13.23.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Sep 2019 13:23:44 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id a22so7064116ljd.0 for ; Wed, 25 Sep 2019 13:23:43 -0700 (PDT) X-Received: by 2002:a2e:8789:: with SMTP id n9mr126368lji.52.1569443023576; Wed, 25 Sep 2019 13:23:43 -0700 (PDT) MIME-Version: 1.0 References: <20190925165915.8135-1-cyphar@cyphar.com> <20190925165915.8135-2-cyphar@cyphar.com> <20190925172049.skm6ohnnxpofdkzv@yavin> <20190925180412.GK26530@ZenIV.linux.org.uk> <20190925194331.GL26530@ZenIV.linux.org.uk> In-Reply-To: <20190925194331.GL26530@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 25 Sep 2019 13:23:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper To: Al Viro Cc: Aleksa Sarai , Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Christian Brauner , Rasmus Villemoes , GNU C Library , Linux API , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 25, 2019 at 12:43 PM Al Viro wrote: > > FWIW, I would probably add a kernel-space analogue of that thing at the > same time - check that an area is all-zeroes is not all that rare. Hmm. Maybe. > Another thing is that for s390 we almost certainly want something better > than word-by-word. IIRC, word-sized userland accesses really hurt there. > It's nowhere near as critical as with strncpy_from_user(), but with the > same underlying issue. Well, s390 does have those magic "area" instructions, but part of why it's expensive on s390 is that they haven't implemented the "user_access_begin()/end()' stuff. I think s390 could use that to at least minimize some of the costs. With the common case presumably being just a couple of words, it migth not be worth it doing anything more than that even on s390. Interestingly (or perhaps not) if I read the internal s390 implementation correctly, they kind of _have_ that concept and they use it internally. It's just that they call it "enable_sacf_uaccess()" and "disable_sacf_uaccess()" instead. Linus