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 AEF1CC54FA6 for ; Wed, 28 Aug 2024 12:48:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2913F6B0085; Wed, 28 Aug 2024 08:48:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2412F6B0088; Wed, 28 Aug 2024 08:48:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 130846B0089; Wed, 28 Aug 2024 08:48:51 -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 E9F4E6B0085 for ; Wed, 28 Aug 2024 08:48:50 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 88A9981B4C for ; Wed, 28 Aug 2024 12:48:50 +0000 (UTC) X-FDA: 82501633620.20.0DED678 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by imf01.hostedemail.com (Postfix) with ESMTP id C318640010 for ; Wed, 28 Aug 2024 12:48:48 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of segher@kernel.crashing.org designates 63.228.1.57 as permitted sender) smtp.mailfrom=segher@kernel.crashing.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724849285; 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: in-reply-to:in-reply-to:references:references; bh=FBPnhwC0ZlgG+MDXjjoJC+KOKIZWd8sQEhxJuByTeDA=; b=lGL9IZPmZ9t24mIyAw80Q/mC7KiL+8etDhcDCl0pd+B929wTK4pODVzdhmZaB6ZLQCzFc1 vZHIs7ucKV6mN9gJUxJCYB4fT4tqL32tRBVq0lKOdvtNy/K5CM0+TFUTpYiR/0Tf4aJFFs 8+NA9VpKrqgkFf1D+JdPmn2Hq65MSIE= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of segher@kernel.crashing.org designates 63.228.1.57 as permitted sender) smtp.mailfrom=segher@kernel.crashing.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724849285; a=rsa-sha256; cv=none; b=fkbMf0E4g9Ndr+IuGIYInipzMVxb1dQ+85zsF+3Rhn01C97RwNmQeppmscUTTguUXNAS6y QbsT15MAZn/22lE+mULVw4EULkK6v7F5vJ8TbnSlv0SWVrvux/dvTNlkUbRKwg9GhBGErJ cqv8bPIOLNvnu1J94kNwM9s4Q8qgu1Q= Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 47SCjLrv031636; Wed, 28 Aug 2024 07:45:21 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 47SCjJbM031635; Wed, 28 Aug 2024 07:45:19 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 28 Aug 2024 07:45:19 -0500 From: Segher Boessenkool To: Arnd Bergmann Cc: "Jason A . Donenfeld" , 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: <20240828124519.GE29862@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=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: C318640010 X-Stat-Signature: i954rnxsmzk51wf1ab6azz98rgj9m436 X-HE-Tag: 1724849328-175342 X-HE-Meta: U2FsdGVkX1/S+1UsbRCM6UMnaojK4uyDXhhIkdrTkzd1RI1bUFWbBpGnmz9UGVVtSHnSTY/jzoNZu89pcwAf0EEwwE1sHtb62q3FOWjDVZK8BBTqBj+OKn3+ln7mkLOrhKT6SAMGK0QGSH8Pk/MshtArE1bpV8blZ/h8eRyR1PrJrO6TM83daaD6/+hjatSKNAteEboi4tdYPSlKWs69/oW+oekcqLXdLL+rTmY+3T5FWrDrulhoA9qWF+LW1tRGarPqNPpErpiEMoAdDUnoNbpyAuL1lTdcSY6doa7ATRS3vz+7DqQZKoSYNRgiOLDfIm3VqpvSV+TtwoZEAh8XKObT5cqmkpWAQo/f85NOlLY2S8vEyYtaJID8RlAON2aZpNu50aRo5dX5D8qzFHhKc2W+dSUApGCZuNf2Z0uI7Jy6q2pa096xDuwu6LOcBjZ4BL130+2WrU7eSpxJa2NvlgSWuyZKMaYCBxuw+4xDR0iU3qM1RZFJUS33H55p6IUp2JatmUzb/RTb+OxEw5BFUn/x17dOxtTrxiJG46av1Vxssg0ygJuLgkl5O7nj4Rg5XS+Q1SxUssYP9mCZZuQkLTzjgypLfTuHvS9kFW1WOTOxwcQrtxoiZ+CiFj+3QoopQS2VcxP/wnIcqiKk4UZ488vEFZywHYWdl6W1PUzw8BK6nA/WqDTqXWmxG/7fXv7dzJrASB6w1ch5CkY4eauaRkOBQzsD7ioH+RwqkXXk9Nwqv3u5i8VwJx4+aGnQ4LwLkrf5UVYf65Zr5/I5QDp+zfc2MFKsHYmZPB7+e8YuKXdYb1HYQ4YEu2SM/iRo7Egd7HqY4DZjqVfhONFboNLG9k+jMfr6fJrPxJ7FQ0tUweNnyUMcRRJ3tMpcUbIqyA8TcC8GuWIwD0jRAUn60qcid8gnOZLxBD5HdLXgQk2NJJABHE7+WzBf1YemEWDRp1Xq8qdXyonKWEE9uJVU/hP l0gl1R4l BqvHzxYB9tTXjlfxQ6PiaekLeMy5vnsybSjTGL+7NriChlVoNtfPn4DDS3TBBcfUtZkL81IDv9goN15tJyJtFVYIstR4CN23dX65DHvmzp4Bu238= 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 12:24:12PM +0000, 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. "GCC requires the freestanding environment provide 'memcpy', 'memmove', 'memset' and 'memcmp'." This is precisely to implement things like struct initialisation. Maybe we should have a "-ffreeerstanding" or "-ffreefloating" or think of something funnier still environment as well, this problem has been there since the -ffreestanding flag has existed, but the problem is as old as the night. -fno-builtin might help a bit more, but just attack the problem at its root, like I suggested? (This isn't a new problem, originally it showed up as "GCC replaces (part of) my memcpy() implementation by a (recursive) call to memcpy()" and, well, that doesn't quite work!) Segher