Page MenuHomeFreeBSD

Rewrite Linuxulator struct sockaddr conversion funtions
ClosedPublic

Authored by dchagin on May 4 2019, 3:30 PM.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dchagin created this revision.May 4 2019, 3:30 PM
dchagin updated this revision to Diff 57036.May 4 2019, 4:53 PM

accept syscall return EINVAL in case of negative namelen parameter

dchagin updated this revision to Diff 57037.May 4 2019, 5:02 PM

refactor accept_common to properly handle error from kern_accept4

dchagin updated this revision to Diff 57043.May 4 2019, 6:22 PM

Init bflags in linux_accept_common and lsa in bsd_to_linux_sockaddr.

dchagin updated this revision to Diff 57044.May 4 2019, 6:57 PM

ha, git show HEAD^ )))

fixed linux_accept_common after refactoring

dchagin updated this revision to Diff 57059.May 5 2019, 9:22 AM

do not touch linux_recv()

dchagin updated this revision to Diff 57090.May 6 2019, 2:08 PM

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.