Page MenuHomeFreeBSD

Rewrite Linuxulator struct sockaddr conversion funtions
ClosedPublic

Authored by dchagin on May 4 2019, 3:30 PM.
Tags
None
Referenced Files
F83566706: D20157.id57037.diff
Sat, May 11, 11:29 PM
F83566701: D20157.id57044.diff
Sat, May 11, 11:29 PM
F83566699: D20157.id57043.diff
Sat, May 11, 11:29 PM
F83566695: D20157.id57090.diff
Sat, May 11, 11:29 PM
F83566692: D20157.id57059.diff
Sat, May 11, 11:29 PM
F83566689: D20157.id57036.diff
Sat, May 11, 11:29 PM
Unknown Object (File)
Fri, May 10, 2:24 PM
Unknown Object (File)
Wed, May 8, 9:19 AM
Subscribers

Details

Summary

Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions
alter the userspace sockaddr to convert the format between linux and BSD versions.
That's the minimum 3 of copyin/copyout operations for one syscall.

Also some syscall uses linux_sa_put() and linux_getsockaddr() when load
sockaddr to userspace or from userspace accordingly.

To avoid this, chaos especially converting sockaddr in the userspace,
rewrite these 4 functions to convert sockaddr only in kernel and leave
only 2 of this functions.

Also in order to reduce duplication between MD parts of the Linuxulator move
struct sockaddr conversion functions that are MI out into linux_common module.

PR: 232920

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

accept syscall return EINVAL in case of negative namelen parameter

refactor accept_common to properly handle error from kern_accept4

Init bflags in linux_accept_common and lsa in bsd_to_linux_sockaddr.

ha, git show HEAD^ )))

fixed linux_accept_common after refactoring

do not touch linux_recv()

as linux_common now depends on INET6 option, fix it

This revision was not accepted when it landed; it landed in state Needs Review.May 13 2019, 5:48 PM
This revision was automatically updated to reflect the committed changes.