[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<BYAPR12MB320544939A73966CC84D5020D5DE2@BYAPR12MB3205.namprd12.prod.outlook.com>
Date: Tue, 18 Mar 2025 12:46:13 +0000
From: Stephen Eta Zhou <stephen.eta.zhou@...look.com>
To: Krzysztof Kozlowski <krzk@...nel.org>, David Disseldorp <ddiss@...e.de>
CC: "jsperbeck@...gle.com" <jsperbeck@...gle.com>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>, "gregkh@...uxfoundation.org"
<gregkh@...uxfoundation.org>, "lukas@...ner.de" <lukas@...ner.de>,
"wufan@...ux.microsoft.com" <wufan@...ux.microsoft.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [RFC PATCH] initramfs: Add size validation to prevent tmpfs
exhaustion
Hi Krzysztof
> 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.
Sorry, this is my oversight.....
I checked it locally using checkpatch.pl and it was fine, but I just used it to import and found that there is a problem. Sorry for wasting your time. I will regenerate this patch and resend it in the correct format.
Krzysztof, thanks for pointing this out.
Thanks,
Stephen
________________________________________
From: Krzysztof Kozlowski <krzk@...nel.org>
Sent: Tuesday, March 18, 2025 19:55
To: David Disseldorp <ddiss@...e.de>; Stephen Eta Zhou <stephen.eta.zhou@...look.com>
Cc: jsperbeck@...gle.com <jsperbeck@...gle.com>; akpm@...ux-foundation.org <akpm@...ux-foundation.org>; gregkh@...uxfoundation.org <gregkh@...uxfoundation.org>; lukas@...ner.de <lukas@...ner.de>; wufan@...ux.microsoft.com <wufan@...ux.microsoft.com>; linux-kernel@...r.kernel.org <linux-kernel@...r.kernel.org>; linux-fsdevel@...r.kernel.org <linux-fsdevel@...r.kernel.org>
Subject: Re: [RFC PATCH] initramfs: Add size validation to prevent tmpfs exhaustion
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@...look.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
Powered by blists - more mailing lists