Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2018 09:52:21 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r330338 - head/sys/amd64/amd64
Message-ID:  <e656cf9f-f4fd-9718-69d5-d0b3a737e852@FreeBSD.org>
In-Reply-To: <2557369.6nFzd3kAUm@ralph.baldwin.cx>
References:  <201803031510.w23FAbeC065867@repo.freebsd.org> <2557369.6nFzd3kAUm@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On 09/03/2018 21:22, John Baldwin wrote:
> On Saturday, March 03, 2018 03:10:37 PM Andriy Gapon wrote:
>> Author: avg
>> Date: Sat Mar  3 15:10:37 2018
>> New Revision: 330338
>> URL: https://svnweb.freebsd.org/changeset/base/330338
>>
>> Log:
>>   db_nextframe/amd64: catch up with r328083 to recognize fast_syscall_common
>>   
>>   Since that change the system call stack traces look like this:
>>     ...
>>     sys___sysctl() at sys___sysctl+0x5f/frame 0xfffffe0028e13ac0
>>     amd64_syscall() at amd64_syscall+0x79b/frame 0xfffffe0028e13bf0
>>     fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0028e13bf0
>>   So, db_nextframe() stopped recognizing the system call frame.
>>   This commit should fix that.
>>   
>>   Reviewed by:	kib
>>   MFC after:	4 days
>>
>> Modified:
>>   head/sys/amd64/amd64/db_trace.c
>>
>> Modified: head/sys/amd64/amd64/db_trace.c
>> ==============================================================================
>> --- head/sys/amd64/amd64/db_trace.c	Sat Mar  3 13:20:44 2018	(r330337)
>> +++ head/sys/amd64/amd64/db_trace.c	Sat Mar  3 15:10:37 2018	(r330338)
>> @@ -212,7 +212,9 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s
>>  		    strcmp(name, "Xcpususpend") == 0 ||
>>  		    strcmp(name, "Xrendezvous") == 0)
>>  			frame_type = INTERRUPT;
>> -		else if (strcmp(name, "Xfast_syscall") == 0)
>> +		else if (strcmp(name, "Xfast_syscall") == 0 ||
>> +		    strcmp(name, "Xfast_syscall_pti") == 0 ||
>> +		    strcmp(name, "fast_syscall_common") == 0)
>>  			frame_type = SYSCALL;
> 
> I think you actually just want to replace Xfast_syscall with
> fast_syscall_common.  Neither Xfast_syscall nor Xfast_syscall_pti call any
> functions before jumping to the common label, so when unwinding from a system
> call you should always get the common label.  (That is, I think we should
> remove Xfast_syscall and Xfast_syscall_pti here.  Any stack trace that
> happens to find those symbols during unwinding won't have a valid SYSCALL
> frame to unwind.)
> 

I kept / added those to, sort of, decouple db_nextframe from the current
implementation details.  I hope that the extra code does not create too much
overhead.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e656cf9f-f4fd-9718-69d5-d0b3a737e852>