开发者

Adding a "useful" syscall not normally available to a non-root user

I've implemented a simple Hello World syscall with limited functionality — that simply transitions from user mode to kernel mode, prints a message that is logged wit开发者_如何学JAVAh the kernel messages, and transitions back to user mode.

The next step for extra credit is to add a useful (new) syscall that is not normally available to a non-root user.

The syscall can be a simple as we like but I'm struggling to come up with any ideas... can someone point me in the right direction or towards something that would be easily implemented? (A hint we were given was to use your new syscall for debugging purposes!)


There's a fair amount of information in the kernel structures about processes: page locations, memory statistics, I/O statistics and file handle information, CPU scheduling information, etc. While most of it might be available to the user through things like the proc filesystem, getting that information programmatically probably requires parsing the proc output, etc. Providing a way to get this type of information about a process (maybe paying less attention to security issues that might arise for the time being) could be useful.


A user cannot normally gift ownership of a file that they own themselves to another user (of course, there's sound reasons for that!). You could implement a syscall to do that. Don't forget to clear the setuid bit!


How about just setting the current process's uid to 0, essentially a "back-door" syscall that gives root access to any user that calls it?


Perhaps a new call to specifically update the system date and time from a trusted NTP server? I believe that a normal user is unable to do this on their own.

Changing the network settings in some way? Release/renew DHCP lease, or implement simple network locations that are predfined batches of settings stored in a root-writable config file.


The simplest thing to do - for debugging - would create a syscall that gave you direct access to the kernel's "printk" call!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜