Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp742515ybe; Thu, 5 Sep 2019 05:22:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6ym0rp961ILiMntCnZLLjOTp/gKpRsD0Z9V3K9UZ5lea7glRlSwyzz07VOmqNLOwOZkIx X-Received: by 2002:a62:d45a:: with SMTP id u26mr1018856pfl.137.1567686149476; Thu, 05 Sep 2019 05:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567686149; cv=none; d=google.com; s=arc-20160816; b=k8E1zAnLYKDDLR0aKV8yrfkkVxcIQxVV2fg9/vLXyZgHQfpLTS+yLoC256EclbTCpd IJ5OHZ81xLO4lmC2pkOMBPjfYSlQKU7fUuFX1DHz5EGYSBX8BL+Qi1H5kpD+0TgPZT4Y ubkkqyvpCGH6f44WLlcmQ5udoSkm++1dU9nF+DU8nIhVc8w5tQvOMsEoQgG3Njf3gt4B agdLdt39gVqO+5qqu7DZAwBiEDZHyG/nmvnyl33qwsL7R4c4RISkH7pzyHzB/ajv1kzq U07ZDDPEozdc0t6X4egs7SgBp6KlP94wSJ2sEltXbCAPgiBAnEv/8zz6amYWmhP1+qd+ tNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MOm/ILzQjtEZAf923zAr5oR2tE8VsaxbdTHKM/NpekE=; b=c586wS9txIo8swqXioi5XDhv/CBhYYOL7CG6XVpmx0uWHczgu5H9ES90hiJmgXtWwr dmBRKHtsSacEHE8P0ggRtRD8rcbmgSuqeN1OmcngGxTdxEdVkg/adOX+5FzrV132bsPR LpE/x+G812BIhqRSggIZaRh70SWSTMpP7yEwSMxjKXQ2k8CgfduSb10DjKQGKfi9g8Hx yI78VwN6lFgeOI7VR5uTw6A40u7e81CnxCbaOi4blM7A5zEO4AKGsOcpUwCBj4sKqwPK H2Xj+B7ReEtFG3csKvgXcsNMmra4Uw65AnjxMzu6/NcH5JrL/4ZJwrb9Zfgcnvbo4YZ1 p8uw== ARC-Authentication-Results: i=1; mx.google.com; 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 h18si1966160pju.101.2019.09.05.05.22.13; Thu, 05 Sep 2019 05:22:29 -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; 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 S1733018AbfIEKPH (ORCPT + 99 others); Thu, 5 Sep 2019 06:15:07 -0400 Received: from outbound4mad.lav.puc.rediris.es ([130.206.19.146]:16868 "EHLO mx01.puc.rediris.es" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732504AbfIEKPG (ORCPT ); Thu, 5 Sep 2019 06:15:06 -0400 Received: from mta-out02.sim.rediris.es (mta-out02.sim.rediris.es [130.206.24.44]) by mx01.puc.rediris.es with ESMTP id x85ADag1012008-x85ADag3012008 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 5 Sep 2019 12:13:36 +0200 Received: from mta-out02.sim.rediris.es (localhost.localdomain [127.0.0.1]) by mta-out02.sim.rediris.es (Postfix) with ESMTPS id 655BCC7BE2B; Thu, 5 Sep 2019 12:13:30 +0200 (CEST) Received: from mta-out02.sim.rediris.es (localhost.localdomain [127.0.0.1]) by mta-out02.sim.rediris.es (Postfix) with ESMTPS id 40229C7BE2C; Thu, 5 Sep 2019 12:13:27 +0200 (CEST) Received: from lt-gp.iram.es (mrt-fw.iram.es [150.214.224.223]) by mta-out02.sim.rediris.es (Postfix) with ESMTPA id 95D21C7BE2B; Thu, 5 Sep 2019 12:13:19 +0200 (CEST) Date: Thu, 5 Sep 2019 12:13:15 +0200 From: Gabriel Paubert To: Andreas Schwab Cc: Aleksa Sarai , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Rasmus Villemoes , Alexei Starovoitov , linux-kernel@vger.kernel.org, David Howells , linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, Shuah Khan , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Tycho Andersen , Aleksa Sarai , Jiri Olsa , Alexander Shishkin , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, Kees Cook , Arnd Bergmann , Jann Horn , linuxppc-dev@lists.ozlabs.org, linux-m68k@lists.linux-m68k.org, Al Viro , Andy Lutomirski , Shuah Khan , Namhyung Kim , David Drysdale , Christian Brauner , "J. Bruce Fields" , linux-parisc@vger.kernel.org, linux-api@vger.kernel.org, Chanho Min , Jeff Layton , Oleg Nesterov , Eric Biederman , linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Linus Torvalds , containers@lists.linux-foundation.org Subject: Re: [PATCH v12 01/12] lib: introduce copy_struct_{to, from}_user helpers Message-ID: <20190905101315.GA25637@lt-gp.iram.es> References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-2-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-FEAS-CONTENT-MODIFICATION: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 05, 2019 at 11:09:35AM +0200, Andreas Schwab wrote: > On Sep 05 2019, Aleksa Sarai wrote: > > > diff --git a/lib/struct_user.c b/lib/struct_user.c > > new file mode 100644 > > index 000000000000..7301ab1bbe98 > > --- /dev/null > > +++ b/lib/struct_user.c > > @@ -0,0 +1,182 @@ > > +// SPDX-License-Identifier: GPL-2.0-or-later > > +/* > > + * Copyright (C) 2019 SUSE LLC > > + * Copyright (C) 2019 Aleksa Sarai > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define BUFFER_SIZE 64 > > + > > +/* > > + * "memset(p, 0, size)" but for user space buffers. Caller must have already > > + * checked access_ok(p, size). > > + */ > > +static int __memzero_user(void __user *p, size_t s) > > +{ > > + const char zeros[BUFFER_SIZE] = {}; > > Perhaps make that static? On SMP? It should at least be per cpu, and I'm not even sure with preemption. Gabriel > > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 > "And now for something completely different."