Bug 228301 - [exp-run] Improve portability of struct xinpcb and friends
Summary: [exp-run] Improve portability of struct xinpcb and friends
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-16 18:23 UTC by Brooks Davis
Modified: 2018-07-05 13:49 UTC (History)
2 users (show)

See Also:
antoine: exp-run+


Attachments
D15386 patch (11.75 KB, patch)
2018-05-16 18:23 UTC, Brooks Davis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brooks Davis freebsd_committer 2018-05-16 18:23:22 UTC
Created attachment 193463 [details]
D15386 patch

The patch in https://reviews.freebsd.org/D15386 breaks the API (and ABI) of a few sysctls used for network status (netstat and sockstat in particular) in order to make 32-bit compatibility easier.  The ABI was already broken after the creation of the 11 branch so we're just doing it again.

I suspect a small number of programs in ports use the same APIs and will need updates.
Comment 1 Antoine Brodin freebsd_committer 2018-05-27 20:23:15 UTC
Exp-run looks fine.

Maybe you can have a look at devel/sigar and sysutils/py-psutil as they are candidates for using those API
Comment 2 Brooks Davis freebsd_committer 2018-05-30 20:44:18 UTC
I took a quick look at those ports.  devel/sigar does use this API, but so long as it compiles it should work (the API change just change things that are always used as integers from void * (etc) to int64_t.

sysutils/py-psutil has comments about using xsocket, xinpcb, etc, but doesn't seem to actually do so.  Given there wasn't any clear fallout, I think this is ready to land.
Comment 3 commit-hook freebsd_committer 2018-07-05 13:14:10 UTC
A commit references this bug:

Author: brooks
Date: Thu Jul  5 13:13:53 UTC 2018
New revision: 335979
URL: https://svnweb.freebsd.org/changeset/base/335979

Log:
  Make struct xinpcb and friends word-size independent.

  Replace size_t members with ksize_t (uint64_t) and pointer members
  (never used as pointers in userspace, but instead as unique
  idenitifiers) with kvaddr_t (uint64_t). This makes the structs
  identical between 32-bit and 64-bit ABIs.

  On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
  this is an ABI breaking change. The ABI of most of these structs
  was previously broken in r315662.  This also imposes a small API
  change on userspace consumers who must handle kernel pointers
  becoming virtual addresses.

  PR:		228301 (exp-run by antoine)
  Reviewed by:	jtl, kib, rwatson (various versions)
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D15386

Changes:
  head/UPDATING
  head/lib/libkvm/kvm.h
  head/sys/kern/kern_descrip.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/uipc_usrreq.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/tcp_var.h
  head/sys/sys/file.h
  head/sys/sys/param.h
  head/sys/sys/socketvar.h
  head/sys/sys/types.h
  head/sys/sys/unpcb.h
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/unix.c
  head/usr.bin/sockstat/sockstat.c