Skip to content

Instantly share code, notes, and snippets.

@x2c3z4
Last active March 7, 2016 09:35
Show Gist options
  • Select an option

  • Save x2c3z4/4f3538e5465509a3f79d to your computer and use it in GitHub Desktop.

Select an option

Save x2c3z4/4f3538e5465509a3f79d to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -s
#pragma D option flowindent
#./base.d -c ls
::$1:entry
{
stack();
ustack();
self->in = 1;
}
::*scsi*:entry,
::*scsi*:return
/self->in/
{
}
::$1:return
{
self->in = 0;
printf("return 0x%x\n", arg1);
printf("----------------------------------------------------\n")
}
#!/usr/sbin/dtrace -s
#pragma D option flowindent
#./base.d -c ls
pid$target::main:entry
{
/*stack();*/
/*ustack();*/
self->in = 1;
}
pid$target:libc::entry,
pid$target:libc::return
/self->in/
{
}
pid$target::main:return
{
self->in = 0;
printf("return 0x%x\n", arg1);
printf("----------------------------------------------------\n")
}
#!/usr/sbin/dtrace -qs
#truss -fp $(pgrep syslogd)
pid$target:::entry
{
@num[probefunc] = count();
}
#!/usr/sbin/dtrace -s
/*
* capture context when firt part of a CDB is:
* 0 1 2 3 4 5 6 7
* 0x28 0x0 0x0 0x0 0x3 0x0 0x0 0x0
* OPCODE is a READ(10) 0x28
* LBA (bytes 2-5) 0x300
* block count (bytes 7-8
*/
fbt::scsi_transport:entry
/(
((args[0])->pkt_cdbp[0] == 0x28) &&
((args[0])->pkt_cdbp[1] == 0x00) &&
((args[0])->pkt_cdbp[2] == 0x00) &&
((args[0])->pkt_cdbp[3] == 0x00) &&
((args[0])->pkt_cdbp[4] == 0x03) &&
((args[0])->pkt_cdbp[5] == 0x00)
)/
{
pkt = (struct scsi_pkt *)arg0;
a_sd = (struct scsi_device *)pkt->pkt_address.a.a_sd;
dip = (struct dev_info *)a_sd->sd_dev;
cdb = pkt->pkt_cdbp;
printf("\n %Y: SCSI-CDB-TRACE scsi packet to %s from %a\n",
walltimestamp, stringof dip->devi_addr, caller);
printf(" %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
cdb[0], cdb[1], cdb[2], cdb[3], cdb[4],
cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]);
a = (char *)curpsinfo->pr_psargs;
sargs = (int)a == 0 ? "" : a;
printf(" pid:%d uid:%d %s %S\n", pid, uid, execname, stringof(sargs));
printf("\tKernel Stack:");
stack();
printf("\n");
}
#!/usr/sbin/dtrace -s
#pragma D option flowindent
pid$target::main:entry
{
/*stack();*/
/*ustack();*/
self->in = 1;
}
pid$target:::entry
/self->in/
{
}
pid$target:::return
/self->in/
{
printf("return 0x%x, %s:%s:%s\n", arg1,probemod, probefunc, probename);
}
fbt:scsi_vhci:vhci_get_lu_prop:entry,
fbt:scsi_vhci:vhci_get_lu_list:entry
{
stack();
}
fbt:scsi_vhci:vhci_get_lu_prop:return,
fbt:scsi_vhci:vhci_get_lu_list:return
{
printf("return 0x%x\n", arg1);
}
pid$target::main:return
{
self->in = 0;
printf("return 0x%x\n", arg1);
printf("----------------------------------------------------\n")
}
@x2c3z4
Copy link
Author

x2c3z4 commented Mar 2, 2016

export _MPAPI_SCSI_VHCI_DEBUG=1

@x2c3z4
Copy link
Author

x2c3z4 commented Mar 2, 2016

/etc/syslog.conf
svcadm restart system-log

@x2c3z4
Copy link
Author

x2c3z4 commented Mar 3, 2016

*.debug /var/adm/messages

@x2c3z4
Copy link
Author

x2c3z4 commented Mar 7, 2016

openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment