equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * CDDL HEADER START |
2 * CDDL HEADER START |
3 * |
3 * |
4 * The contents of this file are subject to the terms of the |
4 * The contents of this file are subject to the terms of the |
5 * Common Development and Distribution License, Version 1.0 only |
5 * Common Development and Distribution License (the "License"). |
6 * (the "License"). You may not use this file except in compliance |
6 * You may not use this file except in compliance with the License. |
7 * with the License. |
|
8 * |
7 * |
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
10 * or http://www.opensolaris.org/os/licensing. |
9 * or http://www.opensolaris.org/os/licensing. |
11 * See the License for the specific language governing permissions |
10 * See the License for the specific language governing permissions |
12 * and limitations under the License. |
11 * and limitations under the License. |
19 * |
18 * |
20 * CDDL HEADER END |
19 * CDDL HEADER END |
21 */ |
20 */ |
22 |
21 |
23 /* |
22 /* |
24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. |
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
25 * Use is subject to license terms. |
24 * Use is subject to license terms. |
26 */ |
25 */ |
27 |
26 |
28 /* |
27 /* |
29 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved. |
28 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved. |
210 #include <sys/systm.h> |
209 #include <sys/systm.h> |
211 #include <sys/callb.h> |
210 #include <sys/callb.h> |
212 #include <sys/vtrace.h> |
211 #include <sys/vtrace.h> |
213 #include <sys/zone.h> |
212 #include <sys/zone.h> |
214 #include <nfs/nfs.h> |
213 #include <nfs/nfs.h> |
|
214 #include <sys/tsol/label_macro.h> |
215 |
215 |
216 #define RQCRED_SIZE 400 /* this size is excessive */ |
216 #define RQCRED_SIZE 400 /* this size is excessive */ |
217 |
217 |
218 /* |
218 /* |
219 * Defines for svc_poll() |
219 * Defines for svc_poll() |
1303 |
1303 |
1304 TRACE_0(TR_FAC_KRPC, TR_SVC_GETREQ_START, |
1304 TRACE_0(TR_FAC_KRPC, TR_SVC_GETREQ_START, |
1305 "svc_getreq_start:"); |
1305 "svc_getreq_start:"); |
1306 |
1306 |
1307 ASSERT(clone_xprt->xp_master != NULL); |
1307 ASSERT(clone_xprt->xp_master != NULL); |
|
1308 ASSERT(!is_system_labeled() || DB_CRED(mp) != NULL || |
|
1309 mp->b_datap->db_type != M_DATA); |
1308 |
1310 |
1309 /* |
1311 /* |
1310 * Firstly, allocate the authentication parameters' storage |
1312 * Firstly, allocate the authentication parameters' storage |
1311 */ |
1313 */ |
1312 mutex_enter(&rqcred_lock); |
1314 mutex_enter(&rqcred_lock); |
1322 KM_SLEEP); |
1324 KM_SLEEP); |
1323 } |
1325 } |
1324 msg.rm_call.cb_cred.oa_base = cred_area; |
1326 msg.rm_call.cb_cred.oa_base = cred_area; |
1325 msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]); |
1327 msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]); |
1326 r.rq_clntcred = &(cred_area[2 * MAX_AUTH_BYTES]); |
1328 r.rq_clntcred = &(cred_area[2 * MAX_AUTH_BYTES]); |
|
1329 |
|
1330 /* |
|
1331 * underlying transport recv routine may modify mblk data |
|
1332 * and make it difficult to extract label afterwards. So |
|
1333 * get the label from the raw mblk data now. |
|
1334 */ |
|
1335 if (is_system_labeled()) { |
|
1336 mblk_t *lmp; |
|
1337 |
|
1338 r.rq_label = kmem_alloc(sizeof (bslabel_t), KM_SLEEP); |
|
1339 if (DB_CRED(mp) != NULL) |
|
1340 lmp = mp; |
|
1341 else { |
|
1342 ASSERT(mp->b_cont != NULL); |
|
1343 lmp = mp->b_cont; |
|
1344 ASSERT(DB_CRED(lmp) != NULL); |
|
1345 } |
|
1346 bcopy(label2bslabel(crgetlabel(DB_CRED(lmp))), r.rq_label, |
|
1347 sizeof (bslabel_t)); |
|
1348 } else { |
|
1349 r.rq_label = NULL; |
|
1350 } |
1327 |
1351 |
1328 /* |
1352 /* |
1329 * Now receive a message from the transport. |
1353 * Now receive a message from the transport. |
1330 */ |
1354 */ |
1331 if (SVC_RECV(clone_xprt, mp, &msg)) { |
1355 if (SVC_RECV(clone_xprt, mp, &msg)) { |
1408 if (r.rq_cred.oa_flavor == RPCSEC_GSS) |
1432 if (r.rq_cred.oa_flavor == RPCSEC_GSS) |
1409 rpc_gss_cleanup(clone_xprt); |
1433 rpc_gss_cleanup(clone_xprt); |
1410 } |
1434 } |
1411 } |
1435 } |
1412 |
1436 |
|
1437 if (r.rq_label != NULL) |
|
1438 kmem_free(r.rq_label, sizeof (bslabel_t)); |
|
1439 |
1413 /* |
1440 /* |
1414 * Free authentication parameters' storage |
1441 * Free authentication parameters' storage |
1415 */ |
1442 */ |
1416 mutex_enter(&rqcred_lock); |
1443 mutex_enter(&rqcred_lock); |
1417 /* LINTED pointer alignment */ |
1444 /* LINTED pointer alignment */ |
1440 svc_clone_free(SVCXPRT *clone_xprt) |
1467 svc_clone_free(SVCXPRT *clone_xprt) |
1441 { |
1468 { |
1442 /* Fre credentials from crget() */ |
1469 /* Fre credentials from crget() */ |
1443 if (clone_xprt->xp_cred) |
1470 if (clone_xprt->xp_cred) |
1444 crfree(clone_xprt->xp_cred); |
1471 crfree(clone_xprt->xp_cred); |
1445 |
|
1446 kmem_free(clone_xprt, sizeof (SVCXPRT)); |
1472 kmem_free(clone_xprt, sizeof (SVCXPRT)); |
1447 } |
1473 } |
1448 |
1474 |
1449 /* |
1475 /* |
1450 * Link a per-thread clone transport handle to a master |
1476 * Link a per-thread clone transport handle to a master |
1477 /* Structure copy of all the common fields */ |
1503 /* Structure copy of all the common fields */ |
1478 clone_xprt->xp_xpc = xprt->xp_xpc; |
1504 clone_xprt->xp_xpc = xprt->xp_xpc; |
1479 |
1505 |
1480 /* Restore per-thread fields (xp_cred) */ |
1506 /* Restore per-thread fields (xp_cred) */ |
1481 clone_xprt->xp_cred = cred; |
1507 clone_xprt->xp_cred = cred; |
|
1508 |
1482 |
1509 |
1483 /* |
1510 /* |
1484 * NOTICE: There is no transport-type specific code now. |
1511 * NOTICE: There is no transport-type specific code now. |
1485 * If you want to add a transport-type specific cloning code |
1512 * If you want to add a transport-type specific cloning code |
1486 * add one more operation (e.g. xp_clone()) to svc_ops, |
1513 * add one more operation (e.g. xp_clone()) to svc_ops, |
2377 SVCMASTERXPRT *xprt = ((void **) q->q_ptr)[0]; |
2404 SVCMASTERXPRT *xprt = ((void **) q->q_ptr)[0]; |
2378 SVCPOOL *pool = xprt->xp_pool; |
2405 SVCPOOL *pool = xprt->xp_pool; |
2379 |
2406 |
2380 TRACE_0(TR_FAC_KRPC, TR_SVC_QUEUEREQ_START, "svc_queuereq_start"); |
2407 TRACE_0(TR_FAC_KRPC, TR_SVC_QUEUEREQ_START, "svc_queuereq_start"); |
2381 |
2408 |
|
2409 ASSERT(!is_system_labeled() || DB_CRED(mp) != NULL || |
|
2410 mp->b_datap->db_type != M_DATA); |
|
2411 |
2382 /* |
2412 /* |
2383 * Step 1. |
2413 * Step 1. |
2384 * Grab the transport's request lock and put |
2414 * Grab the transport's request lock and put |
2385 * the request at the tail of the transport's |
2415 * the request at the tail of the transport's |
2386 * request queue. |
2416 * request queue. |