Print this page
3354 kernel crash in rpcsec_gss after using gsscred
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Carlos Neira <cneirabustos@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
NEX-4123 xdrmblk_getpos() is unreliable
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
re #13613 rb4516 Tunables needs volatile keyword
closes  #11843 rb3753 - NFSv3/UDP server sends packets with wrong Source IP in header (picked from ncp3-gate)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/rpc/svc_clts.c
          +++ new/usr/src/uts/common/rpc/svc_clts.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24      - *  Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  25   25   * Copyright (c) 2012 by Delphix. All rights reserved.
       26 + * Copyright 2012 Marcel Telka <marcel@telka.sk>
       27 + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  26   28   */
  27   29  
  28   30  /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T     */
  29      -/*        All Rights Reserved   */
       31 +/*      All Rights Reserved     */
  30   32  
  31   33  /*
  32   34   * Portions of this source code were derived from Berkeley 4.3 BSD
  33   35   * under license from the Regents of the University of California.
  34   36   */
  35   37  
  36   38  /*
  37   39   * svc_clts.c
  38   40   * Server side for RPC in the kernel.
  39   41   *
↓ open down ↓ 54 lines elided ↑ open up ↑
  94   96          svc_clts_ksend,         /* Send reply */
  95   97          svc_clts_kfreeargs,     /* Free argument data space */
  96   98          svc_clts_kdestroy,      /* Destroy transport handle */
  97   99          svc_clts_kdup,          /* Check entry in dup req cache */
  98  100          svc_clts_kdupdone,      /* Mark entry in dup req cache as done */
  99  101          svc_clts_kgetres,       /* Get pointer to response buffer */
 100  102          svc_clts_kfreeres,      /* Destroy pre-serialized response header */
 101  103          svc_clts_kclone_destroy, /* Destroy a clone xprt */
 102  104          svc_clts_kstart,        /* Tell `ready-to-receive' to rpcmod */
 103  105          svc_clts_kclone_xprt,   /* transport specific clone xprt function */
 104      -        svc_clts_ktattrs        /* Transport specific attributes. */
      106 +        svc_clts_ktattrs,       /* Transport specific attributes */
      107 +        rpcmod_hold,            /* Increment transport reference count */
      108 +        rpcmod_release          /* Decrement transport reference count */
 105  109  };
 106  110  
 107  111  /*
 108  112   * Transport private data.
 109  113   * Kept in xprt->xp_p2buf.
 110  114   */
 111  115  struct udp_data {
 112  116          mblk_t  *ud_resp;                       /* buffer for response */
 113  117          mblk_t  *ud_inmp;                       /* mblk chain of request */
      118 +        sin6_t  ud_local;                       /* local address */
 114  119  };
 115  120  
 116  121  #define UD_MAXSIZE      8800
 117  122  #define UD_INITSIZE     2048
 118  123  
 119  124  /*
 120  125   * Connectionless server statistics
 121  126   */
 122  127  static const struct rpc_clts_server {
 123  128          kstat_named_t   rscalls;
↓ open down ↓ 193 lines elided ↑ open up ↑
 317  322                  goto bad;
 318  323          }
 319  324          /*
 320  325           * Point the remote transport address in the service_transport
 321  326           * handle at the address in the request.
 322  327           */
 323  328          clone_xprt->xp_rtaddr.buf = (char *)mp->b_rptr +
 324  329              pptr->unitdata_ind.SRC_offset;
 325  330          clone_xprt->xp_rtaddr.len = pptr->unitdata_ind.SRC_length;
 326  331  
      332 +        clone_xprt->xp_lcladdr.buf = (char *)&ud->ud_local;
      333 +
 327  334          /*
 328  335           * Copy the local transport address in the service_transport
 329  336           * handle at the address in the request. We will have only
 330  337           * the local IP address in options.
 331  338           */
 332  339          ((sin_t *)(clone_xprt->xp_lcladdr.buf))->sin_family = AF_UNSPEC;
 333  340          if (pptr->unitdata_ind.OPT_length && pptr->unitdata_ind.OPT_offset) {
 334  341                  char *dstopt = (char *)mp->b_rptr +
 335  342                      pptr->unitdata_ind.OPT_offset;
 336  343                  struct T_opthdr *toh = (struct T_opthdr *)dstopt;
↓ open down ↓ 417 lines elided ↑ open up ↑
 754  761   * This should be appropriately scaled to MAXDUPREQS.  To produce as less as
 755  762   * possible collisions it is suggested to set this to a prime.
 756  763   */
 757  764  #define DRHASHSZ        2053
 758  765  
 759  766  #define XIDHASH(xid)    ((xid) % DRHASHSZ)
 760  767  #define DRHASH(dr)      XIDHASH((dr)->dr_xid)
 761  768  #define REQTOXID(req)   ((req)->rq_xprt->xp_xid)
 762  769  
 763  770  static int      ndupreqs = 0;
 764      -int     maxdupreqs = MAXDUPREQS;
      771 +volatile int    maxdupreqs = MAXDUPREQS;
 765  772  static kmutex_t dupreq_lock;
 766  773  static struct dupreq *drhashtbl[DRHASHSZ];
 767  774  static int      drhashstat[DRHASHSZ];
 768  775  
 769  776  static void unhash(struct dupreq *);
 770  777  
 771  778  /*
 772  779   * drmru points to the head of a circular linked list in lru order.
 773  780   * drmru->dr_next == drlru
 774  781   */
↓ open down ↓ 236 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX