NetBSD-Bugs archive

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

kern/39416: emulation support for pread/pwrite missing in linux32 emulation



>Number:         39416
>Category:       kern
>Synopsis:       emulation support for pread/pwrite missing in linux32 emulation
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 27 08:50:00 +0000 2008
>Originator:     Wolfgang Stukenbrock
>Release:        NetBSD 4.0
>Organization:
Dr. Nagler & Company GmbH
        
>Environment:
        
        
System: NetBSD s401 4.0 NetBSD 4.0 (NSW-S401) #11: Wed Jul 30 21:13:34 CEST 
2008 
wgstuken@s012:/export/NetBSD-4.0/N+C-build/.OBJDIR_amd64/export/NetBSD-4.0/src/sys/arch/amd64/compile/NSW-S401
 amd64
Architecture: x86_64
Machine: amd64
>Description:
        Some linux libraries installed for linux32 comparbility uses pread() to 
get data from
        an open file.
        In NetBSD4.0 this call is still unimplemented in the LINUX32 emulation.
        For example the YP-libs of Linux are using pread() to get the binding 
...
        I've recognized this in the firefox-bin installed from pkgsrc that will 
run in
        linux32 emulation.
>How-To-Repeat:
        try to run a linux programm that uses pread - the system call will fail 
- not implemented
>Fix:
        Not realy shure, because I'm not shure about the exact stack alignment 
for theese calls.
        It looks like there is a size problem with the type off_t.
        In netbsd32 (at least since 3.0 - we have no older system running 
anymore) this type is 8 byte,
        but in linux32 it is only 4 bytes.
        In linux there seems to be calls like pread64() and pwrite64() for 
64-bit offsets - at
        least the header files will redirect pread() to pread64() if 
__USE_FILE_OFFSET64 is set.
        In kernel 2.6.16-1 pread64 seems to be mapped to syscall number 180 in 
/usr/include/asm/unistd.h
        "#define __NR_pread64             180". No definition for pread itself 
is in the header files.
        I've no access to the linux sources at the moment, so I cannot check, 
if the pread() function
        will just call pread64() in the library. In that case the missing 
emulation can be added
        by just calling netbsd32_pread().

        If there is a real 32 bit call in linux, a little bit more work is 
needed.
        For the 32 bit calls we need an additional argument structure, but than 
it should be simply
        possible to use the version with 64 bit offsets. Perhaps a size check 
        (offest + numbytes <= 1^32) should be done to keep semantics.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index