Jan's Tool Shed

« Previous day (Jun 13, 2005) | Main | Next day (Jun 15, 2005) »

20050614 Tuesday June 14, 2005

My mdb-writing adventure

I like tools. So when they asked me to write the mdb macros for the crypto framework for Solaris 10, I said "Yesssss!"

Turns out somebody else likes tools, too. So they implemented the ::array command, which had not been there when I did my mdb modules.

But my modules are still prettier -- much prettier. Unfortunately, in order to really see them in action, you have to be either running a whole slew of crypto stuff, enough to back up the system, or you have to be debugging crypto code and insert pauses into the code -- or be dealing with a crash dump or live dump.

I found that there really weren't existing examples in the mdb code to handle all the array searching I had to do, so I was working really hard to implement my array walker. If you want to do something similar, you can probably look at the source for the array command instead of looking at my code, it's more recent.

Another good place to look is in the print_array function, though I have not figured outexactly who calls it (I'm busy with Trusted Solaris escalations.)

In any case, if you're not familiar with mdb, ignore my contributions and just start using mdb for other purposes -- you can start with these commands:

::help
::walkers
::dcmds
$C (mdb will call adb macros)
But, since I'm proud of my work, here is what I implemented:

# echo "::dcmds" | mdb -k | grep crypto
crypto_data              - print as crypto_data
crypto_dual_data         - print as crypto_dual_data
crypto_find_reqid        - look for reqid, print if found [ -v = verbose ]
crypto_key               - print as crypto_key
crypto_mech_info         - print as crypto_mech_info
crypto_mechanism         - details about a crypto mechanism
crypto_provider_ext_info - module-private crypto provider info
kcf_areq_node            - print asynchronous crypto request struct, [ verbose ]
kcf_global_swq           - global or addr global crypto queue.  [ -v = verbose ]
kcf_policy_desc          - policy descriptors for crypto
kcf_provider_desc        - crypto provider description struct
kcf_sched_info           - scheduling data for a crypto request
kcf_soft_conf_entry      - head or addr of configured software crypto providers
prov_tab                 - global table of crypto providers 
# echo "::walkers" | mdb -k | grep crypto
crypto_session_cache     - walk the crypto_session_cache cache
kcf_reqid_table          - table of asyncronous crypto requests
My favorite is crypto_find_reqid:

crypto_find_reqid

....but the guts of this are in an eccentric walker:

reqid_table_walk_init
reqid_table_walk_step
reqid_table_walk_fini

Have fun!

opensolaris.org

OpenSolaris

Solaris

( Jun 14 2005, 10:40:26 AM PDT ) Permalink Comments [0]


Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.