this post was submitted on 02 Sep 2023
29 points (100.0% liked)

Programming

13376 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

I have never dug into low level things like cpu architectures etc. and decided to give it a try when I learned about cpu.land.

I already was aware of the existence of user and kernel mode but while I was reading site it came to me that "I still can harm my system with userland programs so what does it mean to switch user mode for almost everything other than kernel and drivers?" also we still can do many things with syscalls, what is that stopping us(assuming we want to harm system of course) from damaging our system.

[edit1]: grammar mistakes

you are viewing a single comment's thread
view the rest of the comments
[–] farcaster@beehaw.org 28 points 1 year ago (9 children)

Well hopefully you can't harm your computer with userland programs. Windows is perhaps a bit messy at this, generally, but Unix-like systems have pretty good protections against non-superusers interfering with either the system itself, or other users on the system.

Having drivers run in the kernel and applications run in userland also means unintentional application errors generally won't crash your entire system. Which is pretty important..

[–] duncesplayed@lemmy.one 1 points 1 year ago (5 children)

dd if=/dev/zero of=/dev/sda is a userland program, which I would say causes harm.

[–] jarfil@beehaw.org 8 points 1 year ago (3 children)

/dev/sda access requires superuser/root permissions from the kernel, which means asking the kernel to lift many of the protections.

[–] duncesplayed@lemmy.one 1 points 1 year ago

Yes, which is literally what OP is asking about. They mention system calls, and are asking, if a userland program can do dangerous thing using system calls, why is there a divide between user and kernel. "Because the kernel can then check permissions of the system call" is a great answer, but "hopefully you can't harm your computer with userland programs" is completely wrong and misguided.

load more comments (2 replies)
load more comments (3 replies)
load more comments (6 replies)