Skip to content
Snippets Groups Projects
This project is mirrored from https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git. Pull mirroring updated .
  1. Apr 02, 2009
  2. Apr 01, 2009
  3. Mar 31, 2009
  4. Mar 30, 2009
  5. Mar 29, 2009
  6. Mar 28, 2009
    • Chuck Lever's avatar
      SUNRPC: Remove CONFIG_SUNRPC_REGISTER_V4 · 93559828
      Chuck Lever authored
      We just augmented the kernel's RPC service registration code so that
      it automatically adjusts to what is supported in user space.  Thus we
      no longer need the kernel configuration option to enable registering
      RPC services with v4 -- it's all done automatically.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256
      
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      93559828
    • Chuck Lever's avatar
      SUNRPC: rpcb_register() should handle errors silently · 363f724c
      Chuck Lever authored
      Move error reporting for RPC registration to rpcb_register's caller.
      
      This way the caller can choose to recover silently from certain
      errors, but report errors it does not recognize.  Error reporting
      for kernel RPC service registration is now handled in one place.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256
      
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      363f724c
    • Chuck Lever's avatar
      SUNRPC: Simplify kernel RPC service registration · cadc0fa5
      Chuck Lever authored
      The kernel registers RPC services with the local portmapper with an
      rpcbind SET upcall to the local portmapper.  Traditionally, this used
      rpcbind v2 (PMAP), but registering RPC services that support IPv6
      requires rpcbind v3 or v4.
      
      Since we now want separate PF_INET and PF_INET6 listeners for each
      kernel RPC service, svc_register() will do only one of those
      registrations at a time.
      
      For PF_INET, it tries an rpcb v4 SET upcall first; if that fails, it
      does a legacy portmap SET.  This makes it entirely backwards
      compatible with legacy user space, but allows a proper v4 SET to be
      used if rpcbind is available.
      
      For PF_INET6, it does an rpcb v4 SET upcall.  If that fails, it fails
      the registration, and thus the transport creation.  This let's the
      kernel detect if user space is able to support IPv6 RPC services, and
      thus whether it should maintain a PF_INET6 listener for each service
      at all.
      
      This provides complete backwards compatibilty with legacy user space
      that only supports rpcbind v2.  The only down-side is that registering
      a new kernel RPC service may take an extra exchange with the local
      portmapper on legacy systems, but this is an infrequent operation and
      is done over UDP (no lingering sockets in TIMEWAIT), so it shouldn't
      be consequential.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256
      
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      cadc0fa5
    • Chuck Lever's avatar
      SUNRPC: Simplify svc_unregister() · d5a8620f
      Chuck Lever authored
      Our initial implementation of svc_unregister() assumed that PMAP_UNSET
      cleared all rpcbind registrations for a [program, version] tuple.
      However, we now have evidence that PMAP_UNSET clears only "inet"
      entries, and not "inet6" entries, in the rpcbind database.
      
      For backwards compatibility with the legacy portmapper, the
      svc_unregister() function also must work if user space doesn't support
      rpcbind version 4 at all.
      
      Thus we'll send an rpcbind v4 UNSET, and if that fails, we'll send a
      PMAP_UNSET.
      
      This simplifies the code in svc_unregister() and provides better
      backwards compatibility with legacy user space that does not support
      rpcbind version 4.  We can get rid of the conditional compilation in
      here as well.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256
      
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      d5a8620f
    • Chuck Lever's avatar
      SUNRPC: Allow callers to pass rpcb_v4_register a NULL address · 1673d0de
      Chuck Lever authored
      
      The user space TI-RPC library uses an empty string for the universal
      address when unregistering all target addresses for [program, version].
      The kernel's rpcb client should behave the same way.
      
      Here, we are switching between several registration methods based on
      the protocol family of the incoming address.  Rename the other rpcbind
      v4 registration functions to make it clear that they, as well, are
      switched on protocol family.  In /etc/netconfig, this is either "inet"
      or "inet6".
      
      NB: The loopback protocol families are not supported in the kernel.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      1673d0de
    • Chuck Lever's avatar
      SUNRPC: rpcbind actually interprets r_owner string · 126e4bc3
      Chuck Lever authored
      
      RFC 1833 has little to say about the contents of r_owner; it only
      specifies that it is a string, and states that it is used to control
      who can UNSET an entry.
      
      Our port of rpcbind (from Sun) assumes this string contains a numeric
      UID value, not alphabetical or symbolic characters, but checks this
      value only for AF_LOCAL RPCB_SET or RPCB_UNSET requests.  In all other
      cases, rpcbind ignores the contents of the r_owner string.
      
      The reference user space implementation of rpcb_set(3) uses a numeric
      UID for all SET/UNSET requests (even via the network) and an empty
      string for all other requests.  We emulate that behavior here to
      maintain bug-for-bug compatibility.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      126e4bc3
    • Chuck Lever's avatar
      SUNRPC: Clean up address type casts in rpcb_v4_register() · 3aba4553
      Chuck Lever authored
      
      Clean up: Simplify rpcb_v4_register() and its helpers by moving the
      details of sockaddr type casting to rpcb_v4_register()'s helper
      functions.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      3aba4553
    • Chuck Lever's avatar
      SUNRPC: Don't return EPROTONOSUPPORT in svc_register()'s helpers · ba5c35e0
      Chuck Lever authored
      The RPC client returns -EPROTONOSUPPORT if there is a protocol version
      mismatch (ie the remote RPC server doesn't support the RPC protocol
      version sent by the client).
      
      Helpers for the svc_register() function return -EPROTONOSUPPORT if they
      don't recognize the passed-in IPPROTO_ value.
      
      These are two entirely different failure modes.
      
      Have the helpers return -ENOPROTOOPT instead of -EPROTONOSUPPORT.  This
      will allow callers to determine more precisely what the underlying
      problem is, and decide to report or recover appropriately.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256
      
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      ba5c35e0
    • Chuck Lever's avatar
      SUNRPC: Use IPv4 loopback for registering AF_INET6 kernel RPC services · fc28decd
      Chuck Lever authored
      The kernel uses an IPv6 loopback address when registering its AF_INET6
      RPC services so that it can tell whether the local portmapper is
      actually IPv6-enabled.
      
      Since the legacy portmapper doesn't listen on IPv6, however, this
      causes a long timeout on older systems if the kernel happens to try
      creating and registering an AF_INET6 RPC service.  Originally I wanted
      to use a connected transport (either TCP or connected UDP) so that the
      upcall would fail immediately if the portmapper wasn't listening on
      IPv6, but we never agreed on what transport to use.
      
      In the end, it's of little consequence to the kernel whether the local
      portmapper is listening on IPv6.  It's only important whether the
      portmapper supports rpcbind v4.  And the kernel can't tell that at all
      if it is sending requests via IPv6 -- the portmapper will just ignore
      them.
      
      So, send both rpcbind v2 and v4 SET/UNSET requests via IPv4 loopback
      to maintain better backwards compatibility between new kernels and
      legacy user space, and prevent multi-second hangs in some cases when
      the kernel attempts to register RPC services.
      
      This patch is part of a series that addresses
      
         http://bugzilla.kernel.org/show_bug.cgi?id=12256
      
      
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      fc28decd
    • Chuck Lever's avatar
      SUNRPC: Set IPV6ONLY flag on PF_INET6 RPC listener sockets · 7d21c0f9
      Chuck Lever authored
      
      We are about to convert to using separate RPC listener sockets for
      PF_INET and PF_INET6.  This echoes the way IPv6 is handled in user
      space by TI-RPC, and eliminates the need for ULPs to worry about
      mapped IPv4 AF_INET6 addresses when doing address comparisons.
      
      Start by setting the IPV6ONLY flag on PF_INET6 RPC listener sockets.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      7d21c0f9
    • Chuck Lever's avatar
      SUNRPC: Remove @family argument from svc_create() and svc_create_pooled() · 49a9072f
      Chuck Lever authored
      
      Since an RPC service listener's protocol family is specified now via
      svc_create_xprt(), it no longer needs to be passed to svc_create() or
      svc_create_pooled().  Remove that argument from the synopsis of those
      functions, and remove the sv_family field from the svc_serv struct.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      49a9072f
    • Chuck Lever's avatar
      SUNRPC: Change svc_create_xprt() to take a @family argument · 9652ada3
      Chuck Lever authored
      
      The sv_family field is going away.  Pass a protocol family argument to
      svc_create_xprt() instead of extracting the family from the passed-in
      svc_serv struct.
      
      Again, as this is a listener socket and not an address, we make this
      new argument an "int" protocol family, instead of an "sa_family_t."
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      9652ada3
    • Chuck Lever's avatar
      SUNRPC: svc_setup_socket() gets protocol family from socket · baf01caf
      Chuck Lever authored
      
      Since the sv_family field is going away, modify svc_setup_socket() to
      extract the protocol family from the passed-in socket instead of from
      the passed-in svc_serv struct.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      baf01caf
    • Chuck Lever's avatar
      SUNRPC: Pass a family argument to svc_register() · 4b62e58c
      Chuck Lever authored
      
      The sv_family field is going away.  Instead of using sv_family, have
      the svc_register() function take a protocol family argument.
      
      Since this argument represents a protocol family, and not an address
      family, this argument takes an int, as this is what is passed to
      sock_create_kern().  Also make sure svc_register's helpers are
      checking for PF_FOO instead of AF_FOO.  The value of [AP]F_FOO are
      equivalent; this is simply a symbolic change to reflect the semantics
      of the value stored in that variable.
      
      sock_create_kern() should return EPFNOSUPPORT if the passed-in
      protocol family isn't supported, but it uses EAFNOSUPPORT for this
      case.  We will stick with that tradition here, as svc_register()
      is called by the RPC server in the same path as sock_create_kern().
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      4b62e58c
    • Chuck Lever's avatar
      SUNRPC: Clean up svc_find_xprt() calling sequence · 156e6209
      Chuck Lever authored
      
      Clean up: add documentating comment and use appropriate data types for
      svc_find_xprt()'s arguments.
      
      This also eliminates a mixed sign comparison: @port was an int, while
      the return value of svc_xprt_local_port() is an unsigned short.
      
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      156e6209
    • Chuck Lever's avatar
      SUNRPC: Don't flag empty RPCB_GETADDR reply as bogus · 776bd5c7
      Chuck Lever authored
      
      In 2007, commit e65fe397 added
      additional sanity checking to rpcb_decode_getaddr() to make sure we
      were getting a reply that was long enough to be an actual universal
      address.  If the uaddr string isn't long enough, the XDR decoder
      returns EIO.
      
      However, an empty string is a valid RPCB_GETADDR response if the
      requested service isn't registered.  Moreover, "::.n.m" is also a
      valid RPCB_GETADDR response for IPv6 addresses that is shorter
      than rpcb_decode_getaddr()'s lower limit of 11.  So this sanity
      check introduced a regression for rpcbind requests against IPv6
      remotes.
      
      So revert the lower bound check added by commit
      e65fe397, and add an explicit check
      for an empty uaddr string, similar to libtirpc's rpcb_getaddr(3).
      
      Pointed-out-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      776bd5c7
    • Paul Moore's avatar
      netlabel: Cleanup the Smack/NetLabel code to fix incoming TCP connections · 07feee8f
      Paul Moore authored
      
      This patch cleans up a lot of the Smack network access control code.  The
      largest changes are to fix the labeling of incoming TCP connections in a
      manner similar to the recent SELinux changes which use the
      security_inet_conn_request() hook to label the request_sock and let the label
      move to the child socket via the normal network stack mechanisms.  In addition
      to the incoming TCP connection fixes this patch also removes the smk_labled
      field from the socket_smack struct as the minor optimization advantage was
      outweighed by the difficulty in maintaining it's proper state.
      
      Signed-off-by: default avatarPaul Moore <paul.moore@hp.com>
      Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      07feee8f
    • Paul Moore's avatar
      lsm: Remove the socket_post_accept() hook · 8651d5c0
      Paul Moore authored
      
      The socket_post_accept() hook is not currently used by any in-tree modules
      and its existence continues to cause problems by confusing people about
      what can be safely accomplished using this hook.  If a legitimate need for
      this hook arises in the future it can always be reintroduced.
      
      Signed-off-by: default avatarPaul Moore <paul.moore@hp.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      8651d5c0
    • Paul Moore's avatar
      netlabel: Label incoming TCP connections correctly in SELinux · 389fb800
      Paul Moore authored
      
      The current NetLabel/SELinux behavior for incoming TCP connections works but
      only through a series of happy coincidences that rely on the limited nature of
      standard CIPSO (only able to convey MLS attributes) and the write equality
      imposed by the SELinux MLS constraints.  The problem is that network sockets
      created as the result of an incoming TCP connection were not on-the-wire
      labeled based on the security attributes of the parent socket but rather based
      on the wire label of the remote peer.  The issue had to do with how IP options
      were managed as part of the network stack and where the LSM hooks were in
      relation to the code which set the IP options on these newly created child
      sockets.  While NetLabel/SELinux did correctly set the socket's on-the-wire
      label it was promptly cleared by the network stack and reset based on the IP
      options of the remote peer.
      
      This patch, in conjunction with a prior patch that adjusted the LSM hook
      locations, works to set the correct on-the-wire label format for new incoming
      connections through the security_inet_conn_request() hook.  Besides the
      correct behavior there are many advantages to this change, the most significant
      is that all of the NetLabel socket labeling code in SELinux now lives in hooks
      which can return error codes to the core stack which allows us to finally get
      ride of the selinux_netlbl_inode_permission() logic which greatly simplfies
      the NetLabel/SELinux glue code.  In the process of developing this patch I
      also ran into a small handful of AF_INET6 cleanliness issues that have been
      fixed which should make the code safer and easier to extend in the future.
      
      Signed-off-by: default avatarPaul Moore <paul.moore@hp.com>
      Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      389fb800
Loading