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@xxxxxxxxxxx> >> 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