News for hackers. Stuff that matters.

rjmccall

Re:Dioxus Labs and "High-Level Rust" on Wednesday June 26, 2024 @01:35PM (#40802388)
This is an interesting article, but as a Swift language designer, I'd really appreciate it if people didn't randomly throw out wildly inaccurate information like "Basically everything in swift is an Arc<Mutex<T>>".
Re:Swift for TensorFlow Shuts Down on Friday February 12, 2021 @04:46PM (#26118925)
Swift frameworks that use ObjC system libraries will still use objc_msgSend.
Re:Pointer Authentication on Tuesday December 17, 2019 @02:47PM (#21817880)
> Does iOS currently use different signature sizes?

Code and data live in the same address space, and the address-space needs of the system are the main input to the basic signature width, so the basic signatures widths are currently the same, and the only difference is TBI.

You could imagine a system where code was always loaded into a restricted subset of the address space and so code pointers could use wider signatures.

> Can I write an application that uses the top bits of data pointers?

Apple's ABIs actually consider the top 8 bits of data pointers to be outside the addressable range on all its 64-bit targets, including x86_64. ARM64 TBI just means that you don't need to explicitly mask off those bits before doing loads and stores. But there are caveats:

- ARMv8.5 memory tagging uses bits 56-59, so you should probably stick to just the top four bits in case Apple ever uses memory tagging.

- IIRC the first ARM64 iOS release didn't enable TBI, so if your deployment target goes really far back, you do still need to mask.

- The ABI for pointers expects those bits to be clear on normal ABI boundaries. This means you need to mask before handing pointers off to other code; on the upside, however, you don't need to worry about those bits being set when you receive a pointer.

Re:Pointer Authentication on Sunday December 15, 2019 @09:13PM (#21800347)
Right. Pointer authentication depends on it not being easy to forge a signature given the desired pointer. Given that there's a secret key included in the signature, the requirements on the hash function aren't really very strong. Signatures just need to not leak information about the key that could be used to predict other signatures.
Re:Pointer Authentication on Sunday December 15, 2019 @08:46PM (#21800241)
They can be compatible. Memory tagging does use the TBI bits. Pointer authentication uses an arbitrary number of bits, and the kernel configures the width and whether the TBI bits are preserved. So you can use both, it just costs you 8 bits of signature.

Moreover, this can be configured independently for code and data pointers. iOS turns off TBI on code pointers to get 8 more bits of signature. That's not a problem for memory tagging because memory tagging isn't particularly useful for code pointers anyway.