From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from iodev.co.uk (iodev.co.uk [46.30.189.100]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 249892E371E for ; Sat, 2 Aug 2025 03:53:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.30.189.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754106827; cv=none; b=LLt2OFvmK+Rtl6oiDq2eHYEBToOR9WXcDSWDvC/c2n/FCFhg2gi2QzPJBtOZVI1SThgwlv9Kwu3FxAy0EQGj98VMyc77HKEJzaloRlmgYzqbNM1rnLggliCI1qOGDQuzsO+Fk1DJWKpqccwRFxvVaP/wlkcBHdC5Qvp456uGAUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754106827; c=relaxed/simple; bh=A+lmip7qzu7tyufGItkTr1CMSzkI8Wa5BKlZWGCnilQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=sfyITAw7mSLuwyrCLkqAJfFI8f8ccE2A4ePSSGjIHsbwAvqwHqqeXfwHcDvQcRDKUjHFM8VKVyHteGVx0T3+dzrJTJoJtNxOQbFkSSjVvDh3JEZeDPYpOVlQou3miYNMhBozjQyFN8OPxBbU87Ecthu1EXaU0pGgiflgmQ82/LM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iodev.co.uk; spf=pass smtp.mailfrom=iodev.co.uk; arc=none smtp.client-ip=46.30.189.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iodev.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iodev.co.uk Received: from pirotess (112.red-83-45-208.dynamicip.rima-tde.net [83.45.208.112]) by iodev.co.uk (Postfix) with ESMTPSA id E10AE453C4D; Sat, 02 Aug 2025 05:53:38 +0200 (CEST) Date: Sat, 2 Aug 2025 05:53:37 +0200 From: Ismael Luceno To: YinFengwei , Kees Cook Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, zhourundong.zrd@linux.alibaba.com Subject: Re: [PATCH] binfmt_elf: remove the 4k limitation of program header size Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sat, Jul 19, 2025 at 17:17:09 +0800, YinFengwei wrote: > On Thu, Jul 17, 2025 at 04:31:50PM +0800, Kees Cook wrote: > > On Thu, 17 Jul 2025 19:01:08 +0800, fengwei_yin@linux.alibaba.com wrote: > > > We have assembly code generated by a script. GCC successfully compiles > > > it. However, the kernel cannot load it on an ARM64 platform with a 4K > > > page size. In contrast, the same ELF file loads correctly on the same > > > platform with a 64K page size. > > > > > > The root cause is the Linux kernel's ELF_MIN_ALIGN limitation on the > > > program headers of ELF files. The ELF file contains 78 program headers > > > (the script inserts many holes when generating the assembly code). On > > > ARM64 with a 4K page size, the ELF_MIN_ALLIGN enforces a maximum of 74 > > > program headers, causing the ELF file to fail. However, with a 64K page > > > size, the ELF_MIN_ALIGN is relaxed to over 1,184 program headers, allowing > > > the file to run correctly. > > > > > > [...] > > > > Applied to for-next/execve, thanks! > Cook, thanks a lot. > > Regards > Yin, Fengwei > > > > > [1/1] binfmt_elf: remove the 4k limitation of program header size > > https://git.kernel.org/kees/c/8030790477e8 > > > > Take care, Hi, I noticed this removal and wonder whether it could be a problem on smaller platforms. IIRC that code has been there since ELF support was added in one form or another; and the idea behind it was to simplify the code by ensuring no cross-page reads could happen, as these could cause undefined behaviours or read abort exceptions. Best regards.