Print this page
kernel panic in lxpr_read_pid_env


1281          * Because prctl(PR_SET_NAME) does not set custom names for threads
1282          * (vs processes), there is no need for special handling here.
1283          */
1284         if ((p = lxpr_lock(lxpnp->lxpr_pid)) == NULL) {
1285                 lxpr_uiobuf_seterr(uiobuf, EINVAL);
1286                 return;
1287         }
1288         lxpr_uiobuf_printf(uiobuf, "%s\n", p->p_user.u_comm);
1289         lxpr_unlock(p);
1290 }
1291 
1292 /*
1293  * lxpr_read_pid_env(): read env vector from process
1294  */
1295 static void
1296 lxpr_read_pid_env(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
1297 {
1298         proc_t *p;
1299         char *buf;
1300         size_t asz = lxpr_maxenvvlen, sz;

1301 
1302         ASSERT(lxpnp->lxpr_type == LXPR_PID_ENV);
1303 
1304         buf = kmem_alloc(asz, KM_SLEEP);
1305 
1306         p = lxpr_lock(lxpnp->lxpr_pid);
1307         if (p == NULL) {
1308                 lxpr_uiobuf_seterr(uiobuf, EINVAL);
1309                 kmem_free(buf, asz);
1310                 return;
1311         }
1312 
1313         if (prreadenvv(p, buf, asz, &sz) != 0) {



1314                 lxpr_uiobuf_seterr(uiobuf, EINVAL);
1315         } else {
1316                 lxpr_uiobuf_write(uiobuf, buf, sz);
1317         }
1318 
1319         lxpr_unlock(p);
1320         kmem_free(buf, asz);
1321 }
1322 
1323 /*
1324  * lxpr_read_pid_limits(): ulimit file
1325  */
1326 static void
1327 lxpr_read_pid_limits(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
1328 {
1329         proc_t *p;
1330         rctl_qty_t cur, max;
1331         rctl_val_t *oval, *nval;
1332         rctl_hndl_t hndl;
1333         char *kname;
1334         int i;
1335 
1336         ASSERT(lxpnp->lxpr_type == LXPR_PID_LIMITS ||
1337             lxpnp->lxpr_type == LXPR_PID_TID_LIMITS);
1338 
1339         nval = kmem_alloc(sizeof (rctl_val_t), KM_SLEEP);




1281          * Because prctl(PR_SET_NAME) does not set custom names for threads
1282          * (vs processes), there is no need for special handling here.
1283          */
1284         if ((p = lxpr_lock(lxpnp->lxpr_pid)) == NULL) {
1285                 lxpr_uiobuf_seterr(uiobuf, EINVAL);
1286                 return;
1287         }
1288         lxpr_uiobuf_printf(uiobuf, "%s\n", p->p_user.u_comm);
1289         lxpr_unlock(p);
1290 }
1291 
1292 /*
1293  * lxpr_read_pid_env(): read env vector from process
1294  */
1295 static void
1296 lxpr_read_pid_env(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
1297 {
1298         proc_t *p;
1299         char *buf;
1300         size_t asz = lxpr_maxenvvlen, sz;
1301         int r;
1302 
1303         ASSERT(lxpnp->lxpr_type == LXPR_PID_ENV);
1304 
1305         buf = kmem_alloc(asz, KM_SLEEP);
1306 
1307         p = lxpr_lock(lxpnp->lxpr_pid);
1308         if (p == NULL) {
1309                 lxpr_uiobuf_seterr(uiobuf, EINVAL);
1310                 kmem_free(buf, asz);
1311                 return;
1312         }
1313 
1314         r = prreadenvv(p, buf, asz, &sz);
1315         lxpr_unlock(p);
1316 
1317         if (r != 0) {
1318                 lxpr_uiobuf_seterr(uiobuf, EINVAL);
1319         } else {
1320                 lxpr_uiobuf_write(uiobuf, buf, sz);
1321         }
1322 

1323         kmem_free(buf, asz);
1324 }
1325 
1326 /*
1327  * lxpr_read_pid_limits(): ulimit file
1328  */
1329 static void
1330 lxpr_read_pid_limits(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
1331 {
1332         proc_t *p;
1333         rctl_qty_t cur, max;
1334         rctl_val_t *oval, *nval;
1335         rctl_hndl_t hndl;
1336         char *kname;
1337         int i;
1338 
1339         ASSERT(lxpnp->lxpr_type == LXPR_PID_LIMITS ||
1340             lxpnp->lxpr_type == LXPR_PID_TID_LIMITS);
1341 
1342         nval = kmem_alloc(sizeof (rctl_val_t), KM_SLEEP);