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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 2B3A3C4742C for ; Mon, 16 Nov 2020 07:08:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7DE42071E for ; Mon, 16 Nov 2020 07:08:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ndTAzqLl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727324AbgKPHHO (ORCPT ); Mon, 16 Nov 2020 02:07:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:41666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726831AbgKPHHO (ORCPT ); Mon, 16 Nov 2020 02:07:14 -0500 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFD542071E; Mon, 16 Nov 2020 07:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605510434; bh=wUhv9Mn+eNrkbXQGu3NZ+R9ZWyCj/ts3jsRTH9hz+Ns=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ndTAzqLlqe213Fmy+aZYw9aPe9MxpW1T9k4Sbj78839WtLoT1ekEo+e7tbfwmiAhs NM6qdv5c5BUbTDTF5Xk8vGy7UiJCccpB/G1KLQWZ3AsI/+VjrmrzBWJky/vSb1BKO2 r3ZDwt2WELWfmaSynMLewaevz75oqTrhPRCe6eWw= Date: Mon, 16 Nov 2020 16:07:10 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Linus Torvalds , LKML , Ingo Molnar , Masami Hiramatsu , Chen Yu Subject: Re: [GIT PULL] bootconfig: Extend the magic check range to the preceding 3 bytes Message-Id: <20201116160710.c088d1f6b4ab957d93f9aa13@kernel.org> In-Reply-To: <20201113130305.42284c27@oasis.local.home> References: <20201113082930.27da4612@oasis.local.home> <20201113125419.3656d001@oasis.local.home> <20201113130305.42284c27@oasis.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 Nov 2020 13:03:05 -0500 Steven Rostedt wrote: > On Fri, 13 Nov 2020 09:57:54 -0800 > Linus Torvalds wrote: > > > On Fri, Nov 13, 2020 at 9:54 AM Steven Rostedt wrote: > > > > > > The issue is that grub padded the end of the ramdisk after loading it > > > into memory. I'm not sure how the bootconfig tool can fix this. Perhaps > > > make sure the ram disk size is 4 bytes aligned? > > > > Exactly. Since - as far as I can tell - the _only_ thing that actually > > generates that BOOTCONFIG_MAGIC marker is the bootconfig tool, you > > control the vertical and the horizontal. No need for some "heuristic" > > and searching for things. > > > > And then that thing needs to be documented, so that if somebody else > > starts generating BOOTCONFIG_MAGIC markers, we have a hard rule in > > place that "look, the bootconfig is always aligned". > > > > Might as well align it more than 4 bytes while at it and make it even stricter. > > > > OK, yes I agree with this. OK, but note that the initrd_end can be modified by the bootloader anyway. The bootloader can pass any "size" bigger than actual initramfs size because initramfs is a cpio file which has a "TRAILER!!!" magic as the end of file. This means kernel can ignore or use (as the bootconfig does) for a tailing data storage. But I agree that we need to document it, so that anyone can refer the data format. > Masami, can you send a patch to fix the bootconfig tool to make sure > that when it appends to the initrd that it makes sure the file size is > aligned. Would 32 bytes be big enough for an alignment? OK, it is easy to me to update bootconfig tool to align up the total size to 32bytes, but I think 4 bytes align is OK if we document it. Without documentation, no one in the bootloader decides what is the correct format. Thank you, -- Masami Hiramatsu