What Douglas said is fully correct, Linux is monolithic and a module can do everything. This is a design choice driven mainly by Linus Thorvalds and fits in the Open Source philosophy (why restrict, it costs performance and you can see what a module does from the source - practically speaking only for real nerds :-) -).
Now maybe you have to load some so-called binary modules from 3rd parties. Even if they seem to be compiled there is usually a common object file as black box and only interfaces around it are actually compiled (like for nvidia graphic drivers I use). There is no definite answer, if you load such modules, you have to trust the vendor, if not, don't do it...
Only root can load modules that correct in theory. In practice, however no system is perfect (even Linux). From time to time there are kernel vulnerabilities that can make it possible for local users or for remote users (very rare cases) to introduce code into the kernel so they can root rights and thus can take control of your system. Having a kernel up to date is a good thing...
After precising this, let's go into the second part of the question that has not be answered so far: "what functions do programmers have access to, that could be used for malicous purposes?". Many of the things that are done for SE-Linux can also be used for malicious purposes, like:
- Hiding information in the
/proc
or /sys
directories, for example hiding malicious user processes so they are not displayed in tools like top
, ps
and so on. This includes hiding the malicious module itself so it is not listed in lsmod
.
- log and record key strokes...
- sending data to the outside world. No kernel module needs to connect to a site and send information (excepted the network stack in the original linux code), if the code for the module does that something smells badly. If some strings are encrypted and decrypted to make some operations it smells even worse...
- ...
The list is large, if you want more details you can have a look at Rootkit Hunter (http://www.rootkit.nl/projects/rootkit_hunter.html). It is a tool I run from time to time. It can detect the presence of some widely used rootkits. It manages a list of rootkits and googling the names will make you clear what kind of targets these beasts are following... Like Douglas said, the functions that can be used are actually all the functions available in the kernel, without restriction. So telling if a module is a bad guy or not is not an obvious thing.