From patchwork Thu Mar 19 10:04:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 13032 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2JA74vD003525 for ; Thu, 19 Mar 2009 10:07:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751633AbZCSKHE (ORCPT ); Thu, 19 Mar 2009 06:07:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752233AbZCSKHE (ORCPT ); Thu, 19 Mar 2009 06:07:04 -0400 Received: from wa-out-1112.google.com ([209.85.146.176]:24648 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbZCSKHC (ORCPT ); Thu, 19 Mar 2009 06:07:02 -0400 Received: by wa-out-1112.google.com with SMTP id j5so308818wah.21 for ; Thu, 19 Mar 2009 03:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=BdU6UlHBAAXnU7UTl9BTQEEOIs+JobGzxUM8vMn7sBM=; b=mfWcpheJXvL4qdb57eZneBL5xjybYM+g+jsc2NR1hJj1+pzuY28d6sVMQwq5Cdm/iD wZFwkYW/aS49KuykKH3aB04VJPzoRdavRu2NOLXqT+rwcFEZQ0e0mHd5yFM1X7qBPyXe vlVyr7QnExuUbwYC9g01Ie7u+4UqlrBvplzzk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=eqZ1m91Bi+6zDm0yHmC2FBbq6rtVCPn/u2itPrCOtBHawn4TPzqzZa94taSvWhU0Ui Jr2XHZpEMjPLE5YUyNXXwBbJV1l364MSrlye/d71gMvPNjl9WfLrIawOQNdylMOe/jz8 EH6hlgfVgJ2HrFs6xQNi+U3QxYn8yfN7WX9ho= Received: by 10.114.88.1 with SMTP id l1mr1522831wab.97.1237457220487; Thu, 19 Mar 2009 03:07:00 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id j26sm969463waf.59.2009.03.19.03.06.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 19 Mar 2009 03:06:59 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 19 Mar 2009 19:04:29 +0900 Message-Id: <20090319100429.9817.21412.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: disallow kexec virtual entry Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Older versions of kexec-tools has a zImage loader that passes a virtual address as entry point. The elf loader otoh it passes a physical address as entry point, and pages are always passed as physical addresses as well. Only allow physical addresses from now on. Signed-off-by: Magnus Damm --- arch/sh/kernel/machine_kexec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/sh/kernel/machine_kexec.c +++ work/arch/sh/kernel/machine_kexec.c 2009-03-18 20:25:56.000000000 +0900 @@ -46,6 +46,12 @@ void machine_crash_shutdown(struct pt_re */ int machine_kexec_prepare(struct kimage *image) { + /* older versions of kexec-tools are passing + * the zImage entry point as a virtual address. + */ + if (image->start != PHYSADDR(image->start)) + return -EINVAL; /* upgrade your kexec-tools */ + return 0; } @@ -125,7 +131,8 @@ void machine_kexec(struct kimage *image) /* now call it */ rnk = (relocate_new_kernel_t) reboot_code_buffer; - (*rnk)(page_list, reboot_code_buffer, image->start); + (*rnk)(page_list, reboot_code_buffer, + (unsigned long)phys_to_virt(image->start)); #ifdef CONFIG_KEXEC_JUMP asm volatile("ldc %0, vbr" : : "r" (&vbr_base) : "memory");