2014-03-28 Corinna Vinschen <corinna@vinschen.de>

* sec_auth.cc (create_token): Initialize lsa handle to NULL, rather than
	to INVALID_HANDLE_VALUE.
	(lsaauth): Ditto.
	(lsaprivkeyauth): Ditto.
	* setlsapwd.cc (setlsapwd): Don't initialize lsa handle.

2014-03-28  Corinna Vinschen  <corinna@vinschen.de>

	* exceptions.cc (_cygtls::signal_debugger): Move memcpy to copy context
	from incoming siginfo_t to thread_context, too.

2014-03-27  Corinna Vinschen  <corinna@vinschen.de>

	* gendef (_sigbe/x86_64): Fix typo in .seh_proc pseudo-op.
	(setjmp/x86_64): Drop storing ExceptionList pointer in jmp_buf->Frame.
	Drop comment.  Store likely frame in rdx.  Jump to __setjmpex.
	(__setjmpex): New function providing setjmp functionality.  Fetch
	jmp_buf->Frame from rdx, like MSVCRT setjmpex.
	(__sjfault/x86_64): Store rdx content in jmp_buf->Frame.
	(__ljfault/x86_64): Don't restore ExceptionList pointer.
	(longjmp/x86_64): Ditto.
This commit is contained in:
Corinna Vinschen 2014-03-28 20:58:58 +00:00
parent 96cff0c274
commit 5d3f8dbeb0
5 changed files with 44 additions and 19 deletions

View File

@ -1,3 +1,27 @@
2014-03-28 Corinna Vinschen <corinna@vinschen.de>
* sec_auth.cc (create_token): Initialize lsa handle to NULL, rather than
to INVALID_HANDLE_VALUE.
(lsaauth): Ditto.
(lsaprivkeyauth): Ditto.
* setlsapwd.cc (setlsapwd): Don't initialize lsa handle.
2014-03-28 Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (_cygtls::signal_debugger): Move memcpy to copy context
from incoming siginfo_t to thread_context, too.
2014-03-27 Corinna Vinschen <corinna@vinschen.de>
* gendef (_sigbe/x86_64): Fix typo in .seh_proc pseudo-op.
(setjmp/x86_64): Drop storing ExceptionList pointer in jmp_buf->Frame.
Drop comment. Store likely frame in rdx. Jump to __setjmpex.
(__setjmpex): New function providing setjmp functionality. Fetch
jmp_buf->Frame from rdx, like MSVCRT setjmpex.
(__sjfault/x86_64): Store rdx content in jmp_buf->Frame.
(__ljfault/x86_64): Don't restore ExceptionList pointer.
(longjmp/x86_64): Ditto.
2014-03-19 Christopher Faylor <me.cygwin2014@cgf.cx>
* fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Actually pass ioctl

View File

@ -1487,9 +1487,7 @@ _cygtls::signal_debugger (siginfo_t& si)
{
SuspendThread (th);
c.ContextFlags = CONTEXT_FULL;
if (GetThreadContext (th, &c))
pc = &c;
else
if (!GetThreadContext (th, &c))
goto out;
if (incyg)
#ifdef __x86_64__
@ -1497,9 +1495,10 @@ _cygtls::signal_debugger (siginfo_t& si)
#else
c.Eip = retaddr ();
#endif
memcpy (&thread_context, pc, (&thread_context._internal -
(unsigned char *) &thread_context));
pc = &c;
}
memcpy (&thread_context, pc, (&thread_context._internal -
(unsigned char *) &thread_context));
#ifdef __x86_64__
char sigmsg[2 * sizeof (_CYGWIN_SIGNAL_STRING " ffffffff ffffffffffffffff")];
#else

View File

@ -164,7 +164,7 @@ _sigfe: # stack is aligned on entry!
jmp *%rax # and jmp to it
.seh_endproc
.seh_proc _sigfe
.seh_proc _sigbe
_sigbe: # return here after cygwin syscall
# stack is aligned on entry!
.seh_endprologue
@ -589,10 +589,17 @@ sub longjmp {
.seh_proc setjmp
setjmp:
.seh_endprologue
# We use the Windows jmp_buf layout. Store ExceptionList in Frame.
leaq 8(%rsp),%rdx
jmp __setjmpex
.seh_endproc
.globl __setjmpex
.seh_proc __setjmpex
__setjmpex:
.seh_endprologue
# We use the Windows jmp_buf layout.
# Store alternative stackptr in Spare.
movq %gs:0,%r10
movq %r10,(%rcx)
movq %rdx,(%rcx)
movq %rbx,0x8(%rcx)
movq %rsp,0x10(%rcx)
movq %rbp,0x18(%rcx)
@ -631,8 +638,7 @@ setjmp:
__sjfault:
.seh_endprologue
# Like setjmp, just w/o storing the alternate stackptr.
movq %gs:0,%r10
movq %r10,(%rcx)
movq %rdx,(%rcx)
movq %rbx,0x8(%rcx)
movq %rsp,0x10(%rcx)
movq %rbp,0x18(%rcx)
@ -662,8 +668,6 @@ __sjfault:
.globl __ljfault
.seh_proc __ljfault
__ljfault:
movq (%rcx),%r10
movq %r10,%gs:0
movq 0x8(%rcx),%rbx
movq 0x10(%rcx),%rsp
movq 0x18(%rcx),%rbp
@ -708,8 +712,6 @@ longjmp:
decl $tls::stacklock(%r11) # relinquish lock
xorl %r10d,%r10d
movl %r10d,$tls::incyg(%r11) # we're definitely not in cygwin anymore
movq (%rcx),%r10
movq %r10,%gs:0
movq 0x8(%rcx),%rbx
movq 0x10(%rcx),%rsp
movq 0x18(%rcx),%rbp

View File

@ -806,7 +806,7 @@ HANDLE
create_token (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
{
NTSTATUS status;
LSA_HANDLE lsa = INVALID_HANDLE_VALUE;
LSA_HANDLE lsa = NULL;
cygsidlist tmp_gsids (cygsidlist_auto, 12);
@ -970,7 +970,7 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
cygsidlist tmp_gsids (cygsidlist_auto, 12);
cygpsid pgrpsid;
LSA_STRING name;
HANDLE lsa_hdl = NULL, lsa = INVALID_HANDLE_VALUE;
HANDLE lsa_hdl = NULL, lsa = NULL;
LSA_OPERATIONAL_MODE sec_mode;
NTSTATUS status, sub_status;
ULONG package_id, size;
@ -1211,7 +1211,7 @@ HANDLE
lsaprivkeyauth (struct passwd *pw)
{
NTSTATUS status;
HANDLE lsa = INVALID_HANDLE_VALUE;
HANDLE lsa = NULL;
HANDLE token = NULL;
WCHAR sid[256];
WCHAR domain[MAX_DOMAIN_NAME_LEN + 1];

View File

@ -41,7 +41,7 @@ unsigned long
setlsapwd (const char *passwd, const char *username)
{
unsigned long ret = (unsigned long) -1;
HANDLE lsa = INVALID_HANDLE_VALUE;
HANDLE lsa;
WCHAR sid[128];
WCHAR key_name[128 + wcslen (CYGWIN_LSA_KEY_PREFIX)];
PWCHAR data_buf = NULL;