- Thread Starter
- #26
We can basically close this thread now.
I feel it NOT logical.And at least one of them tries to separate the kernel in two: part with unsafe Rust, part with safe Rust.
You're correct, of course. But you've not met Rust evangelists. They don't even have those concepts in their periphery.I feel it NOT logical.
Using Rust for memory-unsafe part would easily make confusions in the future.
Using C, asm or some other low to mid level language for unsafe part to clearly mark that the part is MUTUALLY memory-unsafe in mature would be far more cleaner. This way, UNSAFE part of Rust codes can be definitions for interfacing with C / asm / something else. Far more saner.
If I recall correctly, it's one of the reason why C is developed.Edit: Not ASM. I want my OS portable.
Stopped reading here.The fix is ... Rust
As soon as you write low-level code, it's not portable, in C as well as in ASM.Edit: Not ASM. I want my OS portable.
void hal_timerSchedInit(void)
{
// Set up timer1 interrupt for scheduler
TCCR1B |= (uint8_t)(1u << WGM12); // CTC mode
OCR1A = TIMER1_OVERFLOW_COUNT;
TIMSK1 |= (uint8_t)(1u << OCIE1A);
}
Of course not, because all what's C about it, is this:This C code for atmega2560 is highly not portable,
void hal_timerSchedInit(void)
{
// Set up timer1 interrupt for scheduler
|= ()( << ); // CTC mode
= ;
|= ()( << );
}
TCCR1B
uint8_t
1u
WGM12
OCR1A
TIMER1_OVERFLOW_COUNT
TIMSK1
OCIE1A
Edit: Not ASM. I want my OS portable.
If I recall correctly, it's one of the reason why C is developed.
Well, yeah. Those are exactly the two points of why there are HOL:Portability doesn't depend solely on the language, but especially on the existence of compilers for multiple HW arch.
Pretty flawed example, because it completely ignores a lot of important details. First: a regular user can only do so much. Second: users can be limited in their direct access to a system, either through a limited shell, a chroot or maybe using a virtual environment such as a jail. And of course: resource limits are also a thing.1. The Ambient Authority / DAC Model (The Core Problem)
This is arguably the root of everything else. FreeBSD uses Discretionary Access Control (DAC) — the classic Unix user/group/other permission model. The fundamental flaw:
- Permissions are attached to users, not capabilities
- Any process running as a user inherits all of that user's rights
rootis a god-mode binary switch — you either have it or you don't- A compromised process gets the full authority of whoever launched it
The only "problem" here is that in order to exploit such a bug you'd need to have direct access to the system.2. Monolithic Kernel
FreeBSD runs device drivers, filesystems, and networking stacks in kernel space. A bug in any driver is a bug with full ring-0 privilege. This means:
- A vulnerability in a rarely-used USB driver can compromise the entire system
- The kernel's attack surface is enormous
- Memory corruption in one subsystem can affect everything
This is of course a complete non-issue. Because once again: people who blindly rely on their equipment to keep them safe... are a security hazzard of their own making.3. No Mandatory Integrity/Label Model by Default
FreeBSD has MAC framework (Mandatory Access Control) and TrustedBSD hooks that can enforce label-based policies, but:
- It ships disabled by default
- Configuration is complex and rarely used in practice
- The labels system doesn't extend cleanly to the network stack
No sandboxing? I guess you never heard of Jails then. You also claim that this is a huge issue, but the irony is that you just acknowledged the fact that MAC exists?4. The
FreeBSD inherits the deeply flawedsetuid/setgidMechanismsetuidbit — a file-level flag that says "run this binary as its owner, not the caller." Problems:
- Any bug in a setuid binary is a privilege escalation vulnerability
- The attack surface has existed for 50 years and keeps producing CVEs (
sudo,pkexec, etc.)- There's no sandboxing of what a setuid binary can actually do
See, I have a problem with that. Right now it's either you can access these areas or you can't. More fine grained control also introduces more areas where things could go wrong.A proper fix requires fine-grained privilege delegation — no program should need to run as root just to bind a port or write a log. FreeBSD'scapsicum(4)framework is a good step here, but adoption is limited.
Once again with the "enforced" delusions. Enforcing stuff on people does not increase overall security. I guess you never worked in an office where management forced strong passwords on its users?5. Capsicum Exists But Isn't Ubiquitous
Capsicum is actually FreeBSD's best security innovation — a capability-based sandboxing model that restricts what an already-running process can do. It's elegant. The problem:
- Developers must opt in manually with
cap_enter()- Almost no third-party software uses it
- It's not enforced on system utilities by default
I take it we can expect your new contributions to the source tree within a few months from now?Summary Table