Getting insights with DTrace - Part 2

Version 3 by vwetter
on Jun 16, 2009 05:07.

compared with
Current by vwetter
on Jun 24, 2009 05:43.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (6)

View page history
The predicate /uid == $1/ will make sure, that only uname calls executed by the specified userid will be caught.
But that's just the start. The script to overwrite the OS version is listed below:
{noformat} {code}
#!/usr/sbin/dtrace -s
#pragma D option destructive
copyoutstr("5.10", self->uts_name_addr+rel_offset, rel_size);
}
{noformat} {code}

The statement '#pragma D option destructive' explicitely allows data modification. We still have an entry probe on uname, just because we need to save the pointer to a struct containing the OS version, which is the first argument to uname. This struct is called utsname. You can find details about this struct in sys/utsname.h:
{noformat} {code}
struct utsname {
char sysname[_SYS_NMLN];
char machine[_SYS_NMLN];
};
{noformat} {code}

We are particularly interested in the third field with name 'release'. In order to acces that field within the return probe, we have to use the pointer to the utsname struct (saved in the thread local variable uts_name_addr) and apply the corresponding offset.
For the same reason we have been using the copyinstr command before, we have to use the copyoutstr command now: DTrace runs within kernel context and cannot access the application context directly.
In case you want to change the OS version for all processes within a given zone (passed as argument), just replace the two predicate lines by:
{noformat} {code}
/curpsinfo->pr_zoneid == $1/
{noformat} {code}
After running the DTrace script and starting SAP, we want to check transaction SICK again:
\\

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact