NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/52658: mmap() a file PaX MPROTECT can produce an unkillable process



The following reply was made to PR kern/52658; it has been noted by GNATS.

From: Utkarsh Anand <uanand009%gmail.com@localhost>
To: Kamil Rytarowski <n54%gmx.com@localhost>
Cc: gnats-bugs%netbsd.org@localhost, Dmitry Vyukov <dvyukov%google.com@localhost>
Subject: Re: kern/52658: mmap() a file PaX MPROTECT can produce an unkillable process
Date: Fri, 27 Oct 2017 17:16:14 +0530

 --94eb2c1cd14a0f0ef0055c85d640
 Content-Type: text/plain; charset="UTF-8"
 
 I just tested taylor's fix and got:
 
 # ktruss ./test
     41      1 ktruss   fcntl(0x4, 0x3, 0)          = 4194305
     41      1 ktruss   emul(netbsd)
     41      1 ktruss   fcntl(0x4, 0x4, 0x400001)   = 0
     41      1 test     execve("/root/./test", 0x7f7fff17fae8,
 0x7f7fff17faf8) JUSTRETURN
     41      1 test     emul(netbsd)
     41      1 test     mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0) =
 0x7ed0fadf0000
     41      1 test     open("/etc/ld.so.conf", 0, 0x7f7f72a11790) Err#2
 ENOENT
     41      1 test     open("/usr/lib/libc.so.12", 0, 0x3) = 3
     41      1 test     __fstat50(0x3, 0x7f7fffaa7d68) = 0
     41      1 test     mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0) = 0x7ed0fadef000
     41      1 test     munmap(0x7ed0fadef000, 0x1000) = 0
     41      1 test     mmap(0, 0x381000, 0x5, 0x15000002, 0x3, 0, 0) =
 0x7ed0faa00000
     41      1 test     mmap(0x7ed0fad61000, 0xd000, 0x3, 0x12, 0x3, 0,
 0x161000) = 0x7ed0fad61000
     41      1 test     mmap(0x7ed0fad6e000, 0x13000, 0x3, 0x1012,
 0xffffffff, 0, 0) = 0x7ed0fad6e000
     41      1 test     mprotect(0x7ed0fab61000, 0x200000, 0) = 0
     41      1 test     close(0x3)                  = 0
     41      1 test     mprotect(0x7ed0fad61000, 0x7000, 0x1) = 0
     41      1 test     _lwp_setprivate(0x7ed0fadf5048) = 0
     41      1 test     _lwp_self()                 = 1
     41      1 test     __sigprocmask14(0x1, 0x7f7fffaa8570, 0x7f7fffaa85e0)
 = 0
     41      1 test     __sigprocmask14(0x3, 0x7f7fffaa85e0, 0) = 0
     41      1 test     __sysctl(0x7ed0fab318e8, 0x2, 0x7ed0fad7eb40,
 0x7f7fffaa8508, 0, 0) = 0
     41      1 test     _lwp_self()                 = 1
     41      1 test     __sigprocmask14(0x1, 0x7f7fffaa8520, 0x7f7fffaa85e0)
 = 0
     41      1 test     __sigprocmask14(0x3, 0x7f7fffaa85e0, 0) = 0
     41      1 test     open("1234567", 0x200, 0x8) = 3
     41      1 test     mmap(0x200000, 0x2000, 0x6, 0, 0x3, 0, 0) Err#13
 EACCES
     41      1 test     _lwp_self()                 = 1
     41      1 test     __sigprocmask14(0x1, 0x7f7fffaa8550, 0x7f7fffaa8580)
 = 0
     41      1 test     __sigprocmask14(0x3, 0x7f7fffaa8580, 0) = 0
     41      1 test     _lwp_self()                 = 1
     41      1 test     __sigprocmask14(0x1, 0x7f7fffaa8550, 0x7f7fffaa8580)
 = 0
     41      1 test     __sigprocmask14(0x3, 0x7f7fffaa8580, 0) = 0
     41      1 test     exit(0)
 # ps
 PID TTY   STAT    TIME COMMAND
  42 tty00 O+   0:00.09 ps
 391 tty00 S    0:00.53 -sh
 438 tty00 Is   0:00.82 login
 442 ttyE1 Is+  0:00.08 /usr/libexec/getty Pc ttyE1
 439 ttyE2 Is+  0:00.07 /usr/libexec/getty Pc ttyE2
 445 ttyE3 Is+  0:00.07 /usr/libexec/getty Pc ttyE3
 
 I believe that fixes the problem. So I'm committing the changes.
 Thanks to all those involved.
 
 Regards,
 Utkarsh Anand
 
 --94eb2c1cd14a0f0ef0055c85d640
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: base64
 
 PGRpdiBkaXI9Imx0ciI+PGR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