From patchwork Sun Oct 14 15:35:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 1591281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 9B29CE00AD for ; Sun, 14 Oct 2012 15:38:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TNQE5-0000ie-Ps; Sun, 14 Oct 2012 15:35:37 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TNQE1-0000iQ-PB for linux-arm-kernel@lists.infradead.org; Sun, 14 Oct 2012 15:35:35 +0000 Received: by mail-bk0-f49.google.com with SMTP id j4so1903847bkw.36 for ; Sun, 14 Oct 2012 08:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type; bh=oBULFcXD9lCznSK+EwgL8teMTneMMlwDwYIqF0nf2z0=; b=noe1K9w8lTQJWAECwFJ0oi3EyC/e72uUjzeQDrUGGUQUUDlE/c16sJJTw1e4vnQ9FK oCFa1xwEiKtEsZkaPYHYXpTF3IBp1frATOqE2TzrxdluaCjvOvCJ9AhQHcVNiimK7bQ4 n0ylR1/Tv6kZSus+4J//BbVT48ipW5of7Y9m8Z274E/r9U8Owpli4JtVjqgwaWmBUxVn CG6afDrFnvchv8q5uGcbdCBEszhV4QK8Gs4Yj/jz3PsSRXSPEq9DlTpTjwZeToBfSRqN PVmzFyPRYZ0dp/2WcXm9MyEI0UHDuWtYkU6J1AEJg0I/iKMi/KQwMbFE2tsfSbiN6h80 aHhg== Received: by 10.204.129.211 with SMTP id p19mr2589909bks.94.1350228929484; Sun, 14 Oct 2012 08:35:29 -0700 (PDT) Received: from [10.0.1.6] (i59F70D82.versanet.de. [89.247.13.130]) by mx.google.com with ESMTPS id s20sm7180159bkw.15.2012.10.14.08.35.28 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 14 Oct 2012 08:35:28 -0700 (PDT) Message-ID: <507ADBBB.9090209@gmail.com> Date: Sun, 14 Oct 2012 17:35:23 +0200 From: Daniel Mack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Al Viro Subject: Re: [git pull] signals pile 3 References: <20121013005334.GM2616@ZenIV.linux.org.uk> In-Reply-To: <20121013005334.GM2616@ZenIV.linux.org.uk> X-Enigmail-Version: 1.4.4 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zonque[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-arch@vger.kernel.org, Russell King - ARM Linux , Linus Torvalds , linux-kernel@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi Al, On 13.10.2012 02:53, Al Viro wrote: > The last bits of infrastructure for kernel_thread() et.al., with alpha/arm/x86 > use of those. Plus sanitizing the asm glue and do_notify_resume() on alpha, > fixing the "disabled irq while running task_work stuff" breakage there. > > At that point the rest of kernel_thread/kernel_execve/sys_execve work can > be done independently for different architectures. The only pending bits > that do depend on having all architectures converted are restrictred to > fs/* and kernel/* - that'll obviously have to wait for the next cycle. > I thought we'd have to wait for all of them done before we start eliminating > the longjump-style insanity in kernel_execve(), but it turned out there's > a very simple way to do that without flagday-style changes. > > Please, pull from > git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal for-linus > > Shortlog: > Al Viro (12): [...] > arm: switch to saner kernel_execve() semantics [...] > Diffstat: [...] > arch/arm/include/asm/unistd.h | 1 - > arch/arm/kernel/entry-common.S | 29 +-------- > arch/arm/kernel/process.c | 5 +- I rebased my ARM development branch and figured that your patch 9fff2fa ("arm: switch to saner kernel_execve() semantics") breaks the boot on my board right after init is invoked via NFS: [ 4.682072] VFS: Mounted root (nfs filesystem) on device 0:12. [ 4.690744] devtmpfs: mounted [ 4.694395] Freeing init memory: 172K [ 5.291417] Internal error: Oops - undefined instruction: 0 [#1] SMP THUMB2 [ 5.298734] Modules linked in: [ 5.301952] CPU: 0 Not tainted (3.6.0-11053-g56c8535 #128) [ 5.308071] PC is at cpsw_probe+0x422/0x9ac [ 5.312459] LR is at trace_hardirqs_on_caller+0x8f/0xfc [ 5.317934] pc : [] lr : [] psr: 60000113 [ 5.317934] sp : cf055fb0 ip : 00000000 fp : 00000000 [ 5.329944] r10: 00000000 r9 : 00000000 r8 : 00000000 [ 5.335413] r7 : 00000000 r6 : 00000000 r5 : c034458d r4 : 00000000 [ 5.342244] r3 : cf057a40 r2 : 00000000 r1 : 00000001 r0 : 00000000 [ 5.349078] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 5.356546] Control: 50c5387d Table: 8f434019 DAC: 00000015 [ 5.362562] Process init (pid: 1, stack limit = 0xcf054240) [ 5.368395] Stack: (0xcf055fb0 to 0xcf056000) [ 5.372961] 5fa0: 00000001 00000000 00000000 00000000 [ 5.381525] 5fc0: cf055fb0 c000d1a8 00000000 00000000 00000000 00000000 00000000 00000000 [ 5.390091] 5fe0: 00000000 bee83f10 00000000 b6fdedd0 00000010 00000000 aaaabfaf a8babbaa [ 5.398664] Code: 2206a010 718ef508 0184f8da f8b1f65d (3070f8d8) [ 5.405049] ---[ end trace f92e44d0ab15d037 ]--- [ 5.410424] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Looking at the patch, I see it does two things: a) kill the special treatment formerly done by ret_from_kernel_thread b) switch over to generic execve for ARM I know too little about the internals here, but reverting the latter part fixes the boot for me. Find attached the patch I used locally for that, on top of Linus' current merge tree (4d7127d). FWIW, the config I'm using is here: http://pastebin.com/JPwAYmrD I can test patches if you have any for me. Thanks, Daniel diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 261fdd0..1bc092e 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -12,7 +12,6 @@ config ARM select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select GENERIC_KERNEL_THREAD - select GENERIC_KERNEL_EXECVE select GENERIC_PCI_IOMAP select GENERIC_SMP_IDLE_THREAD select GENERIC_STRNCPY_FROM_USER diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 8f60b6e..202bc3a 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h @@ -42,6 +42,7 @@ #define __ARCH_WANT_SYS_SOCKETCALL #endif #define __ARCH_WANT_SYS_EXECVE +#define __ARCH_WANT_KERNEL_EXECVE /* * "Conditional" syscalls diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 417bac1..c05bd28 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -94,6 +94,18 @@ ENTRY(ret_from_fork) b ret_slow_syscall ENDPROC(ret_from_fork) +/* + * turn a kernel thread into userland process + * use: ret_from_kernel_execve(struct pt_regs *normal) + */ +ENTRY(ret_from_kernel_execve) + mov why, #0 @ not a syscall + str why, [r0, #S_R0] @ ... and we want 0 in ->ARM_r0 as well + get_thread_info tsk @ thread structure + mov sp, r0 @ stack pointer just under pt_regs + b ret_slow_syscall +ENDPROC(ret_from_kernel_execve) + .equ NR_syscalls,0 #define CALL(x) .equ NR_syscalls,NR_syscalls+1 #include "calls.S"