From patchwork Mon Mar 25 04:29:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 1063733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44SM3z14xzz9sSd for ; Mon, 25 Mar 2019 15:39:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=russell.cc header.i=@russell.cc header.b="YqyQnv6g"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="qymQLVir"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44SM3y5Q08zDq8D for ; Mon, 25 Mar 2019 15:39:26 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=russell.cc (client-ip=66.111.4.27; helo=out3-smtp.messagingengine.com; envelope-from=ruscur@russell.cc; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=russell.cc header.i=@russell.cc header.b="YqyQnv6g"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="qymQLVir"; dkim-atps=neutral X-Greylist: delayed 573 seconds by postgrey-1.36 at bilbo; Mon, 25 Mar 2019 15:39:15 AEDT Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44SM3l4c8hzDq6Q for ; Mon, 25 Mar 2019 15:39:15 +1100 (AEDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 95EA021B2C; Mon, 25 Mar 2019 00:29:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 25 Mar 2019 00:29:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=russell.cc; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=huyTvxMKHSYky 93NPvR8+Wi2Yqn0fdXtUXNWHnmSuJs=; b=YqyQnv6gZGA2Q+dd8hWfWjS90vcbU x+gd8k9CJjg8LR0wEQUSIFpaMgUjFHF6+af90E+AeFAgwmjRSskhGaTspHUhJVa/ q96E/QsApHart7qvjMiOMW/sEPGKnkXVVH+zz809b1XE1AzXKWdnYS6kEuyV2VZ8 Bwq0MgEBPDeOFheEvFfFsDLtDg/wpSiu6AMzOOUxWeZxpkCXEtBAXTW6Qol5udjG jt3NrzKQYm0jkm/bU0oAgihv80ywhxgWTnyZajQPKDkadlujeH2oT12y2386utks 0jMSHYVyk0IOLs85dCpRPTTC5xwKOWZunxwo2gfThCHcK3Ywvd4910PXg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=huyTvxMKHSYky93NPvR8+Wi2Yqn0fdXtUXNWHnmSuJs=; b=qymQLVir uBgwyF7082ZXE/37F5XgP5v+qX3MkOrZrcuTUhiK0oiketGZqdsXqn890SI7JcEi /cgt8KH0wy1n2eeOmAv/fKH/5h5D905oWWYcrIbr0KpE50PjkUrKnTYzoMULg08H maZOefmdEKy8bX+gflGXyFhoVnsLWzmatdIw/5xmemuyZVazNpbgm3Ft53RDZC7f lxAK2mMCiCoK1CXXjU97mGLmUV94esLDIQmc/2av6Bbz7iHFhfTksYR+ImAf+v9M HvQBQyPe+9lBGGThFl9KHHR2cPGG/BX8KQmPqZLnqDYTOHCgOxVk3sT1IHVjWV/0 dzNGu73hzzUPRg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrjeejgdefkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdeftddmnecujfgurhephffvuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeftuhhsshgvlhhlucevuhhrrhgv hicuoehruhhstghurhesrhhushhsvghllhdrtggtqeenucfkphepuddvvddrleelrdekvd druddtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhhstghurhesrhhushhsvghllhdr tggtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from crackle.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id D0E6110312; Mon, 25 Mar 2019 00:29:38 -0400 (EDT) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Mon, 25 Mar 2019 15:29:29 +1100 Message-Id: <20190325042929.27508-2-ruscur@russell.cc> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190325042929.27508-1-ruscur@russell.cc> References: <20190325042929.27508-1-ruscur@russell.cc> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 2/2] external/mambo: Error out if kernel is too large X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mikey@neuling.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" If you're trying to boot a gigantic kernel in mambo (which you can reproduce by building a kernel with CONFIG_MODULES=n) you'll get misleading errors like: WARNING: 0: (0): [0:0]: Invalid/unsupported instr 0x00000000[INVALID] WARNING: 0: (0): PC(EA): 0x0000000030000010 PC(RA):0x0000000030000010 MSR: 0x9000000000000000 LR: 0x0000000000000000 WARNING: 0: (0): numInstructions = 0 WARNING: 1: (1): [0:0]: Invalid/unsupported instr 0x00000000[INVALID] WARNING: 1: (1): PC(EA): 0x0000000000000E40 PC(RA):0x0000000000000E40 MSR: 0x9000000000000000 LR: 0x0000000000000000 WARNING: 1: (1): numInstructions = 1 WARNING: 1: (1): Interrupt to 0x0000000000000E40 from 0x0000000000000E40 INFO: 1: (2): ** Execution stopped: Continuous Interrupt, Instruction caused exception, ** So add an error to skiboot.tcl to warn the user before this happens. Making PAYLOAD_ADDR further back is one way to do this but if there's a less gross way to generally work around this very niche problem, I can suggest that instead. Signed-off-by: Russell Currey Acked-by: Michael Neuling --- external/mambo/skiboot.tcl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index 096f1c34..7a939bfb 100644 --- a/external/mambo/skiboot.tcl +++ b/external/mambo/skiboot.tcl @@ -552,6 +552,10 @@ mysim memory fread $mconf(boot_load) $boot_size $mconf(boot_image) set payload_size [file size $mconf(payload)] mysim memory fread $mconf(payload_addr) $payload_size $mconf(payload) +if { $payload_size > [expr $mconf(boot_load) - $mconf(payload_addr)] } { + error "vmlinux is too large, consider adjusting PAYLOAD_ADDR" +} + # Flatten it epapr::of2dtb mysim $mconf(epapr_dt_addr)