Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Feb 1999 11:58:13 -0600 (CST)
From:      Oscar Bonilla <obonilla@fisicc-ufm.edu>
To:        dan@jgl.reno.nv.us, grios@netshell.vicosa.com.br
Cc:        freebsd-questions@FreeBSD.ORG, grog@lemis.com
Subject:   Re: assembly
Message-ID:  <199902241758.LAA41672@fisicc-ufm.edu>
In-Reply-To: <36D1BAB6.BB3F8701@netshell.vicosa.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
> I don't believe (i am sorry if i am wrong, but i am a beginner)!
> If i use assembly i do not need to read a file via read API, i can
> access the HD directly, without to check for access permissions, right ?
> If so, i can hack a UNIX system (no matter which) using assembly!
>
> Am i wrong ?
>
YES!

i know you've been replied more than once on this, but here goes my reply too.

advice: get a book about operating systems and another book on computer
architecture.

look up the following:

dual mode operation (kernel mode, user mode)
protection
address spaces
memory translation

assembler is a programming language, and as such is no different than C.
i mean, the c compiler translates your C code to assembler and the assembles
it using an assembler (as). Anything you can do in assembler you can do in C.
the protection is not in the C compiler, is in the way the cpu runs your programs.  in unix, the kernel runs in a higher level of protection than user programs.
this means that some instruction are priviledged and can only be executed by
the kernel.

if you write a program in assembler that tries to write directly to the
hard drive without using the system call interface (API as you called it)
the cpu will say "hey! this is a priviledged operation this user program is
trying to execute, better check what the kernel has to say about it" and
inform the kernel via a trap. the kernel will happily kill your process.
end of story.

as i said before, get a book about OS's and CA.

regards,

-oscar



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902241758.LAA41672>