From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ED8E244690 for ; Thu, 17 Jul 2025 23:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752795114; cv=none; b=W127Hz1jhO1AMbv9XY2WL16QhjM3tYFOGxWdbp/uDdhYvCjcDQXNR24LLRfvOQrRlNb4mC6Cc4eR1esGD7sxLA/XKOSDBEIaxVN3OQ+Sn8FLKLpIrMWT+ov+/EyePQuiTARB2FSJXjdtPywsQWrdXOZI2kVGyxU2Wr1rQyVBIPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752795114; c=relaxed/simple; bh=iXh+D68zROW/mXiFSmirv/NIXcwtO+/uj47VblBqhqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=SV45LC0LnTl5Gyl4wd4kFVjcSR2L/0q6m/mPx4rkNzjBzABPH4EaCNX04rbnFs+jjoxE1KhRV4yU3+LYfu0pGKrgiU/37NxMrdWVKZUi/m//V/qBYPXrnEq7ZJXczp0prVw+P7PbpncWqov3NFxiGlpI64qD2OCXRu7q3qv/whw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DWAXZGnF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DWAXZGnF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FDEEC4CEE3; Thu, 17 Jul 2025 23:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752795114; bh=iXh+D68zROW/mXiFSmirv/NIXcwtO+/uj47VblBqhqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWAXZGnFfOEN9+DAz0dsY+Lqoy9HA3vYyZrVuWYZ8n+ibZNbqX1r9gqtrjbUTfhO6 ZU6Oe1QQaQKvaGSpMDB3HDmU1yBbd+SvhGzFBUMwNNQ93Hzch9LYGVGRW5/MG3b5Cc tiE+1a079qDWrM3gNv1qkR2cuNn9TAVP0lq2eEzEstXJWABDn3X+5Kq8QNaEl4hEjw 7W9p4upAchQod9Zm7wS5S/OiMNhO+86XZXIdd30F9K8Av4xY8QAqL7xSqPzgr8OIus AGCy8LvPWFk9a5vSzM1s+V9O71gN4hZOXX58eOXCxjBqUJH76qohwqeq7VvK0GlLKT aiTTGIxIx4wkA== From: Kees Cook To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, fengwei_yin@linux.alibaba.com Cc: Kees Cook , zhourundong.zrd@linux.alibaba.com Subject: Re: [PATCH] binfmt_elf: remove the 4k limitation of program header size Date: Thu, 17 Jul 2025 16:31:50 -0700 Message-Id: <175279510782.2985357.8915174612817966643.b4-ty@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250717110108.55586-1-fengwei_yin@linux.alibaba.com> References: <20250717110108.55586-1-fengwei_yin@linux.alibaba.com> 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="utf-8" Content-Transfer-Encoding: 8bit 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! [1/1] binfmt_elf: remove the 4k limitation of program header size https://git.kernel.org/kees/c/8030790477e8 Take care, -- Kees Cook