From: Krzysztof Kozlowski <krzk@kernel.org>
To: David Disseldorp <ddiss@suse.de>,
Stephen Eta Zhou <stephen.eta.zhou@outlook.com>
Cc: "jsperbeck@google.com" <jsperbeck@google.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"lukas@wunner.de" <lukas@wunner.de>,
"wufan@linux.microsoft.com" <wufan@linux.microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC PATCH] initramfs: Add size validation to prevent tmpfs exhaustion
Date: Tue, 18 Mar 2025 12:55:29 +0100 [thread overview]
Message-ID: <872d008e-8412-4351-a954-29ee7c7c8315@kernel.org> (raw)
In-Reply-To: <20250317182157.7adbc168.ddiss@suse.de>
On 17/03/2025 08:21, David Disseldorp wrote:
>> From 3499daeb5caf934f08a485027b5411f9ef82d6be Mon Sep 17 00:00:00 2001
>> From: Stephen Eta Zhou <stephen.eta.zhou@outlook.com>
>> Date: Fri, 14 Mar 2025 12:32:59 +0800
>> Subject: [PATCH] initramfs: Add size validation to prevent tmpfs exhaustion
>>
>> When initramfs is loaded into a small memory environment, if its size
>> exceeds the tmpfs max blocks limit, the loading will fail. Additionally,
>> if the required blocks are close to the tmpfs max blocks boundary,
>> subsequent drivers or subsystems using tmpfs may fail to initialize.
>>
>> To prevent this, the size limit is set to half of tmpfs max blocks.
>> This ensures that initramfs can complete its mission without exhausting
>> tmpfs resources, as user-space programs may also rely on tmpfs after boot.
>>
>> This patch adds a validation mechanism to check the decompressed size
>> of initramfs based on its compression type and ratio. If the required
>> blocks exceed half of the tmpfs max blocks limit, the loading will be
>> aborted with an appropriate error message, exposing the issue early
>> and preventing further escalation.
>
> This behaviour appears fragile and quite arbitrary. I don't think
> initramfs should be responsible for making any of these decisions.
>
> Why can't the init binary make the decision of whether or not the amount
> of free memory remaining is sufficient for user-space, instead of this
> magic 50% limit?
>
> What are you trying to achieve by failing in this way before initramfs
> extraction instead of during / after?
Just in case before anyone tries to actually apply it: the entire patch
has both corrupted header and actual patch is corrupted - all
indentation messed.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-03-18 11:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 5:04 Stephen Eta Zhou
2025-03-17 7:21 ` David Disseldorp
2025-03-17 9:41 ` Stephen Eta Zhou
2025-03-18 1:14 ` David Disseldorp
2025-03-18 4:47 ` Stephen Eta Zhou
2025-03-18 6:28 ` Stephen Eta Zhou
2025-03-18 9:51 ` David Disseldorp
2025-03-18 12:36 ` Stephen Eta Zhou
2025-03-18 11:55 ` Krzysztof Kozlowski [this message]
2025-03-18 12:46 ` Stephen Eta Zhou
2025-03-18 19:01 ` Krzysztof Kozlowski
2025-03-19 7:59 Stephen Eta Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=872d008e-8412-4351-a954-29ee7c7c8315@kernel.org \
--to=krzk@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ddiss@suse.de \
--cc=gregkh@linuxfoundation.org \
--cc=jsperbeck@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=stephen.eta.zhou@outlook.com \
--cc=wufan@linux.microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®