Angelo's Soapbox

Monday Apr 02, 2007

DTrace, April Fools and Solaris 10 Binary Compatability.

Its been a while since I blogged. Its definitely not for lack of content but lack of the discipline to sit down and "just do it". Well its about time.

Its rare to get an opportunity to talk about such varied topics such as Solaris Binary Application Guarantee , DTrace and April fools all in one blog. So it would be a shame if I let it pass.

I work in the ISV engineering team in Sun and as you may have guessed we work with Sun's software partners - ISVs (Independent Software Vendors). One of the things that I noticed was that some of our partner applications would fail to install on Solaris 10. This was frustrating to me as the problem was not with the partner application but their installer. Typically the installer fails when it find that the Solaris version is 10. If only I could get past the installer issue I'd have a an application that works perfectly fine.

So I wrote a simple D-script to fool the installer into thinking it is a Solaris 9 machine. You can try this the next time you find yourself struggling with an program that insists on a older version of Solaris.


#!/usr/sbin/dtrace -qs

#pragma D option destructive

BEGIN
{
        printf("Changing output of uname for pid %d and its descendants...\n",$1);
}

syscall::uname:entry 
/progenyof($1)/
{
        self->addr = arg0; 
}

syscall::uname:return
/progenyof($1)/
{
        copyoutstr("5.9", self->addr+(257*2), 257);
}


This script expects the pid of a shell as its only argument and it will change the uname version to 5.9 for this shell and all its descendants and as with all D-scripts once you stop this script (with a ^c) everything would be back as it was before.

Enjoy!

Comments:

Post a Comment:
Comments are closed for this entry.

Archives
Links
Referrers