Information Technology Reference
In-Depth Information
mon bug and it will cause very soon a kernel stack
overflow. Even too deep recursive call can easily
make the stack growing fast and overflowing. This
is also correct for deeply nested code. The kernel
stack size is very small and even the kernel stack
of Windows that can be 12KB or 24KB might
overflow very quickly if the kernel code is not
written carefully.
Also a common guidance is not to use local
variables in kernel code. Global variables are not
pushed upon the kernel stack; therefore they will
save space on the kernel stack and will not cause
a kernel overflow. This guidance is definitely
against software engineering rules. A code with
only global variables is quite hard to be read and
quite hard to be checked and rewritten; however
since the kernel stack space is so precise and even
a tiny exceeding will be terribly devastating, kernel
code developers agree to write an unclear code
instead of having a buggy code.
Another frequent guidance is not to declare local
variables as a single character or even as a string of
characters if the intention is to create a local buffer
for a function in the kernel code. Instead, the buf-
fer should be put in a paged or a non-paged pool
and then a declaration of a pointer to that buffer
can be made. In this way, when a call from this
kernel function is made, not all the buffer will be
pushed upon the kernel stack and only the pointer
will actually be pushed upon the stack.
This is also one of the reasons why the ker-
nel code is not written in C++. C++ needs large
memory space for allocations of classes and
structures. Sometimes, these allocations can be
too large and from time to time they can be a
source for kernel stack overflows.
There were some works that suggested to dedi-
cate a special kernel stack for specific tasks e.g.
(Draves et al., 1991); however, these additional
kernel stacks make the code very complex and the
possibilities for bugs in the kernel code become
more likely to happen.
Some works tried to implement a hardware
solution e.g. (Frantzen and Shuey, 2001); however
such a solution can be difficult to implementation
because of the pipelined nature of the nowadays
machines. In order to increase the rate of comput-
ers, many manufacturers use the pipeline method
(Jouppi and Wall, 1989), (Kogge, 1981), (Wise-
man, 2001), (Patterson and Hennessy, 1997).
This method enables performing several actions
in a machine in parallel mode. Every action is in
a different phase of its performing. The action is
divided into some fundamental sub-actions which
can be performed in one clock cycle. In every
clock cycle, from every action, the machine will
perform a new sub-action. A pipeline machine
can perform different sub-actions in parallel. In
every clock cycle, the machine performs sub-
actions for different actions. The stack handling is
complicated because it is depended on the braches
to functions which are not easy to be predicted;
however, some solutions have been suggested to
this difficulty e.g. (McMahan, 1998).
dynamic Size allocations
In the 1980s, a new operating system concept
was introduced: the microkernels (Liedtke, 1996),
(Bershad et al., 1995). The objective of micro-
kernels was to minimize the kernel code and to
implement anything possible outside the kernel.
This concept is still alive and embraced by some
operating systems researchers (Leschke, 2004),
although the classic operating systems like Linux
still employ the traditional monolithic kernel.
The microkernels concept has two main advan-
tages: First, the system is flexible and extensible,
i.e. the operating system can easily adapt a new
hardware. Second, many malfunctions are isolated
like in a regular application; because many parts
of the operating system are standard processes
and thus are independent. A permanent failure
of a standard process does not induce a reboot;
therefore, the microkernel based operating systems
tend to be more robust (Lu and Smith, 2006).
A microkernel feature that is worthy of note is
the address space memory management (Liedtke,
Search WWH ::




Custom Search