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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37420C54FAD for ; Wed, 28 Aug 2024 12:55:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A116A6B0085; Wed, 28 Aug 2024 08:55:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C18A6B0088; Wed, 28 Aug 2024 08:55:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D7CF6B0089; Wed, 28 Aug 2024 08:55:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6EBAD6B0085 for ; Wed, 28 Aug 2024 08:55:22 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1DE291A1EB7 for ; Wed, 28 Aug 2024 12:55:22 +0000 (UTC) X-FDA: 82501650084.08.7A0FFE0 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by imf25.hostedemail.com (Postfix) with ESMTP id 4F205A000C for ; Wed, 28 Aug 2024 12:55:20 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf25.hostedemail.com: domain of segher@kernel.crashing.org designates 63.228.1.57 as permitted sender) smtp.mailfrom=segher@kernel.crashing.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724849655; a=rsa-sha256; cv=none; b=YKGcaQu/z9MtArQ3V4ASBn11N6DxdW5uZl/H0dJSLTeptES1DUj97mAXP98PKKM3Qj7EGo ms+jP0aGOU6Y/DZBqinHIfUU9t87+AbeSut8uu3wmhaRgm/8f4u+WNRw6g5KNeN4PLSjVz Wtc+Obr7o73ttZ/nC5kIRbvBc4ndVNA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf25.hostedemail.com: domain of segher@kernel.crashing.org designates 63.228.1.57 as permitted sender) smtp.mailfrom=segher@kernel.crashing.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724849655; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M5Ol/050kYlS3NVHSEmUPJsNggqEGajbAkSVcjbojFo=; b=EYg/YRDoa6TEv1qIk07JkC4bDWAJWjkfPpNiRnQm9ow+m3yYMaQVuPijJScdodP1RxTttn +PLO/FmcoDlJP4pa8tz2H8jFB81aOnBosB1pwPLHTlqnX8YweUfvd86bFZKxy8ovrY2IZ/ guv42o0D0B/VT2n6HlmQ+TpTw4LmzeM= Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 47SCptJf031924; Wed, 28 Aug 2024 07:51:55 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 47SCpru5031923; Wed, 28 Aug 2024 07:51:53 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 28 Aug 2024 07:51:53 -0500 From: Segher Boessenkool To: "Jason A. Donenfeld" Cc: Arnd Bergmann , Eric Biggers , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , shuah , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Linux-Arch , linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom Message-ID: <20240828125153.GF29862@gate.crashing.org> References: <5deb67090b214f0e6eae96b7c406546d1a16f89b.1724309198.git.christophe.leroy@csgroup.eu> <20240827180819.GB2049@sol.localdomain> <20240827225330.GC29862@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Rspamd-Queue-Id: 4F205A000C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4xybpsstkekoaxm3f1qbwx81q9rmo4g3 X-HE-Tag: 1724849720-697443 X-HE-Meta: U2FsdGVkX19fEaEoBU1TrddhIiY6mXuD2rjTMqtV7VTPcPai5FZ2aryRd6ZYbc4FHAY4YKQ6u4YKoFnA0xkXNjrabir40zHb9wmsyKvc2y5xdr4X6LSoycU5NGRsGLlBx+sWKRO8g8H4daC7gMpaCRMCVK/lxjvIdqJv6G2/l7b7BriIV92aCgqQbhYCPIGlNYX3JBOWdzudxlAeMHxfVX5TWgs3Qnpd5dqPibtf5w9J9yNAKN4XudzLlTk5tC1xkq0pBEr4t5bQC3t2fUY2twj3xhxjR0vZmA+UptiwTBD3KSZkQaJhPjTiOTrH4T7+FR0nkhj2CYMhsQ1MGLe3LWoXvlV+z5lo6GZGs+jnchZwT5HLlLWLGZZJf8cHGzkKIQDnQBWliJiTcQlk9Rr0ZkN/XIr4tXdnIBYg8zwBxF4u1sSofwcTs5hrrBlWZKofXSRlH1ZPGF4rAqQVObJrTTZOlTTrL1phopbXebWzDq4I4gyaVQPXMI257D9KX+tQliz6LUgRQf913AaEK6ByQ1vdQZbv+2x7ML2x/X4HDOT6kT/1X+RYc+KtBn8uE8/lNCt/D7aQU1GqXBV66Nb2dE3KVN5asSLJnssCm1wST56Gk0oyDmJBJN79Ypij8EQVpxDdqapvxtzE49Wffkncv3sWoGHqDLYzMNRK3TEtg7PNpd5PulPgVybO81JwfR09fBacClJIjBHwo9PbKQQSw9/cBf5dbwkKzO6U3FAOA2gvidOibgV+WzFipgjslV4p/2K6KkVgvtnvyRscXcoAvCMllQh/b/Kvv/POnrhAXQeD75skYb5k/y0wPD64m7cxXxYFHm4esLdTpsnMMEDhOZl+iAEFZP9j/rJ+GzlOHhprhH6lLkE7EfzLpPXQh02MMNF6B3ClmTCZOLiZxVCei/6mcXusSsoHH+ad+FHR3heZD1GNin/sQa+NV4phy9fw2I9phl6Dd36IJulFoCU iwKSLytc rOoOM2rMfxsRUWX7PkJ6sDk3U3BkwkKArrpDK9IxfEp0qbHytYzCGmIZ3LQgzwHoXvkEBL1FeCYET+s8E8RadwKefW5ykB3M5GGtRX8Ec4uqXo9lFNsii87HGeQRkTdLzF6D4tW/IU6rgEFLC8qjRWCpWtxL2S69Jc4tZ+llgL3cdtzkLEbY8HcSjwiTNzVG+1uMz X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Aug 28, 2024 at 02:26:08PM +0200, Jason A. Donenfeld wrote: > On Wed, Aug 28, 2024 at 2:24 PM Arnd Bergmann wrote: > > > > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > >> On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > > >> > > > >> > Is there a compiler flag that could be used to disable the generation of calls > > >> > to memset? > > >> > > >> -fno-tree-loop-distribute-patterns . But, as always, read up on it, see > > >> what it actually does (and how it avoids your problem, and mostly: learn > > >> what the actual problem *was*!) > > > > > > This might help with various loops, but it doesn't help with the matter > > > that this patch fixes, which is struct initialization. I just tried it > > > with the arm64 patch to no avail. > > > > Maybe -ffreestanding can help here? That should cause the vdso to be built > > with the assumption that there is no libc, so it would neither add nor > > remove standard library calls. Not sure if that causes other problems, > > e.g. if the calling conventions are different. > > >From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90701: > > | You need -ffreestanding but that is documented to emit memset and > memcpy still. Yeah. '-nostdlib' Do not use the standard system startup files or libraries when linking. This won't help a bit, the compiler will still optimise your initialisation loop to a memset() call, it just won't link to libgcc.a and crt*.o and its ilk (which is not where mem* are implemented in the first place!) Segher