Call for review && test: linux_kdump-1.6
Chagin Dmitry
chagin.dmitry at gmail.com
Sun Apr 13 20:42:40 UTC 2008
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
More information about the freebsd-emulation
mailing list