[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


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


previous: >>108370984

#define __NR_chmod                90
#define __NR_fchmod 91
#define __NR_fchmodat 268
#define __NR_fchmodat2 452

https://man7.org/linux/man-pages/man2/chmod.2.html

tl;dr:
change file "mode" (permissions)

looks like there's no manpage up yet for fchmodat2. interesting. but it does exist in the linux kernel (https://elixir.bootlin.com/linux/v6.19.8/source/fs/open.c#L704) and it lets you set the AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH flags.
there's a lot to say about this topic. DAC in general is pretty handy, and used extremely widely. i am personally a bit more fond of MAC, but both have their place in any secure system. the sticky and suid bits are a bit bizarre in the way they're glommed on with the access permissions, but i guess it's as good a place as any for them

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/
>>
>>108378070
Would
>>
Don't give your cats milk.
Give them cream.
>>
>>108378070
fat
>>
alrigh /g/, which one is it?
0400 or S_IRUSR?
>>
>>108379143
i always do the macros, and if i'm feeling nice, i'll occasionally put the combined octal in a comment to the side
i have been trying to avoid magic numbers as much as possible the past few years, even if it's just to pull it to the top of the function and do something like
const int mode = S_IRUSR | S_IRGRP;  // 0440
>>
>>108378070
On OpenBSD a process which has called pledge(2) is only allowed to call chmod(2) and friends if they have the fattr promise active. Even with the fattr promise the setuid, setgid and sticky bits will be masked out of any call to chmod(2), or any other function which sets a files mode.
>>
>>108380392
presumably this is some sort of security/sandbox measure?
>>
>>108378288
Your’re not the boss here!
>>
>>108380450
Yes. It is similar to seccomp on linux, except that instead of specifying a filter for system call arguments you specify a set of "promises", which are behaviour sets that generally correspond to interfaces in libc. These include specific allowed system calls and restrictions on their arguments, as well as some deeper behaviours, like only allowing accept(2)/connect(2) on specifically allowed socket types. If you attempt to perform an action not allowed by your pledge(2) promises your program is killed. You can read more about it here: https://man.openbsd.org/pledge. The source code for pledge(2) is also somewhat interesting and it is pretty self contained. You can see it here: https://cvsweb.openbsd.org/checkout/src/sys/kern/kern_pledge.c,v?rev=1.347. The pledge_namei() function is especially interesting as it shows the paths that programs tend to need access to even if they otherwise dont acess the filesystem.
>>
bampu



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