[Bug 232920] linuxulator: linux_to_bsd_sockaddr and bsd_to_linux_sockaddr are unsafe

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon May 13 17:49:04 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232920

--- Comment #2 from commit-hook at freebsd.org ---
A commit references this bug:

Author: dchagin
Date: Mon May 13 17:48:17 UTC 2019
New revision: 347533
URL: https://svnweb.freebsd.org/changeset/base/347533

Log:
  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 put
  struct sockaddr conversion functions that are MI out into linux_common
module.

  PR:           232920
  MFC after:    2 weeks
  Differential Revision:        https://reviews.freebsd.org/D20157

Changes:
  head/sys/compat/linux/linux.c
  head/sys/compat/linux/linux.h
  head/sys/compat/linux/linux_common.h
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_socket.h
  head/sys/modules/linux_common/Makefile

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-emulation mailing list