[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1740201892575669.png (631 KB, 1393x921)
631 KB
631 KB PNG
previous: >>107860495

#define __NR_brk                12


now THIS is a strange syscall. it's always a good sign when the notes section advises you not to use a function, lol. if you haven't read any of the other man pages yet, go read this one: https://man7.org/linux/man-pages/man2/brk.2.html
>the actual Linux system call returns the new program break on success.
>On failure, the system call returns the current break.
such a bizarre api. there's lots of bookkeeping and hoops required if you dare to use this syscall for your allocator. but it's pretty neat to use in toy examples. it requires a very nonstandard approach

relevant resources:
man man

man syscalls

https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/
>>
Usecase?
>>
>>107868233
>Usecase?
It's needed for your process to get more memory, e.g. so that malloc / new can actually allocate it for your pointers.

According to quick search, now malloc/etc prefer to use mmap and other mechanisms usually.

>>107868194
how about you mention the use case in first post

brk() and sbrk() change the location of the program break, which
defines the end of the process's data segment (i.e., the program
break is the first location after the end of the uninitialized
data segment). Increasing the program break has the effect of
allocating memory to the process; decreasing the break deallocates
memory.
>>
Does anyone actually write programs for linux in assembly? What kind of person is interested in syscalls other than compiler authors? (Not judging, just curious)
>>
>>107868275
>What kind of person is interested in syscalls other than compiler authors? (Not judging, just curious)
libc authors
people doing security (restricting syscalls)
>>
>>107868264
>how about you mention the use case in first post
i mean, that's sort of what the links to the man pages are for. depending on the specific syscall, its use case might be pretty complicated, so it wouldn't always fit nicely into the OP. i generally try to include at least a small blurb about the syscall to get discussion started, though. but i would hope most people are reading through the man pages before replying. maybe i am being unrealistic with my expectations... i guess it probably wouldn't hurt to include a link to the specific manpage for each day's syscall, at least
>>107868275
there are certain situations (e.g. embedded development) where you won't have access to the standard library, so you need to write your own implementation of a lot of quality of life features that it provides
>>
>>107868290
How does reducing syscalls improve security?
>>
>>107868311
nta, but syscalls are very powerful. it's giving you direct access to features of the kernel. depending on your security model, it's pretty easy to use them to bypass certain security measures. that's the whole raison d'être for seccomp: https://en.wikipedia.org/wiki/Seccomp
really interesting subject. you should definitely read up on it if you're at all inclined
>>
>>107868311
>>>107868290 (You)
>How does reducing syscalls improve security?
for example, if your program can't use any of the syscalls that can open files, then it will never open any file to steal data from it, even if program is 100% pwnd and does what ever the attacker tells it to do, the OS will refuse to do it.

you need of course first to block even more powerful syscalls e.g. starting new processes and more, I think

Also your program can try to attack kernel itself (by bugs in kernel) which is another region of the war (and is mostly up to the OS the git gud)
>>
>>107868290
>libc authors
>people doing security (restricting syscalls)
also, debugging programs - with strace.
that's a nice way to ask "wtf is this program doing right now" if you mean what effect it has besides internally calculating
>>
Of course, if you care about security THAT deeply, Linux would be your second choice to OpenBSD.
>>
>>107868275
System calls make the operating system POSIX compliant.
>>
>>107868393
>Of course, if you care about security THAT deeply, Linux would be your second choice to OpenBSD.

That's right, use at least OpenBSD (better use microkernels, e.g. research Genode).

Although in all of them you have syscalls of some kind, it's nice to know that. (In microkernel userspace programs probably too, right?)
>>
>>107868437
microkernels seem really interesting to me. i have been meaning to read up on them for a few months now. any other recommendations beyond genode?
>>
>>107868461
>microkernels seem really interesting to me. i have been meaning to read up on them for a few months now. any other recommendations beyond genode?

I think Genode will be the one to try. AFAIK they both support being a host for hypervisor (so you run other systems later on inside it),
and they also are using SeL4 or can use it (which was pretty famous).

Hang around /g/ we will discuss this stuff over time. Put "microkernel" in topic when doing so
>>
>>107868194
Isn't brk just a happy-path version of mmap on any arch with an MMU?
>>107868275
You can use syscalls from C in a way that preserves the libc's state if you use its wrappers. This is not that useful for brk but is for eg io_uring and, often, read. Since C FILE *s don't give you nearly enough information to do most stuff you'd want to do.
>>
>>107868194
some other pages that advise you not to use a function:
signal
s{g,s}etmask
select
gets(3)
fpurge(3)
>>
>>107868275
are you referring to the actual syscalls, or also the libc wrapped versions?
>>
>>107868826
lol @ fpurge
>>
>>107868264
>According to quick search, now malloc/etc prefer to use mmap and other mechanisms usually.
That means "none."
>>
>>107869459
>>According to quick search, now malloc/etc prefer to use mmap and other mechanisms usually.
>That means "none."
wat?
99% of all non trivial programs need mallocs or new
>>
File: 98ranwallpaper.jpg (177 KB, 1024x768)
177 KB
177 KB JPG
>>107868461
TRON is the best microkernel.
t. OpenBSD developer

>>107868336
>nta
Stop doing this.
>>
>>107869521
>Stop doing this.
why?
>>
>>107869543
Because it's retarded and all you're doing is outing yourself as being very new. I was nice and tried to help you. I won't do it again.
>>
>>107869551
i've been using 4chan since 2011
>>
>>107869437
hm?
>>
>>107869502
Look at OP again.
>>
>>107869587
I don't believe you. Even if it were true that still means you showed up 3-4 years after the cancer was already unbearable. In other words; It isn't any type of flex.

We don't need to know that you're not that anon. We already know based on the content of your post. Even if you were that anon it wouldn't matter. This trend is retarded and started a year ago. It was stupid then and it's stupid now. Stop doing it. Everyone will just assume you're an outsider and ignore the content of your post. You're basically being a tripfag without entering a tripcode at this point.

I was here many years before you claimed to have showed up but I don't feel the need to tell everyone because it's unrelated to the content to any thread worth posting in. Much like this off-topic discussion is unrelated to this one. Like I said I was being nice. I won't do it in the future. This is why I don't do it. You're already trying to turn it into a pissing contest because I called you out.
>>
>>107869551
saying nta is very normal, anon
>>
>>107869624
just the wording in its notes was amusing
>>
>>107869628
>You're already trying to turn it into a pissing contest
holy projection lol
>>
>>107869634
Ah, I thought you were referring to the function in general
And indeed, the dry writing style is sometimes unintentionally amusing
>>
>>107869628
It has been going on for much longer than a year. But yes, it is comparably new, which doesn't change the fact that it is quite useful.
>>
>>107869671
It's not useful at all. It's stupid. It's something only an attention whore would do.

The only purpose it serves is knowing if the person using it showed up after about 2023.
>>
>>107868275
no, certainly not
https://2ton.com.au/
if only there were some way to search for information on topics like this
some kind of engine for searches
we could call it a search engine
>>
File: microkernel-comparsion1.png (183 KB, 1231x932)
183 KB
183 KB PNG
>>nta
>>107869551
I think it's ok either way.

>>107869521
Tron might be interesting.... for micro controllers?

Strengths

Extremely small footprint (kilobytes)

Deterministic real‑time behavior

Simple API, easy to implement

Billions of deployed devices (phones, appliances, automotive ECUs)

Vendor freedom: many commercial and open implementations

Limitations

Not a full OS—no standard filesystem, networking, or drivers

No formal verification

No unified ecosystem (each vendor’s implementation differs)

Not designed for high‑assurance security


Because TRON is a spec, each vendor’s implementation has its own license. Examples:

µITRON implementations from different companies may be proprietary

Some ITRON kernels are open source (e.g., TOPPERS/JSP, TOPPERS/ASP)

Others are commercial RTOS products

Some are deeply embedded in hardware and never released publicly

More details in picrel
>>
File: kek.jpg (93 KB, 385x390)
93 KB
93 KB JPG
>>107869699
>if only there were some way to search for information on topics like this
>some kind of engine for searches
>we could call it a search engine
kek



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.