From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BADCC3A5A5 for ; Thu, 5 Sep 2019 10:14:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F3AC21743 for ; Thu, 5 Sep 2019 10:14:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ra8Plhx/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F3AC21743 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=iram.es Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5GvbRXZge7ga59VNHzw5YPuNd7RYki/F8t+fMIT5/Fk=; b=ra8Plhx/6ctuoV Qff4p0Pt3AJBl009U5A7g5eqHeZNeuO99fDSGrUGw6PkHB9HIkcJhNr5uidzMUY786oRfgECVTWDl XlMRc8iF3eisk99ppxQSooB+3hd9/XB9heTU1MogskWrjZtOSrLv6KnhYCqHrFIdXGXFzFz/XsNug RcXSj1QjLkNdYfokj0KBMRTOQg+HIytOtaLfEzfkh4elEUZ2QW2MRoE56mxMlIMZYv9NAjhMVvVGf HPQ2L74P9TYcdJAQrN67xJk8C+JOrdboyzqDhRAcMX4Oys3dSfGGgPLuRfs2cXQ62d2xkecrMBfhK kJl6uWcH0kl5GnUjaFkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i5omk-0003rg-04; Thu, 05 Sep 2019 10:14:38 +0000 Received: from outbound4mad.lav.puc.rediris.es ([130.206.19.146] helo=mx01.puc.rediris.es) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i5omg-0003nb-Q0 for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2019 10:14:37 +0000 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 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-FEAS-CONTENT-MODIFICATION: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190905_031435_109467_B7BC607F X-CRM114-Status: GOOD ( 13.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Rasmus Villemoes , Alexei Starovoitov , linux-mips@vger.kernel.org, David Howells , linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, Jiri Olsa , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Tycho Andersen , Aleksa Sarai , Shuah Khan , Alexander Shishkin , Ingo Molnar , Christian Brauner , linux-xtensa@linux-xtensa.org, Kees Cook , Arnd Bergmann , Jann Horn , Oleg Nesterov , Aleksa Sarai , Al Viro , Andy Lutomirski , Shuah Khan , Namhyung Kim , David Drysdale , linux-arm-kernel@lists.infradead.org, "J. Bruce Fields" , linux-parisc@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-api@vger.kernel.org, Chanho Min , Linus Torvalds , Jeff Layton , linux-kernel@vger.kernel.org, Eric Biederman , linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, containers@lists.linux-foundation.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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." _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel