[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
kernel/1000: uvm mmap on character devices uses PROT_EXEC
>Number: 1000
>Category: kernel
>Synopsis: uvm mmap on character devices uses PROT_EXEC
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bugs
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Dec 4 19:20:01 MST 1999
>Last-Modified:
>Originator: Andreas Gunnarsson
>Organization:
>Release: 2.6
>Environment:
System : OpenBSD 2.6
Architecture: OpenBSD.i386
Machine : i386
>Description:
When using mmap on a character device, uvm will ask the device to
mmap with execute permissions regardless of the argument prot to
mmap.
This won't work with the Brooktree driver which will return an
error if mmap is tried with PROT_EXEC.
>How-To-Repeat:
Use a kernel with UVM, run fxtv (from ports tree). It will exit
with an error "mmap of driver buffer failed: Invalid argument"
mmap on other devices that won't allow PROT_EXEC will do the same.
>Fix:
I don't know enough about UVM to be brave enough to include a patch,
but if uvm_mmap calls udv_attach (and uvn_attach?) with "prot"
instead of "maxprot" it should work (/usr/src/sys/uvm/uvm_mmap.c).
Don't quote me on this though, I guess PROT_EXEC may be set for a
reason and I haven't tried to find out what side effects this might
have.
A temporary work around to un-break fxtv would be to remove the check
for PROT_EXEC in the brooktree driver:
*** /usr/src/sys/dev/pci/brooktree848.c.old Sun Dec 5 03:10:54 1999
--- /usr/src/sys/dev/pci/brooktree848.c Sun Dec 5 02:35:21 1999
***************
*** 8579,8586 ****
--- 8579,8588 ----
bktr = bktr_cd.cd_devs[unit];
+ /*
if (nprot & PROT_EXEC)
return( -1 );
+ */
if (offset < 0)
return( -1 );
>Audit-Trail:
>Unformatted: