Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755117AbZI3TPk (ORCPT ); Wed, 30 Sep 2009 15:15:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754906AbZI3TPj (ORCPT ); Wed, 30 Sep 2009 15:15:39 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:37132 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754686AbZI3TPi (ORCPT ); Wed, 30 Sep 2009 15:15:38 -0400 Date: Wed, 30 Sep 2009 12:14:23 -0700 (PDT) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: Arnd Bergmann cc: "H. Peter Anvin" , Arjan van de Ven , Roland McGrath , Sukadev Bhattiprolu , Containers , Nathan Lynch , linux-kernel@vger.kernel.org, "Eric W. Biederman" , mingo@elte.hu, Alexey Dobriyan , Pavel Emelyanov , linux-api@vger.kernel.org, kosaki.motohiro@jp.fujitsu.com Subject: Re: [RFC][v7][PATCH 8/9]: Define clone2() syscall In-Reply-To: <200909301959.41706.arnd@arndb.de> Message-ID: References: <20090924165548.GA16586@us.ibm.com> <200909301815.45211.arnd@arndb.de> <200909301959.41706.arnd@arndb.de> User-Agent: Alpine 2.01 (LFD 1184 2008-12-16) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 38 On Wed, 30 Sep 2009, Arnd Bergmann wrote: > > Right, you still need to save all the registers from the entry code. > I was under the wrong assumption that task_pt_regs(current) > would give the full register set on all architectures. > > However, I'd still hope that a new system call can be defined in > a way that you only need to have an assembly wrapper to save > the full pt_regs, but no arch specific code to get the syscall arguments > out of that again. In do_clone(), you need a pointer to pt_regs and > the user stack pointer, but that can be generated from > user_stack_pointer(regs). I don't think it can. You don't know what the system call stack layout is. > Does task_pt_regs(current) give the right pointer on all architectures > or do we also need to pass the regs into the syscall? I do not believe that it gives the right pointer in general. In fact, I can guarantee it doesn't. Even on x86 it only works for certain contexts (non-vm86 mode at a minimum), and on architectures like alpha it's not at all sufficient, because even if you can locate the 'pt_regs' structure, you _also_ need the extra guarantees of the pt_regs being next to the extended signal state register structure - and that only happens for magic sequences like signal handling and explicit setups like fork/clone. So I do repeat: if you think you can do all of this in generic code, then you're sadly and totally mistaken. Don't even try. It may work on some architectures, but it's simply fundamentally _wrong_. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/