I'm filing the following self-reviewed case for Erik Nordmark.  It
proposes changes to Consolidation Private interfaces which increase the
robustness of db_credp handling.  A Patch release binding is requested.


The motivation for the changes are:
6619593 Simplify and strengthen db_credp handling
6619596 Add getpeerucred() support to SCTP SOCK_STREAM


PSARC 2002/188 ("Least Privilege for Solaris") introduced DB_CRED,
allocb_tmpl etc as follows:

--------------------------------------------------------------------------
|DB_CRED DB_CREDDEF                         |Consolidation |STREAMS      |
|                                           |Private       |macros       |
+-------------------------------------------+--------------+-------------+
|allocb_tmpl                                |Evolving      |Kernel       |
|                                           |              |function to  |
|                                           |              |allocate mblk|
|                                           |              |from template|
+-------------------------------------------+--------------+-------------+
|allocb_cred allocb_cred_wait               |Consolidation |Kernel       |
|                                           |Private       |function to  |
|                                           |              |allocate mblk|
|                                           |              |with cred    |
+-------------------------------------------+--------------+-------------+
|mblk_setcred                               |Consolidation |Kernel       |
|                                           |Private       |function to  |
|                                           |              |set cred in  |
|                                           |              |mblk         |
--------------------------------------------------------------------------

This case implements the following changes:
  - It removes the DB_CREDDEF macro.

  - No changes to allocb_tmpl.

  - allocb_cred, allocb_cred_wait, and mblk_setcred are modified to take an
    additional pid_t argument (to more easily ensure that db_cpid and db_credp
    are consistent)

  - Adding two new Consolidation Private interfaces
        cred_t *msg_getcred(mblk_t *, pid_t *);
        cred_t *msg_extractcred(mblk_t *, pid_t *)
    The pid_t pointer can be  NULL if the caller doesn't care.

    msg_getcred() finds the first non-NULL db_credp in
    the message b_cont chain and returns it, plus any db_cpid in that mblk.
    msg_extractcred() is a variant of msg_getcred() which clears the db_credp it
    finds hence returns with a held cred_t (or NULL). That avoids a crhold/rele
    pair in performance critical paths.


SCTP in PSARC 2003/586 introduced some consolidation private interfaces that
are modified by this case. Those are:

| struct sctp_upcalls_s      | Consolidation Private  | <inet/sctp_itf.h>    |
| SCTP_ITF_VER               | Consolidation Private  | <inet/sctp_itf.h>    |

This fasttrack will add an additional function pointer, su_ucred, to the
upcall structure in order to pass cred_t and pid_t from SCTP to sockfs,
and as result of that addition we are increasing the SCTP_ITF_VER
version number.





Reply via email to