Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp712160ybe; Thu, 5 Sep 2019 04:55:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHJuLRZKuJK3VJjyVb/5HukiZi3lXYXfpyBGlqb1ePtm15GC0wmLtUrvDHUufKOR/y2mQB X-Received: by 2002:a17:902:96a:: with SMTP id 97mr2932701plm.264.1567684558453; Thu, 05 Sep 2019 04:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567684558; cv=none; d=google.com; s=arc-20160816; b=S7zpWGw1np3D/JncghavJ+DcGMtp1PQWlfMppmufap+fF99rGO+zp0fZdFI0gAKEK8 D5G709UAbbNeMpHb0mn5mrEGJL315smyAIF29KgQI2T2tsWVN/96HI+ltgRv2Eo1xGmC L4V/ghYPMOEanTDB40KyBvG8UbTSInKz3m3fv/Ne5oAyBxzqbKLIQYaclPBBdGQRLHfp FTRSa7e5I4L8MaHM37K2FhEEO8SAsKP9Z7fGdbj/TbVKCWWvVf+YvjZGyQdLI99j3sko Ku21zfexPuWWYwE/htwXCzjgxKsvC0nvN/MqNWsO8dQkWbxS7XrUoNLzOF8JHL2N5lgL jQeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=KRsLiQhs91joz8+mgfR7S/GJqPaYsuv1H/SuDnexGIE=; b=cFY+WtuTRCeEjVF4KaYWX5pRxXwJvPnaUiOBq6/b4u4VnuwlI+EN2UX9eMrnwTuc3V IxyPuvjMzG+2ec6lqogD5sOBXYqULjwBqFQ5Ejmq0l+R1bslH61I+/H8c9Ya0yeWPczz iGwhVnMpNgU1h1sUjIfbel7AYMxl1lGxqcDH/qc+gO68c2Z1unCaGOLWyK+omDAUjwO2 Qbo+j2E1B1NR+0TgqwNKeH2RFbwmS3vMK18PvMYLo5ZzzU0NFVCQg2h0rwO3TISCX7JV 7FLVsIp/scMwMln1z+VN/4j911EJKNAutKd/Cb/qSMRbBsp3palIQwaHggCNBaq59N/w JvEA== 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 d8si1845522pjj.67.2019.09.05.04.55.42; Thu, 05 Sep 2019 04:55:58 -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 S1733034AbfIEJJs (ORCPT + 99 others); Thu, 5 Sep 2019 05:09:48 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:43258 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731421AbfIEJJr (ORCPT ); Thu, 5 Sep 2019 05:09:47 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46PFJ40dnZz1rK5J; Thu, 5 Sep 2019 11:09:40 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46PFJ32zjcz1qqkk; Thu, 5 Sep 2019 11:09:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id bsFr3srmzyBP; Thu, 5 Sep 2019 11:09:36 +0200 (CEST) X-Auth-Info: HjUMDzwcEehHBjaVffXZjtB4a4fj/TG0EaQI9SDHSpRwfnDQz77oFMRdUd9Aa8bN Received: from hawking (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 5 Sep 2019 11:09:36 +0200 (CEST) From: Andreas Schwab To: Aleksa Sarai Cc: Al Viro , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Christian Brauner , Rasmus Villemoes , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Aleksa Sarai , Linus Torvalds , containers@lists.linux-foundation.org, linux-alpha@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v12 01/12] lib: introduce copy_struct_{to,from}_user helpers References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-2-cyphar@cyphar.com> X-Yow: RELATIVES!! Date: Thu, 05 Sep 2019 11:09:35 +0200 In-Reply-To: <20190904201933.10736-2-cyphar@cyphar.com> (Aleksa Sarai's message of "Thu, 5 Sep 2019 06:19:22 +1000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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."