From 5e2f1cbef44d64dd902e17004265ca1daf27713d Mon Sep 17 00:00:00 2001 From: Don Porter Date: Fri, 3 Mar 2017 17:47:40 -0500 Subject: [PATCH] Fix signal regression. --- LibOS/shim/src/bookkeep/shim_signal.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/LibOS/shim/src/bookkeep/shim_signal.c b/LibOS/shim/src/bookkeep/shim_signal.c index df7b2bc0..e801c617 100644 --- a/LibOS/shim/src/bookkeep/shim_signal.c +++ b/LibOS/shim/src/bookkeep/shim_signal.c @@ -263,9 +263,16 @@ internal: goto internal; } if (vma->file) { - /* XXX: need more sophisticated judgement */ - signo = SIGBUS; - code = BUS_ADRERR; + /* DEP 3/3/17: If the page fault gives a write error, and + * the VMA is read-only, return SIGSEGV+SEGV_ACCERR */ + if ((context->err & 4) && !(vma->flags & PROT_WRITE)) { + signo = SIGSEGV; + code = SEGV_ACCERR; + } else { + /* XXX: need more sophisticated judgement */ + signo = SIGBUS; + code = BUS_ADRERR; + } } else { code = SEGV_ACCERR; }