11.01.2013 Views

IBM AIX Continuous Availability Features - IBM Redbooks

IBM AIX Continuous Availability Features - IBM Redbooks

IBM AIX Continuous Availability Features - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Load the kernel extension so that a system call can use it form user mode, as shown in<br />

Example 3-27.<br />

Example 3-27 Loading kernel extension using tool “service”<br />

# ./service --load kkey_set64<br />

Preserving 2378 bytes of symbol table [kkey_set64]<br />

[kkey_set64] loaded successfully kernel mid=[546676736]<br />

Run myprog without any argument, which means it will run the kernel extension (syscall) with<br />

the appropriate protection gate {{KKEYSET_KERNEXT}+KKEY_VMM}. Because the private<br />

heap of the kernel extension has been protected by KKEY_VMM, you can access it and the<br />

system call will return without any DSI/crash.<br />

Execute the user-level program that will call the kernel system call with protection gate<br />

enabled with KKEY_VMM, as shown in Example 3-28.<br />

Example 3-28 First iteration with KKEY_VMM<br />

#./myprog<br />

Testing Kernel Storage key<br />

Current hardware keyset =0008000000000000<br />

hardware keyset after KERNEXT =F00F000000000000<br />

hardware keyset after KKEY_VMM=F00C000000000000<br />

Now execute the user-level program that will call the kernel system call with a protection gate<br />

without KKEY_VMM key in its keyset (see Example 3-29 on page 96). This will cause the<br />

kernel to crash. Running myprog with argument>2 will do that.<br />

Because the private heap of the kernel extension has not been protected by KKEY_VMM, a<br />

DSI will result and the kernel will crash. Keep in mind that exception type EXCEPT_SKEY<br />

cannot be caught with setjmpx(), so the kernel programmer cannot catch EXCEPT_SKEY<br />

using setjmpx().<br />

Note: There are kernel services provided for catching storage-key exceptions. However,<br />

their use is not recommended and they are provided only for testing purposes.<br />

Example 3-29 Second iteration without KKEY_VMM<br />

# ./myprog 1<br />

Current hardware keyset =0008000000000000<br />

hardware keyset after KERNEXT =F00F000000000000<br />

hardware keyset after KKEY_VMM=F00C000000000000<br />

hardware keyset w/o KKEY_VMM =F00F000000000000<br />

Data Storage Interrupt - PROC<br />

.kkey_test+0002C8 stb r3,A(r4)<br />

r3=000000000000000A,A(r4)=F10006C00134A00A<br />

KDB(6)><br />

When you are debugging in kernel mode (see Example 3-30), you can see the value of the<br />

AMR (current hardware key or protection gate), the current process which caused the<br />

exception, and the exception type. Refer to 3.7.8, “Kernel debugger commands” on page 108<br />

96 <strong>IBM</strong> <strong>AIX</strong> <strong>Continuous</strong> <strong>Availability</strong> <strong>Features</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!