From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932321Ab1AKP5m (ORCPT ); Tue, 11 Jan 2011 10:57:42 -0500 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:47876 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756153Ab1AKP5k (ORCPT ); Tue, 11 Jan 2011 10:57:40 -0500 Date: Tue, 11 Jan 2011 15:57:31 +0000 From: Russell King - ARM Linux To: Alexander Holler Cc: Nicolas Pitre , linux-kernel@vger.kernel.org Subject: Re: ARM: relocation out of range (when loading a module) Message-ID: <20110111155731.GG11039@n2100.arm.linux.org.uk> References: <4D2B4CE4.9080309@ahsoftware.de> <4D2BFA08.5030104@ahsoftware.de> <4D2C7484.3050309@ahsoftware.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D2C7484.3050309@ahsoftware.de> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 11, 2011 at 04:17:24PM +0100, Alexander Holler wrote: > Thinking a bit more about that (for me unexcpected) "relocation out of > range" error when loading a module, I'm curious if there could be other > conditions which would lead to that error. Especially conditions which > could be generated by the userspace or remote from some network. It's purely about the relative position of the kernel text to the module text. Nothing outside of the compilation of the kernel will affect it. It's all to do with the branch instructions in modules having a limited range. We generally place the kernel such that it starts 32K into the kernel's system RAM mapping. We place modules immediately below this mapping. The initramfs image sits in the kernel body in the startup data, which sits between the startup text at the beginning of the kernel, and the main kernel text which follows. We _could_ rearrange the placement of these sections within the kernel image to eliminate the problem, but it's not a simple matter to just rearrange them - there's various assumptions made about the current arrangement. There's also considerations over whether that would cause additional memory to be wasted due to the alignment requirements of the various sections, and whether it would degrade the ability to get DMA-able memory on certain platforms.