[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: 1768184447538264.jpg (1.23 MB, 3458x3813)
1.23 MB
1.23 MB JPG
previous: >>107841306

#define __NR_mprotect            10


this guy is pretty similar to mmap in a lot of ways, with the obvious difference being that mprotect only lets you change the protections of mappings which already exist.
since we didn't talk about SIGSEGV much in the last thread, perhaps that could be the focus of this one?

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/
>>
i'll give it a bmup
>>
>>107851217
What's an example usage of mprotect? I understand why the kernel would need to be able to set permissions on pages, but why would this need to be done at the user level?
Maybe if you want to do something with a JIT? You could dump machine code straight into RAM and mark the pages as executable.
I don't think mprotect really does much for security, because your code can just call it anytime. Maybe if you have a virtual environment in your program that you can enter and exit, then it can be helpful for security? You'd need to male sure that the virtual environment can never call mprotect.
>>
>>107853273
Usually there's a forbidden page just past the end of stack memory so that you crash in case of a stack overflow. This sort of thing isn't airtight but it can be very helpful.
I think it tends to be a mitigation, something that hopefully prevents bad consequences once something else has gone wrong.



[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.