Re: CVS commit: src/sys/compat/sys

2011-12-20 Thread Alan Barrett

On Tue, 20 Dec 2011, Matthias Drochner wrote:

Module Name:src
Committed By:   drochner
Date:   Tue Dec 20 16:38:06 UTC 2011

Modified Files:
src/sys/compat/sys: rnd.h

Log Message:
allow kernels w/o COMPAT_50 to build


What was the actual problem?  Nothing defined by this file is supposed
to be used in a kernel without COMPAT_50; if something is being used
accidentally then I'd like to fix that.

--apb (Alan Barrett)


Re: CVS commit: src/sys/compat/sys

2011-12-20 Thread Alan Barrett

On Tue, 20 Dec 2011, Alan Barrett wrote:

On Tue, 20 Dec 2011, Matthias Drochner wrote:

Modified Files:
src/sys/compat/sys: rnd.h
Log Message:
allow kernels w/o COMPAT_50 to build


What was the actual problem?  Nothing defined by this file is 
supposed to be used in a kernel without COMPAT_50; if something 
is being used accidentally then I'd like to fix that.


OK, I found it.  rndpseudo_50.o is unconditionally compiled and 
added to libcompat in the kernel build directory.  Everything else 
in sys/compat/common is handled in the same way.


I am inclined to wrap most of the contents of 
compat/common/rndpseudo_50.c and compat/sys/rnd.h in #ifdef 
COMPAT_50 guards, although other files in compat/common and 
compat/sys do not seem to do this.


--apb (Alan Barrett)


Re: CVS commit: src

2011-12-20 Thread Joerg Sonnenberger
On which mailling list was this change discussed?

Joerg

On Tue, Dec 20, 2011 at 03:39:36PM +, Reinoud Zandijk wrote:
 Module Name:  src
 Committed By: reinoud
 Date: Tue Dec 20 15:39:36 UTC 2011
 
 Modified Files:
   src/lib/libc/sys: mmap.2
   src/sys/sys: mman.h proc.h
   src/sys/uvm: uvm_extern.h uvm_map.c uvm_mmap.c
 
 Log Message:
 Add a MAP_NOSYSCALLS flag to mmap. This flag prohibits executing of system
 calls from the mapped region. This can be used for emulation perposed or for
 extra security in the case of generated code.
 
 Its implemented by adding mapping-attributes to each uvm_map_entry. These can
 then be queried when needed.
 
 Currently the MAP_NOSYSCALLS is only implemented for x86 but other
 architectures are easy to adapt; see the sys/arch/x86/x86/syscall.c patch.
 Port maintainers are encouraged to add them for their processor ports too.
 When this feature is not yet implemented for an architecture the
 MAP_NOSYSCALLS is simply ignored with virtually no cpu cost..
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.45 src/lib/libc/sys/mmap.2
 cvs rdiff -u -r1.42 -r1.43 src/sys/sys/mman.h
 cvs rdiff -u -r1.311 -r1.312 src/sys/sys/proc.h
 cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_extern.h
 cvs rdiff -u -r1.307 -r1.308 src/sys/uvm/uvm_map.c
 cvs rdiff -u -r1.139 -r1.140 src/sys/uvm/uvm_mmap.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 


Re: CVS commit: src

2011-12-20 Thread David Young
On Tue, Dec 20, 2011 at 03:39:36PM +, Reinoud Zandijk wrote:
 Currently the MAP_NOSYSCALLS is only implemented for x86 but other
 architectures are easy to adapt; see the sys/arch/x86/x86/syscall.c patch.
 Port maintainers are encouraged to add them for their processor ports too.
 When this feature is not yet implemented for an architecture the
 MAP_NOSYSCALLS is simply ignored with virtually no cpu cost..

If MAP_NOSYSCALLS is not implemented, perhaps mmap(2) should fail with
EOPNOTSUPP?  After all, the program that uses MAP_NOSYSCALLS probably
depends on it to work.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src

2011-12-20 Thread Valeriy E. Ushakov
On Tue, Dec 20, 2011 at 19:22:12 +0100, Joerg Sonnenberger wrote:

 On which mailling list was this change discussed?

I guess this is for the usermode kernel, which design has also never
been discussed.


 On Tue, Dec 20, 2011 at 03:39:36PM +, Reinoud Zandijk wrote:
  Module Name:src
  Committed By:   reinoud
  Date:   Tue Dec 20 15:39:36 UTC 2011
  
  Modified Files:
  src/lib/libc/sys: mmap.2
  src/sys/sys: mman.h proc.h
  src/sys/uvm: uvm_extern.h uvm_map.c uvm_mmap.c
  
  Log Message:
  Add a MAP_NOSYSCALLS flag to mmap. This flag prohibits executing of system
  calls from the mapped region. This can be used for emulation perposed or for
  extra security in the case of generated code.
  
  Its implemented by adding mapping-attributes to each uvm_map_entry. These 
  can
  then be queried when needed.
  
  Currently the MAP_NOSYSCALLS is only implemented for x86 but other
  architectures are easy to adapt; see the sys/arch/x86/x86/syscall.c patch.
  Port maintainers are encouraged to add them for their processor ports too.
  When this feature is not yet implemented for an architecture the
  MAP_NOSYSCALLS is simply ignored with virtually no cpu cost..
  
  
  To generate a diff of this commit:
  cvs rdiff -u -r1.44 -r1.45 src/lib/libc/sys/mmap.2
  cvs rdiff -u -r1.42 -r1.43 src/sys/sys/mman.h
  cvs rdiff -u -r1.311 -r1.312 src/sys/sys/proc.h
  cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_extern.h
  cvs rdiff -u -r1.307 -r1.308 src/sys/uvm/uvm_map.c
  cvs rdiff -u -r1.139 -r1.140 src/sys/uvm/uvm_mmap.c
  
  Please note that diffs are not public domain; they are subject to the
  copyright notices on the relevant files.
  

-uwe


Re: CVS commit: src

2011-12-20 Thread Jean-Yves Migeon

On 20.12.2011 16:39, Reinoud Zandijk wrote:

Module Name:src
Committed By:   reinoud
Date:   Tue Dec 20 15:39:36 UTC 2011

Modified Files:
src/lib/libc/sys: mmap.2
src/sys/sys: mman.h proc.h
src/sys/uvm: uvm_extern.h uvm_map.c uvm_mmap.c

Log Message:
Add a MAP_NOSYSCALLS flag to mmap. This flag prohibits executing of system
calls from the mapped region. This can be used for emulation perposed or for
extra security in the case of generated code.


IMHO, this change should have been discussed first.

Can you please elaborate on its usage? I fail to see the point about 
emulation, and even more so about the alleged extra security where this 
can be trivially bypassed. Return to libfoo and ROP are quite mainstream 
techniques these days...


--
Jean-Yves Migeon
j...@netbsd.org


Re: CVS commit: src

2011-12-20 Thread Simon Burge
Joerg Sonnenberger wrote:

 On which mailling list was this change discussed?

One thing that jumps out: Should this new code panic in sys_mmap() if it
can't handle a request instead of just failing the request?  That seems
a little ... heavy handed.

Please also stick to KNF (#defineTAB), especially when you add
something to the middle of an existing block of #defines (eg
sys/proc.h).

Cheers,
Simon.

 
 On Tue, Dec 20, 2011 at 03:39:36PM +, Reinoud Zandijk wrote:
  Module Name:src
  Committed By:   reinoud
  Date:   Tue Dec 20 15:39:36 UTC 2011
  
  Modified Files:
  src/lib/libc/sys: mmap.2
  src/sys/sys: mman.h proc.h
  src/sys/uvm: uvm_extern.h uvm_map.c uvm_mmap.c
  
  Log Message:
  Add a MAP_NOSYSCALLS flag to mmap. This flag prohibits executing of system
  calls from the mapped region. This can be used for emulation perposed or for
  extra security in the case of generated code.
  
  Its implemented by adding mapping-attributes to each uvm_map_entry. These 
  can
  then be queried when needed.
  
  Currently the MAP_NOSYSCALLS is only implemented for x86 but other
  architectures are easy to adapt; see the sys/arch/x86/x86/syscall.c patch.
  Port maintainers are encouraged to add them for their processor ports too.
  When this feature is not yet implemented for an architecture the
  MAP_NOSYSCALLS is simply ignored with virtually no cpu cost..
  
  
  To generate a diff of this commit:
  cvs rdiff -u -r1.44 -r1.45 src/lib/libc/sys/mmap.2
  cvs rdiff -u -r1.42 -r1.43 src/sys/sys/mman.h
  cvs rdiff -u -r1.311 -r1.312 src/sys/sys/proc.h
  cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_extern.h
  cvs rdiff -u -r1.307 -r1.308 src/sys/uvm/uvm_map.c
  cvs rdiff -u -r1.139 -r1.140 src/sys/uvm/uvm_mmap.c
  
  Please note that diffs are not public domain; they are subject to the
  copyright notices on the relevant files.
  
 


Re: CVS commit: src/sys

2011-12-20 Thread tsugutomo . enami
Christos Zoulas chris...@netbsd.org writes:

 Log Message:
 - Eliminate so_nbio and turn it into a bit SS_NBIO in so_state.

It looks like fstat is using so_pcb offset directly while netstat uses
sysctl to get list of pcbs.  systat uses so_snd/rcv.  I guess it is
better not to change the layout of struct socket for compatibility,
doesn't it?

enami.


Re: CVS commit: src

2011-12-20 Thread David Holland
On Wed, Dec 21, 2011 at 12:13:50AM +0400, Valeriy E. Ushakov wrote:
   On which mailling list was this change discussed?
  
  I guess this is for the usermode kernel, which design has also never
  been discussed.

Sure, but changes to fundamental APIs are supposed to not only be
discussed to death but also approved by core... can we revert this
until that's been done?

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/sys

2011-12-20 Thread YAMAMOTO Takashi
hi,

 Module Name:  src
 Committed By: christos
 Date: Tue Dec 20 23:56:29 UTC 2011
 
 Modified Files:
   src/sys/compat/linux/common: linux_socket.c
   src/sys/dev: kttcp.c
   src/sys/kern: sys_socket.c uipc_socket.c uipc_socket2.c uipc_syscalls.c
   src/sys/miscfs/fifofs: fifo_vnops.c
   src/sys/netiso: tp_usrreq.c
   src/sys/sys: socket.h socketvar.h
 
 Log Message:
 - Eliminate so_nbio and turn it into a bit SS_NBIO in so_state.

why?
i thought the reason of having this as a separate member was performance.

YAMAMOTO Takashi

 - Introduce MSG_NBIO so that we can turn non blocking i/o on a per call basis
 - Use MSG_NBIO to fix the XXX: multi-threaded issues on the fifo sockets.
 - Don't set SO_CANTRCVMORE, if we were interrupted (perhaps do it for all
   errors?).
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.110 -r1.111 src/sys/compat/linux/common/linux_socket.c
 cvs rdiff -u -r1.28 -r1.29 src/sys/dev/kttcp.c
 cvs rdiff -u -r1.64 -r1.65 src/sys/kern/sys_socket.c
 cvs rdiff -u -r1.205 -r1.206 src/sys/kern/uipc_socket.c
 cvs rdiff -u -r1.109 -r1.110 src/sys/kern/uipc_socket2.c
 cvs rdiff -u -r1.148 -r1.149 src/sys/kern/uipc_syscalls.c
 cvs rdiff -u -r1.70 -r1.71 src/sys/miscfs/fifofs/fifo_vnops.c
 cvs rdiff -u -r1.40 -r1.41 src/sys/netiso/tp_usrreq.c
 cvs rdiff -u -r1.100 -r1.101 src/sys/sys/socket.h
 cvs rdiff -u -r1.126 -r1.127 src/sys/sys/socketvar.h
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.