From nobody Fri Dec 19 04:17:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498214740457553.1334803271635; Fri, 23 Jun 2017 03:45:40 -0700 (PDT) Received: from localhost ([::1]:34759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOM5r-0007gU-9k for importer@patchew.org; Fri, 23 Jun 2017 06:45:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOM3u-0006JB-3p for qemu-devel@nongnu.org; Fri, 23 Jun 2017 06:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOM3t-0006PD-9l for qemu-devel@nongnu.org; Fri, 23 Jun 2017 06:43:38 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:35756) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dOM3t-0006C4-4O for qemu-devel@nongnu.org; Fri, 23 Jun 2017 06:43:37 -0400 Received: from ohm.aurel32.net ([2001:bc8:30d7:111::1000]) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dOM3j-00070I-9Z; Fri, 23 Jun 2017 12:43:27 +0200 Received: from aurel32 by ohm.aurel32.net with local (Exim 4.89) (envelope-from ) id 1dOM3f-0006rJ-UJ; Fri, 23 Jun 2017 12:43:23 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Fri, 23 Jun 2017 12:42:56 +0200 Message-Id: <20170623104256.25868-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH] mips/malta: load the initrd at the end of the low memory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yongbok Kim , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently the malta board is loading the initrd just after the kernel. This doesn't work for kaslr enabled kernels, as the initrd ends-up being overwritten. Move the initrd at the end of the low memory, that should leave a sufficient gap for kaslr. Signed-off-by: Aurelien Jarno --- hw/mips/mips_malta.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 95cdabb2dd..dad2f37fb1 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -841,8 +841,9 @@ static int64_t load_kernel (void) if (loaderparams.initrd_filename) { initrd_size =3D get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { - initrd_offset =3D (kernel_high + ~INITRD_PAGE_MASK) & INITRD_P= AGE_MASK; - if (initrd_offset + initrd_size > ram_size) { + initrd_offset =3D (loaderparams.ram_low_size - initrd_size + - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; + if (kernel_high >=3D initrd_offset) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\= n", loaderparams.initrd_filename); --=20 2.11.0