From owner-freebsd-emulation@FreeBSD.ORG Sun Apr 13 20:42:40 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70D5B1065670 for ; Sun, 13 Apr 2008 20:42:40 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mx1.freebsd.org (Postfix) with ESMTP id 7F9288FC23 for ; Sun, 13 Apr 2008 20:42:36 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by fg-out-1718.google.com with SMTP id 16so1448639fgg.35 for ; Sun, 13 Apr 2008 13:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type:from; bh=F+M1WZu53RDYubJNARcG8ZmsmeVDafupf2XBEey9j7E=; b=FlrhzRD/HuHFpzjYbO8pHBywFeWn8o4MbUi/q+zz+CMBMAgL7GhSe6REg2rKfZHpWDnM+c4Q9M0Y9zTNVcBZoni5wYr2OYB/mFU8zvcm/yIi+DWAEclwN08aT8j2mQlsAE6uI5yz+dgOYVlkOOw58bqNGx1kPBJ/mxrbwHfUEHc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type:from; b=NOL1KUU1MpnuCusC5z2UwdN90ClniPelg/A+CnNSwZ9TEWwdtJmDZFUEkY5nCqE39vGgIx62VFzCAxb3fuh9jI3eZ2k5o0xlj5dAV4k7e914nssawLSUNAu1xldHuQBU9C16T9oXbZS5odSan6FW7vHZiZaus7q/a2vvzSGLT9o= Received: by 10.86.72.15 with SMTP id u15mr11704453fga.11.1208119355728; Sun, 13 Apr 2008 13:42:35 -0700 (PDT) Received: from ora.chd.net ( [81.200.6.196]) by mx.google.com with ESMTPS id l19sm4700670fgb.0.2008.04.13.13.42.33 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 13 Apr 2008 13:42:33 -0700 (PDT) Date: Mon, 14 Apr 2008 00:42:29 +0400 (MSD) To: Kostik Belousov In-Reply-To: <20080413192614.GC18958@deviant.kiev.zoral.com.ua> Message-ID: <20080413234359.H1165@ora.chd.net> References: <20080412181712.Y38920@ora.chd.net> <20080412145401.GA4139@freebsd.org> <20080413214624.S7426@ora.chd.net> <20080413183248.GA68642@freebsd.org> <20080413183659.GA18958@deviant.kiev.zoral.com.ua> <20080413231135.K1079@ora.chd.net> <20080413192614.GC18958@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed From: Chagin Dmitry Cc: freebsd-emulation@freebsd.org, Chagin Dmitry Subject: Re: Call for review && test: linux_kdump-1.6 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Apr 2008 20:42:40 -0000 On Sun, 13 Apr 2008, Kostik Belousov wrote: > On Sun, Apr 13, 2008 at 11:11:55PM +0400, Chagin Dmitry wrote: >> On Sun, 13 Apr 2008, Kostik Belousov wrote: >> >>> On Sun, Apr 13, 2008 at 08:32:48PM +0200, Roman Divacky wrote: >>>> On Sun, Apr 13, 2008 at 09:58:08PM +0400, Chagin Dmitry wrote: >>>>> On Sat, 12 Apr 2008, Roman Divacky wrote: >>>>> >>>>>>> And question: whether i can add to linuxolator some ktr_struct >>>>>>> functionality? >>>>>> >>>>>> sure... please provide a patch and I'll take care about it. >>>>> >>>>> ok, thnx :) >>>>> what about EJUSTRETURN? >>>>> i attached simple patch for demo only (not tested). >>>> >>>> uh... can you provide diff -u ? I dont understand the diff at all ;) >>> >>> Also, please note that the ML software strips your attachments. Either >>> inline the patch, or use the plain-text content-type for it. >>> >> >> ups... ah google )) >> i have understood, sorry and thnx. >> Speech about that in linux_kdump it is impossible to distinguish >> EJUSTRETURN from a real error. look: >> >> --- sys/i386/i386/trap.c.orig 2008-04-13 21:39:18.000000000 +0400 >> +++ sys/i386/i386/trap.c 2008-04-13 22:35:25.000000000 +0400 >> @@ -1091,8 +1091,12 @@ >> td->td_proc->p_pid, td->td_name, code); >> >> #ifdef KTRACE >> - if (KTRPOINT(td, KTR_SYSRET)) >> - ktrsysret(code, error, td->td_retval[0]); >> + if (KTRPOINT(td, KTR_SYSRET)) { >> + if (error == EJUSTRETURN) >> + ktrsysret(code, 0, td->td_retval[0]); >> + else >> + ktrsysret(code, error, td->td_retval[0]); >> + } >> #endif >> >> /* >> @@ -1104,4 +1108,3 @@ >> >> PTRACESTOP_SC(p, td, S_PT_SCX); >> } >> - > > I do not quite understand the intent of this change. > > EJUSTRETURN is used for two different purposes in the kernel. > 1. The sigreturn family of the syscalls use it after the interrupted > frame is restored to avoid the normal syscall return sequence to modify > the machine state. > 2. It is used by the kernel to notify the in-kernel caller code about > some special condition, that nonetheless shall not be returned to the > userspace. > > Only the first case is applicable to the kdump, and IMHO you actually > destroy some information, since error == EJUSTRETURN is reported as 0. > > Could you, please, provide some more arguments in the support of your > proposed change ? > Thanks for you informative reply Kostya. The problem arises only in linux_kdump. Because linux error codes negative and EJUSTRETURN coincides with ENOENT. Before a call ktr_sysret we decode return codes of emulators syscalls. The following patch should solve a problem, but i did not test it. --- sys/i386/i386/trap.c.orig 2008-04-13 21:39:18.000000000 +0400 +++ sys/i386/i386/trap.c 2008-04-14 00:16:13.000000000 +0400 @@ -1027,6 +1027,11 @@ AUDIT_SYSCALL_EXIT(error, td); } +#ifdef KTRACE + if (KTRPOINT(td, KTR_SYSRET)) + ktrsysret(code, error, td->td_retval[0]); +#endif + switch (error) { case 0: frame->tf_eax = td->td_retval[0]; @@ -1090,11 +1095,6 @@ CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td, td->td_proc->p_pid, td->td_name, code); -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSRET)) - ktrsysret(code, error, td->td_retval[0]); -#endif - /* * This works because errno is findable through the * register set. If we ever support an emulation where this @@ -1104,4 +1104,3 @@ PTRACESTOP_SC(p, td, S_PT_SCX); } - -- Have fun! chd