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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2888DC678D4 for ; Mon, 6 Mar 2023 09:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbjCFJfk (ORCPT ); Mon, 6 Mar 2023 04:35:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjCFJfh (ORCPT ); Mon, 6 Mar 2023 04:35:37 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D56CA275; Mon, 6 Mar 2023 01:35:33 -0800 (PST) Received: (Authenticated sender: alex@ghiti.fr) by mail.gandi.net (Postfix) with ESMTPSA id D7AAE60017; Mon, 6 Mar 2023 09:35:17 +0000 (UTC) Message-ID: Date: Mon, 6 Mar 2023 10:35:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v3 00/24] Remove COMMAND_LINE_SIZE from uapi Content-Language: en-US To: Arnd Bergmann , "H. Peter Anvin" , Palmer Dabbelt , Heiko Carstens Cc: Geert Uytterhoeven , Alexandre Ghiti , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Michal Simek , Thomas Bogendoerfer , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Albert Ou , gor@linux.ibm.com, Alexander Gordeev , borntraeger@linux.ibm.com, Sven Schnelle , ysato@users.osdn.me, Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, chris@zankel.net, Max Filippov , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, Linux-Arch References: <21F95EC4-71EA-4154-A7DC-8A5BA54F174B@zytor.com> <674bc31e-e4ed-988f-820d-54213d83f9c7@ghiti.fr> From: Alexandre Ghiti In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/3/23 17:40, Arnd Bergmann wrote: > On Fri, Mar 3, 2023, at 12:59, Alexandre Ghiti wrote: >> On 3/2/23 20:50, H. Peter Anvin wrote: >>> On March 1, 2023 7:17:18 PM PST, Palmer Dabbelt wrote: >>>>>> Commit 622021cd6c560ce7 ("s390: make command line configurable"), >>>>>> I assume? >>>>> Yes, sorry for that. I got distracted while writing and used the wrong >>>>> branch to look this up. >>>> Alex: Probably worth adding that to the list in the cover letter as it looks like you were planning on a v4 anyway (which I guess you now have to do, given that I just added the issue to RISC-V). >>> The only use that is uapi is the *default* length of the command line if the kernel header doesn't include it (in the case of x86, it is in the bzImage header, but that is atchitecture- or even boot format-specific.) >> Is COMMAND_LINE_SIZE what you call the default length? Does that mean >> that to you the patchset is wrong? > On x86, the COMMAND_LINE_SIZE value is already not part of a uapi header, > but instead (since bzImage format version 2.06) is communicated from > the kernel to the boot loader, which then knows how much data the > kernel will read (at most) from the command line. > > Most x86 kernels these days are booted using UEFI, which I think has > no such interface, the firmware just passes the command line and a > length, but has no way of knowing if the kernel will truncate this. > I think that is the same as with any other architecture that passes > the command line through UEFI, DT or ATAGS, all of which use > length/value pairs. > > Russell argued on IRC that this can be considered an ABI since a > boot loader may use its knowledge of the kernel's command line size > limit to reject long command lines. On the other hand, I don't > think that any boot loader actually does, they just trust that it > fits and don't have a good way of rejecting invalid configuration > other than truncating and/or warning. > > One notable exception I found while looking through is the old > (pre-ATAGS) parameter structure on Arm, which uses COMMAND_LINE_SIZE > as part of the structure definition. Apparently this was deprecated > 22 years ago, so hopefully the remaining riscpc and footbridge > users have all upgraded their bootloaders. > > The only other case I could find that might go wrong is > m68knommu with a few files copying a COMMAND_LINE_SIZE sized > buffer from flash into a kernel buffer: > > arch/m68k/coldfire/m5206.c:void __init config_BSP(char *commandp, int size) > arch/m68k/coldfire/m5206.c-{ > arch/m68k/coldfire/m5206.c-#if defined(CONFIG_NETtel) > arch/m68k/coldfire/m5206.c- /* Copy command line from FLASH to local buffer... */ > arch/m68k/coldfire/m5206.c- memcpy(commandp, (char *) 0xf0004000, size); > arch/m68k/coldfire/m5206.c- commandp[size-1] = 0; > arch/m68k/coldfire/m5206.c-#endif /* CONFIG_NETtel */ I see, thanks your thorough explanation: I don't see this m64k issue as a blocker (unless Geert disagrees but he already reviewed the m64k patches),  so I'll send the v5 now. Thanks again, Alex > > Arnd