Monday Apr 21, 2008

Copy and Paste with The Gimp and Star Office

This is just a short note, in case no one noticed. Or this is just the hint you were looking for, just a I was yesterday.

Copy and paste of a selection from gimp into Star Office works with The Gimp 2.2 and newer.

Well this is really old news, and it is documented in the gimp docs, see http://docs.gimp.org/en/gimp-introduction-history-2-2.html.

I just had to look that up as my wife wondered why it did not just work with The Gimp 2.2, which comes preinstalled with Solaris. Blastwave has a prepackaged 2.4.3 for you.

As an administrator for a Solaris home production system, you sometimes have to face these challenges...
 


 

Tuesday Nov 06, 2007

Live Upgrading

A short look at Live Upgrade


Have you ever used Solaris Live Upgrade or wondered what it looks like?


Here you go...


I just did a small demonstration and thought I share the logs with you.


Step One: Create a new boot environment


This means looking for space to accomodate the OS copy.


As we have a rather simple setup with a single file system for root (/), we just have to provide a place for this one. BTW: Live Upgrade can re-layout your file system on the fly. If I wanted to put /var in its own file system, I could just add a mount point for it (lucreate can create mirrored file systems, too).


In this case, c0t1d0s3 is an unused 10GB slice my 5GB plain Solaris will nicely fit into.


root@m8000b-test # lucreate -n toms -m /:/dev/dsk/c0t1d0s3:ufs
Discovering physical storage devices
Discovering logical storage devices
Cross referencing storage devices with boot environment configurations
Determining types of file systems supported
Validating file system requests
Preparing logical storage devices
Preparing physical storage devices
Configuring physical storage devices
Configuring logical storage devices
Analyzing system configuration.
Comparing source boot environment <production> file systems with the file
system(s) you specified for the new boot environment. Determining which
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Searching /dev for possible boot environment filesystem devices


Updating system configuration files.
The device </dev/dsk/c0t1d0s3> is not a root device for any boot environment; cannot get BE ID.
Creating configuration for boot environment <toms>.
Source boot environment is <production>.
Creating boot environment <toms>.
Creating file systems on boot environment <toms>.
Creating <ufs> file system for </> in zone <global> on </dev/dsk/c0t1d0s3>.
Mounting file systems for boot environment <toms>.
Calculating required sizes of file systems for boot environment <toms>.
Populating file systems on boot environment <toms>.
Checking selection integrity.
Integrity check OK.
Populating contents of mount point </>.
Copying.
Creating shared file system mount points.
Creating compare databases for boot environment <toms>.
Creating compare database for file system </>.
Updating compare databases on boot environment <toms>.
Updating compare databases on boot environment <kopie>.
Making boot environment <toms> bootable.
Setting root slice to </dev/dsk/c0t1d0s3>.
Population of boot environment <toms> successful.
Creation of boot environment <toms> successful.
root@m8000b-test #


This process took about ten minutes. This is the result:

root@m8000b-test # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
production                 yes      yes    yes       no     -
toms                       yes      no     no        yes    -


Step two: Do the upgrade


To upgrade, I have to provide the location of the OS install media. In this case, we copied the DVD to the installation server "iserv" which exports it via nfs.


root@m8000b-test # luupgrade -u -n toms -s /net/iserv/export/upgrade/sol10_u4/


159648 blocks
miniroot filesystem is <lofs>
Mounting miniroot at </net/iserv/export/upgrade/sol10_u4//Solaris_10/Tools/Boot>
Validating the contents of the media </net/iserv/export/upgrade/sol10_u4/>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <toms>.
Determining packages to install or upgrade for BE <toms>.
Performing the operating system upgrade of the BE <toms>.
CAUTION: Interrupting this process may leave the boot environment unstable
or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Updating package information on boot environment <toms>.
Package information successfully updated on boot environment <toms>.
Adding operating system patches to the BE <toms>.
The operating system patch installation is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot
environment <toms> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot
environment <toms> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files
are located on boot environment <toms>. Before you activate boot
environment <toms>, determine if any additional system maintenance is
required or if additional media of the software distribution must be
installed.
The Solaris upgrade of the boot environment <toms> is complete.


The upgrade took about 1 hour.


Step three: Reboot


Wanna boot the new OS? luactivate takes care of everything necessary.


root@m8000b-test # luactivate -n toms


\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the
target BE.
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:
1. Enter the PROM monitor (ok prompt).
2. Change the boot device back to the original boot environment
by typing:
     setenv boot-device
/pci@20,600000/pci@0/scsi@1/disk@0,0:a
3
. Boot to the original boot environment by typing:
     boot
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Activation of boot environment <toms> successful.


Ok, there we go...


Rebooting with command: boot
Boot device:
/pci@20,600000/pci@0/scsi@1/disk@1,0:d  File and args:
SunOS Release 5.10 Version Generic_120011-14 64-bit
Copyright 1983-2007 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: m8000b-test
Configuring devices.
Loading smf(5) service descriptions: 29/33
Nov  6 13:46:23 svc.startd[7]: svc:/system/rcap:default: Method ":kill -SIGHUP" failed with exit status 1.
Nov  6 13:46:23 svc.startd[7]: svc:/system/rcap:default: Method ":kill -SIGHUP" failed with exit status 1.
Nov  6 13:46:23 svc.startd[7]: svc:/system/rcap:default: Method ":kill -SIGHUP" failed with exit status 1.
Nov  6 13:46:23 svc.startd[7]: system/rcap:default failed: transitioned to maintenance (see 'svcs -xv' for details)  33/33


m8000b-test console login: root
Password:
Last login: Mon Nov  5 17:15:15 from 10.67.213.111
Nov  6 13:48:44 m8000b-test login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005


TERM=vt100


root@m8000b-test # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
production                 yes      no     no        yes    -
toms                       yes      yes    yes       no     -


Step four (there and back again...) (optional)


Is everything ok with the Upgrade?
If not, switching back is a matter of minutes:


root@m8000b-test # luactivate -n production



\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the
target BE.


\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:
1. Enter the PROM monitor (ok prompt).
2. Change the boot device back to the original boot environment by typing:
     setenv boot-device /pci@20,600000/pci@0/scsi@1/disk@1,0:c
3. Boot to the original boot environment by typing:
     boot
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*


Activation of boot environment <production> successful.
root@m8000b-test # init 6
root@m8000b-test #
Nov  6 13:49:10 m8000b-test ip: ip_create_dl: hw addr length = 0
svc.startd: The system is coming down.  Please wait.
svc.startd: 98 system services are now being stopped.
Nov  6 13:49:56 m8000b-test agent[2249]: syslog   Nov 06 13:49:56 agent         {received software termination signal}
Nov  6 13:49:56 m8000b-test agent[2249]: syslog   Nov 06 13:49:56 agent         \*\*\* terminating execution \*\*\*
Nov  6 13:50:01 m8000b-test ip: ipsec_check_inbound_policy: Policy Failure for the incoming packet (not secure); Source 192.168.224.001, Destination 192.168.224.003.
Nov  6 13:50:02 m8000b-test ip: ip_create_dl: hw addr length = 0
Nov  6 13:50:02 m8000b-test rpc.metad: Terminated
Nov  6 13:50:02 m8000b-test syslogd: going down on signal 15
Nov  6 13:51:35 svc.startd[7]: svc:/application/management/sunmcagent:default: Method or service exit timed out.  Killing contract 52.
Nov  6 13:51:35 svc.startd[7]: application/management/sunmcagent:default failed: transitioned to maintenance (see 'svcs -xv' for details)
svc.startd: The system is down.
syncing file systems... done
rebooting...
Resetting...
..POST Sequence 01
POST Sequence 02
..
POST Sequence 1A
POST Sequence Complete.
ChassisSerialNumber xxxxxxxx


Sun SPARC Enterprise M8000 Server, using Domain console
Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
Copyright 2007 Sun Microsystems, Inc. and Fujitsu Limited. All rights reserved.
OpenBoot 4.24.1, 16384 MB memory installed, Serial #xxxxxxxxx.
Ethernet address 0:xx:xx:xx:xx:x, Host ID: xxxxxxxxx.

Rebooting with command: boot
Boot device:
/pci@20,600000/pci@0/scsi@1/disk@0,0:a  File and args:
SunOS Release 5.10 Version Generic_120011-11 64-bit
Copyright 1983-2007 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: m8000b-test


m8000b-test console login: root
Password:
Last login: Mon Nov  5 17:15:15 from 10.67.213.111
Nov  6 13:56:02 m8000b-test login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005

TERM=vt100


root@m8000b-test # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
production                 yes      yes    yes       no     -
toms                       yes      no     no        yes    -


root@m8000b-test # init 6


And so on...


It is an easy, unattended, quick and safe way to do OS upgrades with Live Upgrade.


You can use it to create a copy of your system before you do an oracle upgrade, too. Just tell Live Upgrade to copy your Oracle binaries as well (see man lucreate on how to do that). Look at lumake, too.

 

Update Nov 23, 2007: "bbr" reminded me that I should have upgraded Live Upgrade Packages before doing the actual upgrade. Correct. This is done by removing lu Packages and re-installing them from the version you want to upgrade to (or newer).

Wednesday Sep 26, 2007

dtrace in destructive mode: working around a non-working syscall

Last week, I was at a customer's site. They are testing our new SPARC Enterprise M8000 Servers and we were in the course of deploying standard applications to the (2) systems under test.

We discovered that one of the applications just would not run on Solaris 10 Update 4. It is an application, let's call it tapewriter, which had been Solaris certified for years, but it does a malformed ioctl request when doing a SCSI inquiry, which it does at the very start trying to access a tape drive.

Analysis: What is happening there?

With truss, we could see tapewriter issues a uscsi ioctl call and the system returns an "invalid argument" error.

ioctl(5, 0x04C9, 0xFFBFF690)                    Err#22 EINVAL

The 0x04c9 function parameter denotes a uscsi request. The third argument points to a struct called uscsi_cmd32. We can learn that from /usr/include/sys/scsi/impl/uscsi.h, and the struct is defined there as well: 

struct uscsi_cmd32 {
        int             uscsi_flags;    /\* read, write, etc. see below \*/
        short           uscsi_status;   /\* resulting status  \*/
        short           uscsi_timeout;  /\* Command Timeout \*/
        caddr32_t       uscsi_cdb;      /\* cdb to send to target \*/
        caddr32_t       uscsi_bufaddr;  /\* i/o source/destination \*/
        size32_t        uscsi_buflen;   /\* size of i/o to take place \*/
        size32_t        uscsi_resid;    /\* resid from i/o operation \*/
        uchar_t         uscsi_cdblen;   /\* # of valid cdb bytes \*/
        uchar_t         uscsi_rqlen;    /\* size of uscsi_rqbuf \*/
        uchar_t         uscsi_rqstatus; /\* status of request sense cmd \*/
        uchar_t         uscsi_rqresid;  /\* resid of request sense cmd \*/
        caddr32_t       uscsi_rqbuf;    /\* request sense buffer \*/
        caddr32_t       uscsi_reserved_5;       /\* Reserved for Future Use \*/
};

Maybe you know as little about SCSI as I do, so let me explain that this is a call to issue generic scsi commands to a device. The scsi command itself is coded in the cdb=command descriptor block. For a SCSI inquiry, which asks "Who's that on the other end of the line?", this looks like e.g. 0x12 0x00 0x00 0x00 x0ff 0x00. 0x12 means inquiry, and 0xff means "my buffer to accomodate data returned is 255 bytes in size". The data returned by the scsi command will be placed in the buffer provided by uscsi_bufaddr. As you want to read data, you will put 0x08 (READ) in uscsi_flags, which tells uscsi what you are about to do.

Sometimes, there is an error message pending on the device that has not been reported yet. This is called the "check condition" state. Before issuing a command, you should check whether the device is ok, and if it is in "check condition" state (the inquiry will report that), you may feel inclined not to issue the command, but another one called "Request Sense", which will get you detailed error status information.

Oh well, that's two requests instead of one. What a load of work. This is why uscsi offers to issue the Request Sense command for you when there is a check condition.

Where's the point? If you request uscsi to do that for you (by setting  USCSI_RQENABLE =0x10000 in uscsi_flags), you have to provide an additional buffer where the Request Sense data can be put.

So why doesn't tapewriter work?

dtrace giving insight

I wrote a small dtrace script that shows the parameters passed to ioctl. It looks like this:

#!/usr/sbin/dtrace -s
#pragma D option quiet

struct uscsi_cmd32      \*ustruct;

syscall::ioctl:entry
/(arg1==0x4c9)&&(execname=="tapewriter")/
{
ustruct=copyin(arg2,sizeof(\*ustruct));
printf ("E pid proc: %i %s\\n",pid,execname);
printf ("flags: %x\\n",ustruct->uscsi_flags);
printf ("uscsi_timeout: %x\\n",ustruct->uscsi_timeout);
printf ("uscsi_cdblen: %x\\n",ustruct->uscsi_cdblen);
printf ("uscsi_buflen: %x\\n",ustruct->uscsi_buflen);
printf ("uscsi_bufaddr: %lx\\n",(unsigned long)ustruct->uscsi_bufaddr);
printf ("uscsi_rqlen: %x\\n",ustruct->uscsi_rqlen);
printf ("uscsi_rqbuf: %lx\\n",(unsigned long)ustruct->uscsi_rqbuf);
printf ("uscsi_cdb: %lx\\n",(unsigned long)ustruct->uscsi_cdb);

first=(char \*)copyin(ustruct->uscsi_cdb,6);
printf ("cdb first byte: %i hex %x\\n",first[0],first[0]);
printf ("cdb 2nd byte: %i hex %x\\n",first[1],first[1]);
printf ("cdb 3rd byte: %i hex %x\\n",first[2],first[2]);
printf ("cdb 4th byte: %i hex %x\\n",first[3],first[3]);
printf ("cdb 5th byte: %i hex %x\\n",first[4],first[4]);
printf ("cdb 6th byte: %i hex %x\\n",first[5],first[5]);
self->ok=1;self->bufadr=arg2;
}

syscall::ioctl:return
/self->ok/
{
 self->ok=0;
 printf ("R pid proc errno: %i %s %i\\n",pid,execname,errno);
 printf ("retval: %i\\n",arg0);
 ustruct=copyin(self->bufadr,sizeof(\*ustruct));
 self->bufadr=0;
 printf ("flags: %x\\n",ustruct->uscsi_flags);
 printf ("uscsi_status: %i\\n",ustruct->uscsi_status);
 printf ("uscsi_timeout: %x\\n",ustruct->uscsi_timeout);
 printf ("uscsi_cdblen: %x\\n",ustruct->uscsi_cdblen);
 printf ("uscsi_buflen: %x\\n",ustruct->uscsi_buflen);
 printf ("uscsi_bufaddr: %lx\\n",(unsigned long)ustruct->uscsi_bufaddr);
 printf ("uscsi_rqlen: %x\\n",ustruct->uscsi_rqlen);
 printf ("uscsi_rqstatus: %x\\n",ustruct->uscsi_rqstatus);
 printf ("uscsi_rqbuf: %lx\\n",(unsigned long)ustruct->uscsi_rqbuf);
 printf ("uscsi_cdb: %lx\\n\\n",(unsigned long)ustruct->uscsi_cdb);
}

This script will show the contents of the uscsi command block as the ioctl is entered and left by tapewriter.

For those who are not familiar with dtrace:

dtrace is a framework and a command. The command dtrace, which is used to execute this script, configures the framework to watch the processor to trigger probes as it executes processes. The script is a "d script", written in "d", the language that is used to describe what dtrace should look for (i.e. the probes that should be watched) and what to do (the actions executed when a probe "fires"). This script watches for processes entering ("entry" probe) or leaving ("return" probe) the ioctl syscall. There is a filter on the entry call that leaves all ioctls aside that are not invoking the uscsi function (0x4c9) or are not done by an executable called "tapewriter".  The self->ok filter on the return probe makes sure we passed the entry call before: self->xxx variables are thread-local variables. self->bufadr is used to remember the third entry parameter, which is the address of the uscsi command struct. Ok, well, I could have used a single variable for this purpose.

For syscall entry probes, arg0...arg5 are variables representing the arguments passed to the syscall. For syscall return probes, arg0 contains the return code to be passed up the callstack by the syscall.

Most of the actions look like c and are self-explanatory.

People writing kernel modules will know about copyin and copyout: These functions copy data from kernel to user address space and vice-versa.

This is what we saw:

root@m8000a:/root/dtrace>./ioctl.d
E pid proc: 17738 tapewriter
flags: 10028
uscsi_status: 0
uscsi_timeout: 7fff
uscsi_cdblen: 6
uscsi_buflen: ff
uscsi_bufaddr: 565598
uscsi_rqlen: 84
uscsi_rqstatus: 0
uscsi_rqbuf: 0
uscsi_cdb: 24d9f0
cdb first byte: 18 hex 12
cdb 2nd byte: 0 hex 0
cdb 3rd byte: 0 hex 0
cdb 4th byte: 0 hex 0
cdb 5th byte: 255 hex ff
cdb 6th byte: 0 hex 0

R pid proc errno: 17738 tapewriter 22
retval: -1
flags: 2
uscsi_status: 0
uscsi_timeout: 454a
uscsi_cdblen: 0
uscsi_buflen: 79736572
uscsi_bufaddr: 416e616c
uscsi_rqlen: 0
uscsi_rqstatus: 0
uscsi_rqbuf: 0
uscsi_cdb: 54617065


The first block of output is written upon entry, the first upon return from the call. The error code of 22 means EINVAL, "Invalid Argument". Did anything catch your eye?

Yep. There is RQENABLE set, but rqbuf is zero. Up to Solaris 10 update 3, Solaris did tolerate this (by simply ignoring the buffer if its null), but with Update 4, the semantics have changed and Solaris now explicitely checks for the buffer if RQENABLE is set. This is where it decides to return EINVAL.

Exercise to the reader: Find these pieces of code in the Solaris source. At about what time has the code been changed? You can browse the source at OpenSolaris.org

Stuck!?

For some reason, we really needed to run tapewriter, otherwise we could not proceed with the test. tapewrite is a third party application, and the manufacturer was already developing a patch (thanks to dtrace we could exactly tell him where to look (I was sure it was the flag as I quickly wrote a c application to check that)). However, this will take some time and it seemed we could not work around that problem.  Switching to U3 was not an option, as that would require re-importing the database, which took nine days.

We were expecting to run into even more problems, as other interfaces may have changed as well. So we had to go on as quickly as possible, bypassing the faulty call.

dtrace saving us ... lots of time

The answer was to have dtrace change tapewriter's call on the fly, clearing the RQENABLE flag.

The revised script looks like this:

#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option destructive

struct uscsi_cmd32      \*ustruct;

syscall::ioctl:entry
/(arg1==0x4c9)&&(execname=="tapewriter")/
{
ustruct=copyin(arg2,sizeof(\*ustruct));
printf ("E pid proc: %i %s\\n",pid,execname);
printf ("flags: %x\\n",ustruct->uscsi_flags);

/\* clear RQENABLE flag \*/
ustruct->uscsi_flags &=~(0x10000);
copyout(ustruct,arg2,sizeof(ustruct->uscsi_flags));

/\* read back struct to verify change \*/
ustruct=copyin(arg2,sizeof(\*ustruct));
printf ("flags: %x\\n",ustruct->uscsi_flags);
printf ("uscsi_timeout: %x\\n",ustruct->uscsi_timeout);
printf ("uscsi_cdblen: %x\\n",ustruct->uscsi_cdblen);
printf ("uscsi_buflen: %x\\n",ustruct->uscsi_buflen);
printf ("uscsi_bufaddr: %lx\\n",(unsigned long)ustruct->uscsi_bufaddr);
printf ("uscsi_rqlen: %x\\n",ustruct->uscsi_rqlen);
printf ("uscsi_rqbuf: %lx\\n",(unsigned long)ustruct->uscsi_rqbuf);
printf ("uscsi_cdb: %lx\\n",(unsigned long)ustruct->uscsi_cdb);

first=(char \*)copyin(ustruct->uscsi_cdb,6);
printf ("cdb first byte: %i hex %x\\n",first[0],first[0]);
printf ("cdb 2nd byte: %i hex %x\\n",first[1],first[1]);
printf ("cdb 3rd byte: %i hex %x\\n",first[2],first[2]);
printf ("cdb 4th byte: %i hex %x\\n",first[3],first[3]);
printf ("cdb 5th byte: %i hex %x\\n",first[4],first[4]);
printf ("cdb 6th byte: %i hex %x\\n",first[5],first[5]);
self->ok=1;self->bufadr=arg2;
}

syscall::ioctl:return
/self->ok/
{
 self->ok=0;
 printf ("R pid proc errno: %i %s %i\\n",pid,execname,errno);
 printf ("retval: %i\\n",arg0);
 ustruct=copyin(self->bufadr,sizeof(\*ustruct));
 self->bufadr=0;
 printf ("flags: %x\\n",ustruct->uscsi_flags);
 printf ("uscsi_status: %i\\n",ustruct->uscsi_status);
 printf ("uscsi_timeout: %x\\n",ustruct->uscsi_timeout);
 printf ("uscsi_cdblen: %x\\n",ustruct->uscsi_cdblen);
 printf ("uscsi_buflen: %x\\n",ustruct->uscsi_buflen);
 printf ("uscsi_bufaddr: %lx\\n",(unsigned long)ustruct->uscsi_bufaddr);
 printf ("uscsi_rqlen: %x\\n",ustruct->uscsi_rqlen);
 printf ("uscsi_rqstatus: %x\\n",ustruct->uscsi_rqstatus);
 printf ("uscsi_rqbuf: %lx\\n",(unsigned long)ustruct->uscsi_rqbuf);
 printf ("uscsi_cdb: %lx\\n\\n",(unsigned long)ustruct->uscsi_cdb);
}


To make dtrace accept the copyout command, I had to include the destructive directive at the start of the script. 

And it worked! It worked so well they decided to set this script up as a pre-exec script to tapewriter, meaning that it will be run automatically every time tapewriter is run. There is a post-exec script that kills dtrace when tapewriter is done.

Disclaimer

This is a rather dirty hack and we could not really forsee what the implications were for the execution of tapewriter. Remember that we did this in a testing environment, and rendering the system unusable would not have had any business impact.

Use with caution! In this case, it just saved about a week of waiting for the patch.

 

About

Dirk Wriedt

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
Software for Solaris
Favourite blogs
Dirks Bookmarks

No bookmarks in folder