Readit News logoReadit News
hansendc commented on Linux Internals: How /proc/self/mem writes to unwritable memory (2021)   offlinemark.com/an-obscur... · Posted by u/medbar
hansendc · 5 days ago
"On x86-64, there are two CPU settings which control the kernel’s ability to access memory."

There are a couple more than two, even in 2021.

Memory Protection Keys come to mind, as do the NPT/EPT tables when virtualization is in play. SEV and SGX also have their own ways of preventing the kernel from writing to memory. The CPU also has range registers that protect certain special physical address ranges, like the TDX module's range. You can't write there either.

That's all that comes to mind at the moment. It's definitely a fun question!

hansendc commented on An interactive intro to quadtrees   growingswe.com/blog/quadt... · Posted by u/evakhoury
hansendc · 14 days ago
Here's an implementation that one of the OpenStreetmap applications uses:

https://josm.openstreetmap.de/browser/josm/trunk/src/org/ope...

It used to use a linear list of points, but it was VERY slow to draw, so I hacked this in to the code base a few years ago.

hansendc commented on Downfall Attacks   downfall.page/... · Posted by u/WalterSobchak
kzrdude · 3 years ago
See this LWN story: https://lwn.net/Articles/940783/

on Linux, any cpus that don't have updated microcode will have AVX completely disabled as a mitigation for this issue. That's rather harsh if you ask me and would be very noticeable. Now I'm interested in finding out if I can get updated microcode..

hansendc · 3 years ago
The AVX disable is only when you use "gather_data_sampling=force". The default is to leave AVX alone and proclaim the system to be vulnerable.

From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... :

> Specifying "gather_data_sampling=force" will use the microcode mitigation when > available or disable AVX on affected systems where the microcode hasn't been > updated to include the mitigation.

Disclaimer: I work on Linux at Intel. I probably wrote or tweaked the documentation and changelogs that are confusing folks.

hansendc commented on Is RAM wiped before use in another LXC container?   security.stackexchange.co... · Posted by u/Aachen
hansendc · 3 years ago
Uh... Did I miss the patches that add a pre-zeroed page pool to Linux? Wouldn't be the first time I missed something like that getting added, but 6.3-rc5 definitely zeroes _some_ pages at allocation time, and I don't see any indiciation of it consulting a prezeroed page pool: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
hansendc commented on OpenBSD may soon gain further memory protections: immutable userland mappings   marc.info/?l=openbsd-tech... · Posted by u/fcambus
brynet · 4 years ago
There was some work done on XOM (eXecute-only-memory) for arm64, but on at least x86 there isn't a separate page table bit for just read permissions, so there's no way[0][1] to express R^X, PROT_EXEC without PROT_READ is not possible.

Amusingly the 80286 supported execute-only segments, but this was dropped from 32-bit x86.

[0] It is possible on Intel in VM guests using EPT (Extended Page Tables), mlarkin@ experimented with protecting the host kernel in a special VM, called "Underjack". AMD SVM supports nothing like this.

[1] The custom AMD APU SoC in Sony's PS5 console supports "xotext" via NDA'd extensions, but there's no public documentation. (If _anyone_ knows details, pls share)

... btw, PROT_WRITE-only mappings are also impossible on x86 as well, so PROT_WRITE implicitly means PROT_READ. Not that I'm aware of any valid reason anyone might want this.

hansendc · 4 years ago
> there's no way[0][1] to express R^X, PROT_EXEC without PROT_READ is not possible.

I'll also add a [2]:

[2] There's no way to do it in the page tables. But, if you have Protection Keys for Userspace (PKU), you can get it ... kinda. You can have a PROT_READ|PROT_EXEC mapping, assign it a pkey, then set PKEY_DISABLE_ACCESS in the PKRU register for that key. In fact, if you have a PKU CPU and you do an unadorned mmap(PROT_EXEC), the kernel will allocate you a pkey and do this under the covers FOR you. Anyone who can execute WRPKRU can easily undo this protection, but it's better than nothing.

hansendc commented on OpenBSD may soon gain further memory protections: immutable userland mappings   marc.info/?l=openbsd-tech... · Posted by u/fcambus
kyledrake · 4 years ago
This security tech usually ends up in other platforms too, strongly recommend donating to their work: https://www.openbsdfoundation.org/donations.html
hansendc · 4 years ago
There honestly isn't that much "tech" to speak of here. We were literally talking about "immutable" mappings last week in Linux land: https://lore.kernel.org/all/b4f0dca5-1d15-67f7-4600-9a0a91e9...

That said, this would be great to see in OpenBSD (or any other OS).

hansendc commented on Orcas are breaking rudders off boats in Europe   smithsonianmag.com/smart-... · Posted by u/pseudolus
numtel · 4 years ago
Exactly, I don't believe one bit that they're "attracted to the pressure differential of the prop." I've swam in the ocean and boats are extremely noisy and annoying underwater. The Orcas fully understand that the boats are linked to the changes in the ocean.

To the downvote: I'm sure you've heard a drone buzzing above your head and getting nervous. A boat propeller does the same thing.

hansendc · 4 years ago
There's at least one extremely well documented example of a killer whale that played extensively with boats: https://en.wikipedia.org/wiki/Luna_(orca)

Granted, this was a lonely little fellow. But, he knew perfectly well what he was doing and repeatedly approached boats, despite the noise. He died after colliding with a tugboat prop.

hansendc commented on Orcas are breaking rudders off boats in Europe   smithsonianmag.com/smart-... · Posted by u/pseudolus
simonh · 4 years ago
Then again if an Orca swallowed a human in the water, there's would be much left in the way of evidence.
hansendc · 4 years ago
They actually leave lots of evidence. A transient eating a seal is messy business and there are lots of seal bits and chunks left over. Eva Saulitis describes the aftermath in several cases in her book (https://www.penguinrandomhouse.com/books/219235/into-great-s...). IIRC, fishing the evidence out of the water is one of the primary ways they study killer whale diets.
hansendc commented on Intel Microcode Decryptor   github.com/chip-red-pill/... · Posted by u/bfoks
fulafel · 4 years ago
If they are sane, Intel didn't rely on this staying secret in their threat model.
hansendc · 4 years ago
From: https://arstechnica.com/gadgets/2020/10/in-a-first-researche...

"In a statement, Intel officials wrote: ... we do not rely on obfuscation of information behind red unlock as a security measure."

(BTW, I work on Linux at Intel, I'm not posting this in any official capacity)

hansendc commented on Pointer Tagging for x86 Systems   lwn.net/SubscriberLink/88... · Posted by u/rwmj
saagarjha · 4 years ago
You're misunderstanding what this tag is used for: it's to accelerate virtual machines, rather than for memory safety.
hansendc · 4 years ago
Actually, its primary design goal is to make address sanitizers faster. Right now, all the code that touches a sanitizer-tagged address must be recompiled to understand how to place and remove the tag. These address-bit-ignore approaches can (ideally) allow you to just modify the memory allocator to hand out tagged addresses. Those addresses can then be passed around to code that doesn't even know it's handling a tagged address. It doesn't need to be modified. You don't need to recompile the world. Even when the sanitizer is on, you also don't need to be constantly stripping tags out of pointers before dereferencing them.

u/hansendc

KarmaCake day363January 7, 2018View Original