Jon TURNEY | 9 Apr 15:13 2015
Picon
Gravatar

[PATCH 0/3] signal handler ucontext improvements

A few further patches improving the ucontext created for a signal handler

Jon TURNEY (3):
  Initialize context before RtlContextCapture
  Only construct ucontext for SA_SIGINFO signal handlers
  Set mcontext.cr2 to the faulting address

 winsup/cygwin/ChangeLog     | 16 +++++++++++++
 winsup/cygwin/exceptions.cc | 58 +++++++++++++++++++++++++++++----------------
 2 files changed, 54 insertions(+), 20 deletions(-)

--

-- 
2.1.4

Jon TURNEY | 2 Apr 21:30 2015
Picon
Gravatar

[PATCH] Only construct ucontext for SA_SIGINFO signal handlers

	* exceptions.cc (call_signal_handler): Only bother to construct
	the ucontext for signal handlers with SA_SIGINFO set.

Signed-off-by: Jon TURNEY <jon.turney <at> dronecode.org.uk>
---
 winsup/cygwin/ChangeLog     |  5 +++++
 winsup/cygwin/exceptions.cc | 46 ++++++++++++++++++++++++++-------------------
 2 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3b0e111..0ddc795 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
 <at>  <at>  -1,5 +1,10  <at>  <at> 
 2015-04-02  Jon TURNEY  <jon.turney <at> dronecode.org.uk>

+	* exceptions.cc (call_signal_handler): Only bother to construct
+	the ucontext for signal handlers with SA_SIGINFO set.
+
+2015-04-02  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
 	* include/cygwin/signal.h (struct __mcontext): 16-byte align.
 	* include/sys/ucontext.h (ucontext_t): Ditto.

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 0d1f36d..bac550c 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
 <at>  <at>  -1490,33 +1490,41  <at>  <at>  _cygtls::call_signal_handler ()
       siginfo_t thissi = infodata;
(Continue reading)

David A. Wheeler | 2 Apr 20:04 2015
Gravatar

[PATCH] Add FAQ entry on how Cygwin counters install and update MITM attacks

	* faq-setup.xml: Document how Cygwin secures installation and
	update against man-in-the-middle (MITM) attacks.  Note that
	setup embeds a public key to check the signature of setup.ini,
	and that setup.ini includes SHA-512 cryptographic hashes.

Signed-off-by: David A. Wheeler <dwheeler <at> dwheeler.com>
---
 winsup/doc/faq-setup.xml | 121 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 120 insertions(+), 1 deletion(-)

diff --git a/winsup/doc/faq-setup.xml b/winsup/doc/faq-setup.xml
index 614d4a9..2a4c507 100644
--- a/winsup/doc/faq-setup.xml
+++ b/winsup/doc/faq-setup.xml
 <at>  <at>  -156,6 +156,120  <at>  <at>  and that installing the older version will not help improve Cygwin.
 </para>
 </answer></qandaentry>

+<qandaentry id="faq.setup.install-security">
+<question><para>How does Cygwin secure the installation and update process?</para></question>
+<answer>
+
+<para>
+Here is how Cygwin secures the installation and update process to counter
+<ulink url="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">man-in-the-middle
(MITM) attacks</ulink>:
+</para>
+
+<orderedlist>
+<listitem><para>The Cygwin website provides the setup program
(Continue reading)

Jon TURNEY | 2 Apr 18:24 2015
Picon
Gravatar

[PATCH] Try to make sure struct _mcontext is 16-byte aligned

On x86_64, RtlCaptureContext() uses fxsave to save FPU/MMX/SSE state.

fxsave requires that the destination address is 16-byte aligned, or it will
fault.

CONTEXT is already annotated __attribute__ ((aligned (16))), do the same with
struct _mcontext.

Rearrange ucontext_t so that it's struct _mcontext element is also correctly
aligned.

	* include/cygwin/signal.h (struct __mcontext): 16-byte align.
	* include/sys/ucontext.h (ucontext_t): Ditto.

Signed-off-by: Jon TURNEY <jon.turney <at> dronecode.org.uk>
---
 winsup/cygwin/ChangeLog               | 5 +++++
 winsup/cygwin/include/cygwin/signal.h | 2 +-
 winsup/cygwin/include/sys/ucontext.h  | 4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9871b96..3b0e111 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
 <at>  <at>  -1,3 +1,8  <at>  <at> 
+2015-04-02  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* include/cygwin/signal.h (struct __mcontext): 16-byte align.
+	* include/sys/ucontext.h (ucontext_t): Ditto.
(Continue reading)

Jon TURNEY | 1 Apr 15:19 2015
Picon
Gravatar

[PATCH 0/3] Make detailed exception information available to signal handlers (v4)

Thanks for your comments so far.

Changes since v3:

Rename cr2 member of struct __ucontext to ctxflags
Add cr2 member after oldmask to struct __ucontext
Keep __COPY_CONSTRUCT_SIZE as it's historical value

Add uc_flags member to ucontext_t in case of future need
Set uc_sigmask
Use RtlCopyContext() if we don't have a context
Add a FIXME for uc_stack mentioning sigaltstack
Simplify additions to call_signal_handler() since a ucontext_t is now always passed
Just include signal.h in sys/ucontext.h

Change CW_EXCEPTION_RECORD_FROM_SIGINFO_T to return a copy of the EXCEPTION_RECORD
#define CW_EXCEPTION_RECORD_FROM_SIGINFO_T 

Jon TURNEY (3):
  Rename struct ucontext to struct __mcontext
  Provide ucontext to signal handlers
  Add cygwin_internal() operation to retrieve the EXCEPTION_RECORD from
    a siginfo_t *

 winsup/cygwin/ChangeLog               | 21 +++++++++++++++++++++
 winsup/cygwin/exception.h             |  1 +
 winsup/cygwin/exceptions.cc           | 22 ++++++++++++++++++++--
 winsup/cygwin/external.cc             | 14 ++++++++++++++
 winsup/cygwin/include/cygwin/signal.h | 28 +++++++++++++++++++---------
 winsup/cygwin/include/sys/cygwin.h    |  5 ++++-
(Continue reading)

Renato Silva | 31 Mar 20:23 2015
Picon

Fix error mapping in gethostname

The gethostname function has a problem where a small buffer size will
not produce an accurate errno. This is because the Windows error is
not being appropriately mapped. This causes programs such as hostname
from coreutils to fail because they are not informed about the long
name.

Changelog entry:
2015-03-31  Renato Silva  <br.renatosilva <at> gmail.com>
    * net.cc: Fix buffer size error handling in cygwin_gethostname.

-----

/* Test case */

#include <errno.h>
#include <stdio.h>
#include <windows.h>

int main(int argc, char **argv) {

    if (argc < 2) {
        printf("Please provide a buffer length.\n");
        return 1;
    }
    DWORD HOSTNAME_LENGTH = atoi(argv[1]);
    char hostname[HOSTNAME_LENGTH];
    char error_message[256];
    int return_value;

    printf("gethostname %s\n", gethostname(hostname, HOSTNAME_LENGTH)?
(Continue reading)

Jon TURNEY | 31 Mar 19:50 2015
Picon
Gravatar

[PATCH] Fix documentation of cygwin_internal()'s return type.

	* misc-funcs.xml (cygwin_internal): Correct return type.
---
 winsup/doc/ChangeLog      | 4 ++++
 winsup/doc/misc-funcs.xml | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index 814e651..b04210f 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
 <at>  <at>  -1,3 +1,7  <at>  <at> 
+2015-03-31  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* misc-funcs.xml (cygwin_internal): Correct return type.
+
 2015-03-13  Jon TURNEY  <jon.turney <at> dronecode.org.uk>

 	* Makefile.in (prefix): Define.
diff --git a/winsup/doc/misc-funcs.xml b/winsup/doc/misc-funcs.xml
index 06776d9..b164341 100644
--- a/winsup/doc/misc-funcs.xml
+++ b/winsup/doc/misc-funcs.xml
 <at>  <at>  -34,7 +34,7  <at>  <at>  much.</para>
 <title>cygwin_internal</title>

 <funcsynopsis><funcprototype>
-<funcdef>extern "C" DWORD
+<funcdef>extern "C" uintptr_t
 <function>cygwin_internal</function></funcdef>
 <paramdef>cygwin_getinfo_types <parameter>t</parameter></paramdef>
(Continue reading)

Jon TURNEY | 31 Mar 19:46 2015
Picon
Gravatar

[PATCH 0/3] Make detailled exception information available to signal handlers

Thanks for your help so far.  Here's another attempt at this.

Questions:

The ContextFlags member of the CONTEXT type is named cr2 in struct __mcontext. I 
don't understand how that can be right.

For a non-exception signal, we won't have aCONTEXT to provide.  Is one that is 
all zeroes acceptable?

Jon TURNEY (3):
  Rename struct ucontext to struct __mcontext
  Make mcontext and stack information available to signal handlers
  Add cygwin_internal() operation to convert siginfo_t * to
    EXCEPTION_RECORD *

 winsup/cygwin/ChangeLog               | 20 ++++++++++++++++++++
 winsup/cygwin/exception.h             |  1 +
 winsup/cygwin/exceptions.cc           | 20 ++++++++++++++++++--
 winsup/cygwin/external.cc             | 13 +++++++++++++
 winsup/cygwin/include/cygwin/signal.h | 18 +++++++++++-------
 winsup/cygwin/include/sys/cygwin.h    |  4 +++-
 winsup/cygwin/include/sys/ucontext.h  | 26 ++++++++++++++++++++++++++
 winsup/cygwin/include/ucontext.h      | 16 ++++++++++++++++
 8 files changed, 108 insertions(+), 10 deletions(-)
 create mode 100644 winsup/cygwin/include/sys/ucontext.h
 create mode 100644 winsup/cygwin/include/ucontext.h

--

-- 
2.1.4
(Continue reading)

Jon TURNEY | 26 Mar 16:25 2015
Picon
Gravatar

[PATCH] Make EXCEPTION_POINTERS available to signal handlers

Add ucontext.h header, defining ucontext_t and mcontext_t types.

Provide sigaction sighandlers with a ucontext_t parameter containing a
mcontext_t with exception context information, if available.

	* include/sys/ucontext.h (__ucontext): New header.
	* include/ucontext.h (_UCONTEXT_H): Ditto.
	* exception.h (cygwin_exception): Add exception_record accessor.
	* exceptions.cc (call_signal_handler): Provide ucontext_t
	parameter to signal handler function, if available.

Signed-off-by: Jon TURNEY <jon.turney <at> dronecode.org.uk>
---
 winsup/cygwin/ChangeLog              |  8 ++++++++
 winsup/cygwin/exception.h            |  1 +
 winsup/cygwin/exceptions.cc          | 16 ++++++++++++++--
 winsup/cygwin/include/sys/ucontext.h | 27 +++++++++++++++++++++++++++
 winsup/cygwin/include/ucontext.h     | 16 ++++++++++++++++
 5 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 winsup/cygwin/include/sys/ucontext.h
 create mode 100644 winsup/cygwin/include/ucontext.h

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 869beee..ce09390 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
 <at>  <at>  -1,3 +1,11  <at>  <at> 
+2015-03-26  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* include/sys/ucontext.h (__ucontext): New header.
(Continue reading)

Yaakov Selkowitz | 26 Mar 06:25 2015
Picon
Gravatar

[PATCH] cygwin: add GNU basename(3)

winsup/cygwin/
* common.din (__gnu_basename): Export.
* path.cc (__gnu_basename): New function.

winsup/doc/
* posix.xml (std-gnu): Add basename.
(std-notes): Add note about two forms of basename.
---
This depends on the newlib patch currently under discussion.

 winsup/cygwin/common.din |  1 +
 winsup/cygwin/path.cc    | 28 ++++++++++++++++++++++++++++
 winsup/doc/posix.xml     |  6 +++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 42098ff..f14b331 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
 <at>  <at>  -61,6 +61,7  <at>  <at>  __fsetlocking SIGFE
 __fwritable NOSIGFE
 __fwriting NOSIGFE
 __getreent NOSIGFE
+__gnu_basename NOSIGFE
 __infinity NOSIGFE
 __isinfd NOSIGFE
 __isinff NOSIGFE
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 47c687f..b05333f 100644
--- a/winsup/cygwin/path.cc
(Continue reading)

Jon TURNEY | 13 Mar 15:25 2015
Picon
Gravatar

[PATCH] Fix winsup/doc to install into prefix

By default, docdir and htmldir are defined in terms of prefix, so make sure to
define it, so their values are prefix-relative.

Without this, 'make install' installs the documentation into /share/doc/ unless
configured otherwise.

	* Makefile.in (prefix): Define.
---
 winsup/doc/ChangeLog   | 4 ++++
 winsup/doc/Makefile.in | 1 +
 2 files changed, 5 insertions(+)

diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index aefb41e..814e651 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
 <at>  <at>  -1,3 +1,7  <at>  <at> 
+2015-03-13  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* Makefile.in (prefix): Define.
+
 2015-03-12  Corinna Vinschen  <corinna <at> vinschen.de>

 	* ntsec.xml (ntsec-mapping-nsswitch-desc): Fix typo.
diff --git a/winsup/doc/Makefile.in b/winsup/doc/Makefile.in
index 55fd850..5b2f0ed 100644
--- a/winsup/doc/Makefile.in
+++ b/winsup/doc/Makefile.in
 <at>  <at>  -12,6 +12,7  <at>  <at>  SHELL =  <at> SHELL <at> 
 srcdir =  <at> srcdir <at> 
(Continue reading)


Gmane