Meditation, The Art of Exploitation

Thinking? At last I have discovered it--thought; this alone is inseparable from me. I am, I exist--that is certain. But for how long? For as long as I am thinking. For it could be, that were I totally to cease from thinking, I should totally cease to exist....I am, then, in the strict sense only a thing that thinks.

Sunday, September 30, 2007

Installing vmware on opensuse 10.2 (and similar Linux distro)

1. Download vmware (preferrably the RPM version) and install it.
2. /usr/bin/vmware-config.pl

This script will prompt you for the version correct kernel headers. Chances are you don't have a match between your kernel image, kernel header and kernel source. In my case, I have:
pc-feiliu:/usr/src/linux-2.6.18.8-0.5 # rpm -qa|grep kernel
kernel-default-2.6.18.2-34
linux-kernel-headers-2.6.18.2-3
kernel-source-2.6.18.8-0.5

Don't panic yet. Make sure you have a relatively close kernel source available. Then follow the advice in this URL: http://www.linuxquestions.org/questions/showthread.php?t=553299

In my case, this is the transcript:
pc-feiliu:/usr/src/linux-2.6.18.8-0.5 # cp /boot/config-2.6.18.2-34-default ./.config
pc-feiliu:/usr/src/linux-2.6.18.8-0.5 # make modules_prepare

3. Rerun /usr/bin/vmware-config.pl
When prompted the kernel headers, give these:
The path "/usr/src/linux/include" is a kernel header file directory, but it is
not configured yet.

What is the location of the directory of C header files that match your running
kernel? [/usr/src/linux/include] /usr/src/linux-2.6.18.8-0.5/include

After answer a few more questions, you should be ready to go with a successful vmware install.

Tuesday, September 11, 2007

C++ error code, return value, assert, and exception

1. return value + error code traditional C++ technique to indicate error to client
2. logical error in coding, use assert to detect logical error during run time
3. logical error in design, use static_assert to detect compile time error due to design issues
4. exception, an extremely useful to tool to handle run time error gracefully.

C++ const correctness, boost shared_ptr and reference counting

1. what's C++ const correctness
2. how does shared_ptr work
3. how does shared_ptr gets around const correctness
4. pointer and get too smart with the compiler