Friday, February 29, 2008

Solaris Threading Model

I was looking for a detailed account of Solaris Kernel's architecture, specifically the threading model, and I found this book Solaris Internals. The one I have talks about Solaris 7's architecture. Now I believe that minute architectural details change frequently in Solaris because of the aggressive involvement of the OpenSolaris community. So, I might not be up to date with whatsoever I will discuss about here.

The basic execution unit in Solaris is a Process. Each process has its own Virtual Memory/Machine Environment. Now this environment is nothing more than a name given collectively to objects associated with a process, e.g. the address space, global variables, open files, accounting information etc. Such an environment isolates the process from other processes in the system which are apparently running concurrently.

By default, each process has atleast one thread of execution which is the default main thread. And, each Solaris process can have multiple threads, where all the threads share the same Virtual Memory environment of that process. The kernel uses time-slicing to allocate the CPU to these process threads, and once a process is taken off a CPU, its complete execution environment consisting of per thread items(program counter, stack, registers etc) are saved so that the thread can be resumed at some later time.

Now, in Solaris, Kernel threads execute on the CPU. Kernel threads are different from the User or Process threads in the sense that there creation and management is a responsibility of the kernel itself, and not some threading api. So now, we have discussed Kernel Threads and the thread contained by a process. Before discussing the threading model, it's better to talk about one more dimension of threads in Solaris. The Solaris kernel is multithreaded - "it is implemented with multiple threads of execution to allow concurrency across multiple processors". Such a kernel allows concurrent access to itself to improve performance on a multiprocessor system.

Wednesday, February 20, 2008

Troubleshooting SXDE installation and initial setup

Where SXDE is Solaris Express Developer Edition. In the following discussion, I am talking about Solaris Express Developer Edition 02/08, while using the word Solaris or OS.

During the last week's few nights, I struggled to pump up my Solaris as a competitve alternative to my existing Windows XP. However, I failed. Unexpectedly, I faced certain problems which I never had with most of the linux distros I ever installed.

First Problem: Solaris can't be installed on Extended Logical Partition.

I am not sure about the current status but, while googling it I found this to be declared as a bug, which was being taken care of back in 2006. I expected it to be resolved by 2008 however, I wasn't able to even look at the free space available within the extended logical partition in the Parition Manager, while installing Solaris.

Solution: Now since Windows XP don't allow you to have more than 3 primary partitions, I had to delete one from my machine. Once I did that, I had 5 gb free, but I required 20GB which is recommended for a smooth Solaris installation. Anyways, I wsa able to MOVE/RESIZE my extended logical parition to the point that the 15GB free space poped out of this extended partition, and I finally had 15+5 GB able to be used as a Primary Partition. That was it, I was done by using those 20GB to create a 'Solaris' Partition.

Second Problem: Wireless Internet connection not working.

I have a Dell Inspiron e1505, with a Dell 1390 Wireless Minicard. I assumed Solaris capable enough to do some sort of driver detection to get that thing running automatically, but it wasn't as simple. For certain reasons, I had to use Solaris NDIS(Network Driver Interface Specification) Wrapper Toolkit. This toolkit somehow makes use of the native binary Windows drivers of wifi cards to be used in Solaris. Also, one sort of limitation was that a 32 bit windows

driver can only be used in 32bit Solaris and not in 64Bit Solaris. Here, I was stucked again. By default, the installed Solaris was 64-bit Edition. And, there were no 64bit drivers for my Wifi card.

So, there was a grub-based workaround that I found in carlton's guide to boot up the 32 bit Solaris. All you have to do is to goto /boot/grub and edit the file menu.lst as follows:

Since I had a previous Windows XP Installation, I was able to find the string "title Windows" in the menu.lst file. Right above it, append (add) the following:

title Solaris Express Developer Edition 02/08 (32 Bits)
kernel$ /platform/i86pc/kernel/unix
module$ /platform/i86pc/boot_archive

Once done, restart the pc, and select this GRUB option from the boot menu to boot the 32 bit version of Solaris. Now you are ready to lookout over the internet for the 32 bit driver for you wifi card. So, find one. I got mine at dell.com. In that driver package, only 2 files were required by NDIS toolkit, which were:

bcm32.inf file (ASCII text file) - It contains information that tells the Windows installer what devices this driver supports and what registry keys should be created to control driver's configuration.

bcm32.sys file (binary file) - This file contains the actual driver executable code in Windows Portable Executable (PE) format.

You also need the NDIS Wrapper Toolkit which can be downloaded from here. Now, I won't rewrite the steps I did as I followed nothing more than what Carlton's little guide talks about. It's comprehensible and straight forward.

But finally, after doing it all, I was again troubled with 3 more problems:

1- I was ONLY able to access the www using IPs and not the domain names, for e.g. I could access Google if I type http://64.233.167.147 at the browser. But,

I couldn't access the same if I type http://www.google.com. I resolved this by making a little change in /etc/nsswitch.conf file. I changed the 'hosts: files' to 'hosts: files dns'(more on this). And that was it.

2- I couldn't sort out to activate the wifi connection automatically on startup. Although I have checked the same option in Networks Panel but, it helping me out.
3- Sometimes, the connection is lost when I play around with and apparently the only solution then turns out to be a system restart.

Wednesday, February 13, 2008

LLVM 2.2

Where LLVM stands for Low Level Virtual Machine.
I found about it while skimming through slashdot.

As of Wikipedia,
"The Low Level Virtual Machine, generally known as LLVM, is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary imperative programming languages. The LLVM project started in 2000 at the University of Illinois at Urbana-Champaign."

As of Slashdot,
".. This is the thirteenth public release of the open-source compiler that started as a GCC fork. LLVM supports several aggressive optimizations, in compile-, link- and run-time, and often produces faster (1.5-3x) code than GCC. It is also much faster than GCC at compiling (despite the slow link-time optimizations). Gentoo users are already trying to build the whole system with the LLVM toolchain to get the extra performance bit."

Few features of LLVM as listed on its homepage are,

  • Front-ends for C and C++ based on the GCC 3.4 and 4.0.1 parsers. They support the ANSI-standard C and C++ languages to the same degree that GCC supports them. Additionally, many GCC extensions are supported. LLVM also includes a front-end for "Stacker", a Forth-like language.
  • A stable implementation of the LLVM instruction set, which serves as both the online and offline code representation, together with assembly (ASCII) and bytecode (binary) readers and writers, and a verifier.
  • A powerful pass-management system that automatically sequences passes (including analysis, transformation, and code-generation passes) based on their dependences, and pipelines them for efficiency.
  • A wide range of global scalar optimizations.
  • A link-time interprocedural optimization framework with a rich set of analyses and transformations, including sophisticated whole-program pointer analysis, call graph construction, and support for profile-guided optimizations.
  • An easily retargettable code generator, which currently supports X86, X86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, Alpha, and IA-64.
    A Just-In-Time (JIT) code generation system, which currently supports X86, X86-64, PowerPC and PowerPC-64.
  • Support for generating DWARF debugging information.
  • A C back-end useful for testing and for generating native code on targets other than the ones listed above.
  • A profiling system similar to gprof.
  • A test framework with a number of benchmark codes and applications.
  • APIs and debugging tools to simplify rapid development of LLVM components

Where strengths being,

  • LLVM uses a simple low-level language with strictly defined semantics.
  • It includes front-ends for C, C++, and Stacker (a forth-like language). Front-ends for Java, Scheme, and other languages are in development.
  • It includes an aggressive optimizer, including scalar, interprocedural, profile-driven, and some simple loop optimizations.
  • It supports a life-long compilation model, including link-time, install-time, run-time, and offline optimization.
  • LLVM has full support for accurate garbage collection.
  • The LLVM code generator is relatively easy to retarget, and makes use of a powerful target description language.
  • LLVM has extensive documentation and has hosted many projects of various sorts.
    Many third-party users have claimed that LLVM is easy to work with and develop for. For example, the Stacker front-end was written in
    4 days by someone who started knowing nothing about LLVM. Additionally, LLVM has tools to make development easier.
  • LLVM is under active development and is constantly being extended, enhanced and improved. See the status updates on the left bar to see the rate of development.
  • LLVM is freely available under an OSI-approved "three-clause BSD" license.
  • LLVM is currently used by several commercial entities, who contribute many extensions and new features.

And the intended users include,

  • A compiler researcher interested in compile-time, link-time (interprocedural), and runtime transformations for C and C++ programs.
  • A virtual machine researcher/developer interested in a portable, language-independent instruction set and compilation framework.
  • An architecture researcher interested in compiler/hardware techniques.
  • A security researcher interested in static analysis or instrumentation.
  • An instructor or developer interested in a system for quick prototyping of compiler transformations.
  • An end-user who wants to get better performance out of your code.

[sources: http://developers.slashdot.org/article.pl?no_d2=1&sid=08/02/12/1431222, http://llvm.org/Features.html, Wikipedia]

Tuesday, February 12, 2008

Bill Clinton at George Mason




Bill Clinton at our campus (George Mason University, Fairfax), supporting Hillary's presidential campaign..

Thursday, February 07, 2008

Mac hack contest

One year after Mac hack contest, Linux & Vista may be tested
IDG News Service 2/6/08Robert McMillan, IDG News Service, San Francisco Bureau

One year after launching a controversial Macintosh hacking contest, the promoters of the CanSecWest security research conference are thinking about giving hackers another shot at cracking the Mac. Only this time, they're looking to broaden the field.

Last year, show organizers invited attendees to hack into a Macintosh laptop, with the successful hacker winning the computer and a cash prize. But this year they're talking about giving attendees three targets to choose from. "We're thinking of having a contest where we have Vista and OS X and Linux ... and see which one goes first," said Dragos Ruiu, the principal organizer of CanSecWest.

Last year, security researcher Dino Dai Zovi spent a sleepless night hacking his Mac in order to take the prize at the show's first PWN to OWN contest. Dai Zovi found a QuickTime bug that allowed him to run unauthorized software on the Mac once the computer's browser was directed to a specially crafted Web page.

Dai Zovi split the contest prize with a friend at the show, Shane Macaulay, who helped him pull off his attack. Macaulay got to keep the Macbook Pro while Dai Zovi pocketed the US$10,000 put up by 3Com's Tipping Point division in exchange for technical details on the bug.

It turned out that the QuickTime bug affected the Windows operating system too, but Ruiu said that Dai Zovi's hack helped change the way the industry thinks about the Mac OS, which has a reputation for being far more secure than Windows. "We were trying to point out that there was a security issue with Mac stuff here, and everybody was trying to play ostrich."

Ruiu and Dai Zovi say that last year's contest helped kick off a flurry of Mac-related security research, but according to TippingPoint Manager of Security Response Terri Forslof, it also illustrated a security industry truism: "Given enough time and motivation, everything can be broken," she said. "When TippingPoint agreed to purchase whatever vulnerability was used to win the contest for $10,000, it added an appropriate level of motivation. That's how it works."

Shortly after last year's contest, Gartner published a research paper warning that such challenges are "risky endeavors" that could put sensitive vulnerability information out in the public domain.

That hasn't stopped CanSecWest from pressing forward with this year's event.

Ruiu isn't certain that he'll run the three-way hacking contest this year. That's because he also has a grander, top-secret hacking contest idea that may or may not pan out, he said.

Either way, he promised "an interesting spectacle."

Bob McMillan is Senior writer for the IDG News Service.
[source: http://security.itworld.com/4341/mac-hack-contest-080206/page_1.html]

Saturday, February 02, 2008

OpenSolaris Concern: Virtualization

If we can identify 3 facets of virtualization of an underlying hardware as
- virtualization to Isolate a 'process' from other processes,
- something that can monitor status of and activities within a virtual machine, and
- being a guest or being a host operating system,

then,
- OpenSolaris has Zones and Branded Zones which provide "protected and virtualized OS environment within an instance of Solaris, allowing one or more processes to run in isolation from other activity on the system', and they "enable kernel and user mode development of Solaris and Linux applications without impacting developers in seperate zones".

- OperSolaris also supports Xen, which is "an open-source virtual machine monitor", and

- OpenSolaris is available as a guest operating system for VMWare. (Get Started)

[source: OpenSolaris - Student Guide]

SXDE Installation Guide: Laptop Installations

Where SXDE is Solaris Express Developer Edition.
The Student Guide titled as "Introduction to Operating Systems: A hands-on approach using the OpenSolaris Project" referred to the following link for installation of SXDE on Laptops:
Solaris Express Developer Edition Installation Guide: Laptop Installations

Since I couldn’t love it by just running it within a virtual machine, I am following these guidelines to install it as another operating system on my machine.

Friday, February 01, 2008

Thinking of a switch? think OS.

Where OS is OpenSolaris.
I am taking Advance Operating Systems course in spring08 semester with Dr. Harry Foxwell at George Mason University. Two things convinced me to get into this class: the professor's profile, and an opportunity to get out of closed Windows..

He is kind of an AIO individual, being an ex-soccer referee, a Vietnam veteran, Senior System Engineer at Sun Microsystems, and an adjunct professor here at GMU, which seemed interesting at a glance.

Then, I remember the references made to Solaris' implementation during my Operating Systems class as being competitive with the contemporary systems, if not any better. I also knew Solaris is based on Unix. And literally, this was the only information I had before taking the first class of this course.

I want to track my progress in learning it, and this text serves the purpose of being the appetizer post. As I will try to gradually fill up my stomach with more *nix-based stuff, I'll try to keep this blog in shape perfected with my knowledgebase.

As of now, I have successfully installed Solaris 10 (commercial version) on VMware Server version 1.0.4, which was a piece of cake while partly following HOW TO INSTALL SUN SOLARIS INSIDE VMWARE WORKSTATION 5.5

But, I feel like I am lacking hardware resources on my inspiron e1505 notebook to enjoy its full capacity. Following up, I downloaded 3 DVDS of Solaris Express Developer Edition 09/07 from opensolaris.org, and burned them.

And yes, I was thinking of a switch, and I'll love one such to OS, if it's supporting my coursework!