From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] New: Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Fri, 10 Jan 2014 13:47:01 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1944323219==" Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1944323219== Content-Type: multipart/alternative; boundary="1389361621.bD8Bf0.28454"; charset="us-ascii" --1389361621.bD8Bf0.28454 Date: Fri, 10 Jan 2014 13:47:01 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 Priority: medium Bug ID: 73473 Assignee: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Summary: Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Severity: critical Classification: Unclassified OS: Linux (All) Reporter: jaak-89mTbI93R4uuvFJfX82//w@public.gmane.org Hardware: x86-64 (AMD64) Status: NEW Version: unspecified Component: Drivers/DRI/nouveau Product: Mesa glxgears[4186]: segfault at ffffffffffffffff ip 000078805fc4b901 sp 00007ce9598e21c0 error 7 in nouveau_dri.so[78805f7d1000+136c000] Stracing it revealed that the crash happens after a mmap(NULL, 10485760, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE,MAP_ANONYMOUS, -1, 0) syscall returns -1. I think it might be caused by the return value of mmap not being checked in src/gallium/auxiliary/rtasm/rtasm_execmem.c, leading to the the memory being accessed somewhere else. So it probably needs some if (exec_mem == MAP_FAILED) check somewhere. PS: Sorry if this is not the correct component. -- You are receiving this mail because: You are the assignee for the bug. --1389361621.bD8Bf0.28454 Date: Fri, 10 Jan 2014 13:47:01 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"
Priority medium
Bug ID 73473
Assignee nouveau@lists.freedesktop.org
Summary Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c
Severity critical
Classification Unclassified
OS Linux (All)
Reporter jaak@ristioja.ee
Hardware x86-64 (AMD64)
Status NEW
Version unspecified
Component Drivers/DRI/nouveau
Product Mesa

glxgears[4186]: segfault at ffffffffffffffff ip 000078805fc4b901 sp
00007ce9598e21c0 error 7 in nouveau_dri.so[78805f7d1000+136c000]

Stracing it revealed that the crash happens after a mmap(NULL, 10485760,
PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE,MAP_ANONYMOUS, -1, 0) syscall
returns -1.

I think it might be caused by the return value of mmap not being checked in
src/gallium/auxiliary/rtasm/rtasm_execmem.c, leading to the the memory being
accessed somewhere else.

So it probably needs some

  if (exec_mem == MAP_FAILED)

check somewhere.

PS: Sorry if this is not the correct component.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389361621.bD8Bf0.28454-- --===============1944323219== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1944323219==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Fri, 10 Jan 2014 14:11:52 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1639186210==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1639186210== Content-Type: multipart/alternative; boundary="1389363111.1Cb061.32570"; charset="us-ascii" --1389363111.1Cb061.32570 Date: Fri, 10 Jan 2014 14:11:51 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #1 from Emil Velikov --- Hi Jaak If you're getting consistent crashes in glxgears I would recommend using gdb to get a backtrace of the problem. With that said, I suspect that the problems is elsewhere for a few reasons * There are more than a handful cases when mmap fails and I have yet to notice after 3+ years constant use of nouveau any glxgears segfaults. * I would suspect other mesa users will be affected and this problem would be well know/resolved by now. Apart from the backtrace would you mind attaching your dmesg output after the problem/segfault ? Can you reproduce with the swrast driver ? $ LIBGL_ALWAYS_SOFTWARE=1 glxgears Cheers -- You are receiving this mail because: You are the assignee for the bug. --1389363111.1Cb061.32570 Date: Fri, 10 Jan 2014 14:11:51 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 1 on bug 73473 from
Hi Jaak

If you're getting consistent crashes in glxgears I would recommend using gdb to
get a backtrace of the problem.

With that said, I suspect that the problems is elsewhere for a few reasons
* There are more than a handful cases when mmap fails and I have yet to notice
after 3+ years constant use of nouveau any glxgears segfaults.
* I would suspect other mesa users will be affected and this problem would be
well know/resolved by now.

Apart from the backtrace would you mind attaching your dmesg output after the
problem/segfault ?
Can you reproduce with the swrast driver ?
$ LIBGL_ALWAYS_SOFTWARE=1 glxgears

Cheers


You are receiving this mail because:
  • You are the assignee for the bug.
--1389363111.1Cb061.32570-- --===============1639186210== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1639186210==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Fri, 10 Jan 2014 15:38:53 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0448181854==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============0448181854== Content-Type: multipart/alternative; boundary="1389368332.E3ad650.13400"; charset="us-ascii" --1389368332.E3ad650.13400 Date: Fri, 10 Jan 2014 15:38:52 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #2 from Jaak Ristioja --- (In reply to comment #1) > If you're getting consistent crashes in glxgears I would recommend using gdb > to get a backtrace of the problem. I wish I could but gdb only shows ?? in backtrace: (gdb) thread apply all bt full Thread 1 (process 2782): #0 0x00006a0a172d4901 in ?? () No symbol table info available. #1 0x0000000000000000 in ?? () No symbol table info available. > With that said, I suspect that the problems is elsewhere for a few reasons > * There are more than a handful cases when mmap fails and I have yet to > notice after 3+ years constant use of nouveau any glxgears segfaults. > * I would suspect other mesa users will be affected and this problem would > be well know/resolved by now. > > Apart from the backtrace would you mind attaching your dmesg output after > the problem/segfault ? [17407.732321] grsec: From 5.4.2.83: denied RWX mmap of by /usr/bin/glxgears[glxgears:2866] uid/euid:1000/1000 gid/egid:100/100, parent /bin/bash[bash:2860] uid/euid:1000/1000 gid/egid:100/100 [17407.732328] glxgears[2866]: segfault at ffffffffffffffff ip 0000685b13c99901 sp 000077a968f66e50 error 7 in nouveau_dri.so[685b1381f000+136c000] [17407.732342] grsec: From 5.4.2.83: Segmentation fault occurred at ffffffffffffffff in /usr/bin/glxgears[glxgears:2866] uid/euid:1000/1000 gid/egid:100/100, parent /bin/bash[bash:2860] uid/euid:1000/1000 gid/egid:100/100 [17407.732356] grsec: From 5.4.2.83: denied resource overstep by requesting 4096 for RLIMIT_CORE against limit 0 for /usr/bin/glxgears[glxgears:2866] uid/euid:1000/1000 gid/egid:100/100, parent /bin/bash[bash:2860] uid/euid:1000/1000 gid/egid:100/100 So it appears to try to read memory at ffffffffffffffff (i.e. -1 alias MAP_FAILED). It doesn't matter why mmap fails (EPERM). What matters is that it is documented that it may fail, but errors do not appear to be handled in code. I don't think Gentoo should be expected to mark every single application using OpenGL to be allowed mmap RWX memory. I use Intel + OpenGL on my Gentoo Hardened laptop with no problems. > Can you reproduce with the swrast driver ? > $ LIBGL_ALWAYS_SOFTWARE=1 glxgears $ DISPLAY=:0.0 LIBGL_ALWAYS_SOFTWARE=1 glxgears; echo $? LLVM ERROR: Allocation failed when allocating new memory in the JIT Can't allocate RWX Memory: Operation not permitted 1 I'm using Hardened Gentoo (kernel is vanilla-3.12.6 + genpatches-3.12-7 + grsecurity-3.0-3.12.6-201401021726; gcc --version is "gcc (Gentoo Hardened 4.7.3-r1 p1.4, pie-0.5.5) 4.7.3"). -- You are receiving this mail because: You are the assignee for the bug. --1389368332.E3ad650.13400 Date: Fri, 10 Jan 2014 15:38:52 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 2 on bug 73473 from
(In reply to comment #1)
> If you're getting consistent crashes in glxgears I would recommend using gdb
> to get a backtrace of the problem.

I wish I could but gdb only shows ?? in backtrace:

(gdb) thread apply all bt full

Thread 1 (process 2782):
#0  0x00006a0a172d4901 in ?? ()
No symbol table info available.
#1  0x0000000000000000 in ?? ()
No symbol table info available.

> With that said, I suspect that the problems is elsewhere for a few reasons
> * There are more than a handful cases when mmap fails and I have yet to
> notice after 3+ years constant use of nouveau any glxgears segfaults.
> * I would suspect other mesa users will be affected and this problem would
> be well know/resolved by now.
> 
> Apart from the backtrace would you mind attaching your dmesg output after
> the problem/segfault ?

[17407.732321] grsec: From 5.4.2.83: denied RWX mmap of <anonymous mapping> by
/usr/bin/glxgears[glxgears:2866] uid/euid:1000/1000 gid/egid:100/100, parent
/bin/bash[bash:2860] uid/euid:1000/1000 gid/egid:100/100
[17407.732328] glxgears[2866]: segfault at ffffffffffffffff ip 0000685b13c99901
sp 000077a968f66e50 error 7 in nouveau_dri.so[685b1381f000+136c000]
[17407.732342] grsec: From 5.4.2.83: Segmentation fault occurred at
ffffffffffffffff in /usr/bin/glxgears[glxgears:2866] uid/euid:1000/1000
gid/egid:100/100, parent /bin/bash[bash:2860] uid/euid:1000/1000
gid/egid:100/100
[17407.732356] grsec: From 5.4.2.83: denied resource overstep by requesting
4096 for RLIMIT_CORE against limit 0 for /usr/bin/glxgears[glxgears:2866]
uid/euid:1000/1000 gid/egid:100/100, parent /bin/bash[bash:2860]
uid/euid:1000/1000 gid/egid:100/100

So it appears to try to read memory at ffffffffffffffff (i.e. -1 alias
MAP_FAILED). It doesn't matter why mmap fails (EPERM). What matters is that it
is documented that it may fail, but errors do not appear to be handled in code.

I don't think Gentoo should be expected to mark every single application using
OpenGL to be allowed mmap RWX memory. I use Intel + OpenGL on my Gentoo
Hardened laptop with no problems.

> Can you reproduce with the swrast driver ?
> $ LIBGL_ALWAYS_SOFTWARE=1 glxgears

$ DISPLAY=:0.0 LIBGL_ALWAYS_SOFTWARE=1 glxgears; echo $?
LLVM ERROR: Allocation failed when allocating new memory in the JIT
Can't allocate RWX Memory: Operation not permitted
1

I'm using Hardened Gentoo (kernel is vanilla-3.12.6 + genpatches-3.12-7 +
grsecurity-3.0-3.12.6-201401021726; gcc --version is "gcc (Gentoo Hardened
4.7.3-r1 p1.4, pie-0.5.5) 4.7.3").


You are receiving this mail because:
  • You are the assignee for the bug.
--1389368332.E3ad650.13400-- --===============0448181854== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============0448181854==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Fri, 10 Jan 2014 18:28:15 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1244910132==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1244910132== Content-Type: multipart/alternative; boundary="1389378495.8bEC3EE1.17376"; charset="us-ascii" --1389378495.8bEC3EE1.17376 Date: Fri, 10 Jan 2014 18:28:15 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #3 from Emil Velikov --- Created attachment 91834 --> https://bugs.freedesktop.org/attachment.cgi?id=91834&action=edit gallium/rtasm: add support for SELinux You're absolutely right here. Seems like there aren't many hardened/selinux users of the gallium drivers. The attached patch should do the job, can you give it a try ? -- You are receiving this mail because: You are the assignee for the bug. --1389378495.8bEC3EE1.17376 Date: Fri, 10 Jan 2014 18:28:15 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 3 on bug 73473 from
Created attachment 91834 [details] [review]
gallium/rtasm: add support for SELinux

You're absolutely right here. Seems like there aren't many hardened/selinux
users of the gallium drivers.

The attached patch should do the job, can you give it a try ?


You are receiving this mail because:
  • You are the assignee for the bug.
--1389378495.8bEC3EE1.17376-- --===============1244910132== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1244910132==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Sat, 11 Jan 2014 10:29:20 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1937871349==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1937871349== Content-Type: multipart/alternative; boundary="1389436159.Ee2e5bE0.464"; charset="us-ascii" --1389436159.Ee2e5bE0.464 Date: Sat, 11 Jan 2014 10:29:19 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #4 from Jaak Ristioja --- (In reply to comment #3) > Created attachment 91834 [details] [review] > gallium/rtasm: add support for SELinux > > You're absolutely right here. Seems like there aren't many hardened/selinux > users of the gallium drivers. > > The attached patch should do the job, can you give it a try ? I tried the patch on Mesa 5.1.9 under Gentoo. patching file src/gallium/auxiliary/rtasm/rtasm_execmem.c Hunk #1 succeeded at 60 (offset -1 lines). Hunk #2 succeeded at 72 (offset -1 lines). Hunk #3 succeeded at 90 (offset -1 lines). Hunk #4 succeeded at 103 (offset -1 lines). Hunk #5 succeeded at 115 (offset -1 lines). Running headless over SSH I could not verify today that the glxgears were actually shown in X, but here are the results I got: $ DISPLAY=:0.0 glxgears Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. 29168 frames in 5.0 seconds = 5833.411 FPS 29463 frames in 5.0 seconds = 5892.528 FPS ... This still gives the kernel message of RWX mmap being denied which is normal. $ DISPLAY=:0.0 LIBGL_ALWAYS_SOFTWARE=1 glxgears LLVM ERROR: Allocation failed when allocating new memory in the JIT Can't allocate RWX Memory: Operation not permitted This also gives the kernel message, but exits immediately after with exit status 1. -- You are receiving this mail because: You are the assignee for the bug. --1389436159.Ee2e5bE0.464 Date: Sat, 11 Jan 2014 10:29:19 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 4 on bug 73473 from
(In reply to comment #3)
> Created attachment 91834 [details] [review] [review]
> gallium/rtasm: add support for SELinux
> 
> You're absolutely right here. Seems like there aren't many hardened/selinux
> users of the gallium drivers.
> 
> The attached patch should do the job, can you give it a try ?

I tried the patch on Mesa 5.1.9 under Gentoo.

patching file src/gallium/auxiliary/rtasm/rtasm_execmem.c
Hunk #1 succeeded at 60 (offset -1 lines).
Hunk #2 succeeded at 72 (offset -1 lines).
Hunk #3 succeeded at 90 (offset -1 lines).
Hunk #4 succeeded at 103 (offset -1 lines).
Hunk #5 succeeded at 115 (offset -1 lines).

Running headless over SSH I could not verify today that the glxgears were
actually shown in X, but here are the results I got:

$ DISPLAY=:0.0 glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
29168 frames in 5.0 seconds = 5833.411 FPS
29463 frames in 5.0 seconds = 5892.528 FPS
...

This still gives the kernel message of RWX mmap being denied which is normal.

$ DISPLAY=:0.0 LIBGL_ALWAYS_SOFTWARE=1 glxgears
LLVM ERROR: Allocation failed when allocating new memory in the JIT
Can't allocate RWX Memory: Operation not permitted

This also gives the kernel message, but exits immediately after with exit
status 1.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389436159.Ee2e5bE0.464-- --===============1937871349== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1937871349==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Sat, 11 Jan 2014 12:22:53 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1394449528==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1394449528== Content-Type: multipart/alternative; boundary="1389442973.CbAcB50.16138"; charset="us-ascii" --1389442973.CbAcB50.16138 Date: Sat, 11 Jan 2014 12:22:53 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #5 from Jaak Ristioja --- PS: I'm not using selinux. So I guess I'm unable to test that part of the patch. -- You are receiving this mail because: You are the assignee for the bug. --1389442973.CbAcB50.16138 Date: Sat, 11 Jan 2014 12:22:53 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 5 on bug 73473 from
PS: I'm not using selinux. So I guess I'm unable to test that part of the
patch.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389442973.CbAcB50.16138-- --===============1394449528== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1394449528==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Sat, 11 Jan 2014 13:12:08 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1578006587==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1578006587== Content-Type: multipart/alternative; boundary="1389445927.311d1.22574"; charset="us-ascii" --1389445927.311d1.22574 Date: Sat, 11 Jan 2014 13:12:07 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #6 from Emil Velikov --- (In reply to comment #4) > (In reply to comment #3) > > Created attachment 91834 [details] [review] [review] > > gallium/rtasm: add support for SELinux > > > > You're absolutely right here. Seems like there aren't many hardened/selinux > > users of the gallium drivers. > > > > The attached patch should do the job, can you give it a try ? > > I tried the patch on Mesa 5.1.9 under Gentoo. > I hope you mean 9.1.5 here :) > patching file src/gallium/auxiliary/rtasm/rtasm_execmem.c > Hunk #1 succeeded at 60 (offset -1 lines). > Hunk #2 succeeded at 72 (offset -1 lines). > Hunk #3 succeeded at 90 (offset -1 lines). > Hunk #4 succeeded at 103 (offset -1 lines). > Hunk #5 succeeded at 115 (offset -1 lines). > > Running headless over SSH I could not verify today that the glxgears were > actually shown in X, but here are the results I got: > > $ DISPLAY=:0.0 glxgears > Running synchronized to the vertical refresh. The framerate should be > approximately the same as the monitor refresh rate. > 29168 frames in 5.0 seconds = 5833.411 FPS > 29463 frames in 5.0 seconds = 5892.528 FPS > ... > > This still gives the kernel message of RWX mmap being denied which is normal. > Great, thanks. > $ DISPLAY=:0.0 LIBGL_ALWAYS_SOFTWARE=1 glxgears > LLVM ERROR: Allocation failed when allocating new memory in the JIT > Can't allocate RWX Memory: Operation not permitted > > This also gives the kernel message, but exits immediately after with exit > status 1. I'm guessing that some work may be needed for LLVM. (In reply to comment #5) > PS: I'm not using selinux. So I guess I'm unable to test that part of the > patch. I thought that was the case. Either way big thanks for the report. -- You are receiving this mail because: You are the assignee for the bug. --1389445927.311d1.22574 Date: Sat, 11 Jan 2014 13:12:07 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 6 on bug 73473 from
(In reply to comment #4)
> (In reply to comment #3)
> > Created attachment 91834 [details] [review] [review] [review]
> > gallium/rtasm: add support for SELinux
> > 
> > You're absolutely right here. Seems like there aren't many hardened/selinux
> > users of the gallium drivers.
> > 
> > The attached patch should do the job, can you give it a try ?
> 
> I tried the patch on Mesa 5.1.9 under Gentoo.
> 
I hope you mean 9.1.5 here :)

> patching file src/gallium/auxiliary/rtasm/rtasm_execmem.c
> Hunk #1 succeeded at 60 (offset -1 lines).
> Hunk #2 succeeded at 72 (offset -1 lines).
> Hunk #3 succeeded at 90 (offset -1 lines).
> Hunk #4 succeeded at 103 (offset -1 lines).
> Hunk #5 succeeded at 115 (offset -1 lines).
> 
> Running headless over SSH I could not verify today that the glxgears were
> actually shown in X, but here are the results I got:
> 
> $ DISPLAY=:0.0 glxgears
> Running synchronized to the vertical refresh.  The framerate should be
> approximately the same as the monitor refresh rate.
> 29168 frames in 5.0 seconds = 5833.411 FPS
> 29463 frames in 5.0 seconds = 5892.528 FPS
> ...
> 
> This still gives the kernel message of RWX mmap being denied which is normal.
> 
Great, thanks.

> $ DISPLAY=:0.0 LIBGL_ALWAYS_SOFTWARE=1 glxgears
> LLVM ERROR: Allocation failed when allocating new memory in the JIT
> Can't allocate RWX Memory: Operation not permitted
> 
> This also gives the kernel message, but exits immediately after with exit
> status 1.
I'm guessing that some work may be needed for LLVM.

(In reply to comment #5)
> PS: I'm not using selinux. So I guess I'm unable to test that part of the
> patch.
I thought that was the case. Either way big thanks for the report.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389445927.311d1.22574-- --===============1578006587== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1578006587==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Sat, 11 Jan 2014 13:45:14 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0971347521==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============0971347521== Content-Type: multipart/alternative; boundary="1389447914.76AbE0.28251"; charset="us-ascii" --1389447914.76AbE0.28251 Date: Sat, 11 Jan 2014 13:45:14 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #7 from Jaak Ristioja --- (In reply to comment #4) > Running headless over SSH I could not verify today that the glxgears were > actually shown in X, but here are the results I got: Confirmed over SSH and VNC that glxgears works properly. -- You are receiving this mail because: You are the assignee for the bug. --1389447914.76AbE0.28251 Date: Sat, 11 Jan 2014 13:45:14 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 7 on bug 73473 from
(In reply to comment #4)
> Running headless over SSH I could not verify today that the glxgears were
> actually shown in X, but here are the results I got:

Confirmed over SSH and VNC that glxgears works properly.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389447914.76AbE0.28251-- --===============0971347521== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============0971347521==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Fri, 17 Jan 2014 19:21:04 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1124118982==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1124118982== Content-Type: multipart/alternative; boundary="1389986464.ba760a1.24419"; charset="us-ascii" --1389986464.ba760a1.24419 Date: Fri, 17 Jan 2014 19:21:04 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #8 from Amadeusz --- Created attachment 92300 --> https://bugs.freedesktop.org/attachment.cgi?id=92300&action=edit patch adding check for PaX mprotect As I said on #gentoo-hardened channel, I wouldn't like to see the SELinux part of this patch to be merged. Provided SELinux check effectively requires allowing all applications to be allowed access to write|exec memory regardless of if it is needed or not. I tested patch without the SELinux part and it worked fine on my PaX & SELinux enabled system. Starting glxgears didn't bring down whole X server as was the case before applying patch ;) . If one wants to avoid "grsec: denied RWX mmap" messages probably something along the lines of patch I attached (based on checks from the SELinux one and http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libffi/files/libffi-3.0.13-emutramp_pax_proc.patch?revision=1.2&view=markup) would be needed. -- You are receiving this mail because: You are the assignee for the bug. --1389986464.ba760a1.24419 Date: Fri, 17 Jan 2014 19:21:04 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 8 on bug 73473 from
Created attachment 92300 [details] [review]
patch adding check for PaX mprotect

As I said on #gentoo-hardened channel, I wouldn't like to see the SELinux part
of this patch to be merged. Provided SELinux check effectively requires
allowing all applications to be allowed access to write|exec memory regardless
of if it is needed or not.

I tested patch without the SELinux part and it worked fine on my PaX & SELinux
enabled system. Starting glxgears didn't bring down whole X server as was the
case before applying patch ;) .


If one wants to avoid "grsec: denied RWX mmap" messages probably something
along the lines of patch I attached (based on checks from the SELinux one and
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libffi/files/libffi-3.0.13-emutramp_pax_proc.patch?revision=1.2&view=markup)
would be needed.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389986464.ba760a1.24419-- --===============1124118982== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1124118982==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Fri, 17 Jan 2014 23:01:55 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0322199103==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============0322199103== Content-Type: multipart/alternative; boundary="1389999714.657CAF0.31093"; charset="us-ascii" --1389999714.657CAF0.31093 Date: Fri, 17 Jan 2014 23:01:54 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #9 from Jaak Ristioja --- Personally, I'd keep both the selinux and PaX parts out of the patch. I suggest simply checking the return value for the mmap call. I think this would suffice. Keep it simple. There are also other reasons why mmap can fail (e.g. due to ulimit) and this should be checked. Please fix this first, add PaX/selinux/whatever support later. :) PS: While in the selinux patch the selinux code can be conditionally #ifdef enabled, in the PaX patch the PaX code is not, meaning this results in a minor performance impact for all users. -- You are receiving this mail because: You are the assignee for the bug. --1389999714.657CAF0.31093 Date: Fri, 17 Jan 2014 23:01:54 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 9 on bug 73473 from
Personally, I'd keep both the selinux and PaX parts out of the patch.

I suggest simply checking the return value for the mmap call. I think this
would suffice. Keep it simple. There are also other reasons why mmap can fail
(e.g. due to ulimit) and this should be checked. Please fix this first, add
PaX/selinux/whatever support later. :)

PS: While in the selinux patch the selinux code can be conditionally #ifdef
enabled, in the PaX patch the PaX code is not, meaning this results in a minor
performance impact for all users.


You are receiving this mail because:
  • You are the assignee for the bug.
--1389999714.657CAF0.31093-- --===============0322199103== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============0322199103==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Mon, 27 Jan 2014 13:24:49 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1072741146==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1072741146== Content-Type: multipart/alternative; boundary="1390829088.80c2Eb61.8825"; charset="us-ascii" --1390829088.80c2Eb61.8825 Date: Mon, 27 Jan 2014 13:24:48 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 --- Comment #10 from Emil Velikov --- Yay the crash should happen no more commit 4dd445f1cf80292f10eda53665cefc2a674d838d Author: Emil Velikov Date: Fri Jan 10 18:00:17 2014 +0000 gallium/rtasm: handle mmap failures appropriately For a variety of reasons mmap (selinux and pax to name a few) and can fail and with current code. This will result in a crash in the driver, if not worse. This has been the case since the inception of the gallium copy of rtasm. Cc: 9.1 9.2 10.0 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73473 -- You are receiving this mail because: You are the assignee for the bug. --1390829088.80c2Eb61.8825 Date: Mon, 27 Jan 2014 13:24:48 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 10 on bug 73473 from
Yay the crash should happen no more

commit 4dd445f1cf80292f10eda53665cefc2a674d838d
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Jan 10 18:00:17 2014 +0000

    gallium/rtasm: handle mmap failures appropriately

    For a variety of reasons mmap (selinux and pax to name
    a few) and can fail and with current code. This will
    result in a crash in the driver, if not worse.

    This has been the case since the inception of the
    gallium copy of rtasm.

    Cc: 9.1 9.2 10.0 <mesa-stable@lists.freedesktop.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73473


You are receiving this mail because:
  • You are the assignee for the bug.
--1390829088.80c2Eb61.8825-- --===============1072741146== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1072741146==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 73473] Potential crash bug in src/gallium/auxiliary/rtasm/rtasm_execmem.c Date: Mon, 27 Jan 2014 13:31:57 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1351910546==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1351910546== Content-Type: multipart/alternative; boundary="1390829517.B8aD61.9960"; charset="us-ascii" --1390829517.B8aD61.9960 Date: Mon, 27 Jan 2014 13:31:57 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=73473 Emil Velikov changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #11 from Emil Velikov --- Jaak Ristioja Considering how long it took for people to review this patch it may be worth opening another bug about "[gallium] Add selinux/pax support to auxiliary/rtasm" and select "Mesa core" as the component. This will hopefully get some more people looking in this direction. Closing this bug as the crash should be resolved. -- You are receiving this mail because: You are the assignee for the bug. --1390829517.B8aD61.9960 Date: Mon, 27 Jan 2014 13:31:57 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" changed bug 73473
What Removed Added
Status NEW RESOLVED
Resolution --- FIXED

Comment # 11 on bug 73473 from
Jaak Ristioja

Considering how long it took for people to review this patch it may be worth
opening another bug about
"[gallium] Add selinux/pax support to auxiliary/rtasm" and select "Mesa core"
as the component. This will hopefully get some more people looking in this
direction.

Closing this bug as the crash should be resolved.


You are receiving this mail because:
  • You are the assignee for the bug.
--1390829517.B8aD61.9960-- --===============1351910546== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1351910546==--