瀏覽代碼

Fix signal regression.

Don Porter 7 年之前
父節點
當前提交
8084799e35
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      LibOS/shim/src/bookkeep/shim_signal.c

+ 10 - 3
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;
         }