HNHacker News
TopNewBestAskShowJobs

Arnavion

8,752 karma · joined July 3, 2014

https://www.arnavion.dev/
submissionscomments
Arnavion··on Parameterized types in C using the new tag compatibility rule
Neat similarity to Zig's approach to generic types. The generic type is defined as a type constructor, a function that returns a type. Every instantiation of that generic type is an invocation of that function. So the generic growable list type is `fn ArrayList(comptype T: type) type` and a function that takes two lists of i32 and returns a third is `fn foo(a: ArrayList(i32), b: ArrayList(i32)) ArrayList(i32)`
Arnavion··on Howdy – Windows Hello style facial authentication for Linux
Ask the Fedora maintainer? The README instructions only say Python 3. The OpenSUSE package's specfile only says Python 3, and to be sure I tried installing it and it did not pull in Python 2 packages.

Actually even the Fedora package's specfile only says Python 3, so I'm not sure why the README says that it still needs Python 2.

Edit: Okay, the explanation is in this commit message: https://github.com/boltgolt/howdy/commit/305e42fc79ef38f66c5... . The dep on Python 2 is from Fedora's PAM module package, not from howdy itself. On OpenSUSE the corresponding PAM module package depends on Python 3 already.

Arnavion··on Microsoft Edit
>About a month ago I heard Microsoft had their own Linux distribution to help Microsoft Windows users feel more at home. From memory, it was a rather simple GNOME setup. Nothing special.

You're confusing Microsoft's first-party Linux distro Azure Linux (nee CBL-Mariner) that is intended as a regular MS-supported OS for containers, VMs, servers, etc, with various Windows-like skins for Linux DEs that people have made for years.

Arnavion··on Microsoft Edit
Yeah, I also learned C++ via Turbo C++ in school in India in the early 2000s. Googling for "conio.h" shows Indians still talking about it in blogs and C/C++ forums as of 2024.
Arnavion··on New Linux udisks flaw lets attackers get root on major Linux distros
It is still the default but it's also trivial to change, so you don't have to "carry around actual root password" for any longer than it takes to create a dropin in /etc/sudoers.d/ with `Defaults !targetpw; %wheel ALL=(ALL) ALL`
Arnavion··on How to store Go pointers from assembly
CPUs guarantee what they guarantee, and if they guarantee that a certain instruction takes an operand-independent time then it does.

For example a RISC-V CPU implementing the Zkt extension is required to implement a whole bunch of logical and arithmetic integer operations with operand-independent timing. This includes the two "branchless move" instructions from the Zicond extension, czero.eqz and czero.nez.

Arnavion··on Game Hacking – Valve Anti-Cheat (VAC)
Cooperative games do still have the problem that you either need to have friends with the same interests and gaming schedule as you (the last one especially gets more and more difficult with age and real life responsibilities), or you play with randoms and then all the same annoyances with multiplayer games that you listed apply.
Arnavion··on MUMPS
PSA: POSIX shells (bash etc) do the same thing for && and ||. `true || false && false; echo $?` will be 1, not 0, because it evaluates `true || false -> true; true && false -> false`, not `false && false -> false; true || false -> true`. Don't assume like I once did that they have precedence like they have in C etc :D
Arnavion··on Top researchers leave Intel to build startup with 'the biggest, baddest CPU'
You want to optimize for specific chips because different chips have different capabilities that are not captured by just what extensions they support.

A simple example is that the CPU might support running two specific instructions better if they were adjacent than if they were separated by other instructions ( https://en.wikichip.org/wiki/macro-operation_fusion ). So the optimizer can try to put those instructions next to each other. LLVM has target features for this, like "lui-addi-fusion" for CPUs that will fuse a `lui; addi` sequence into a single immediate load.

A more complex example is keeping track of the CPU's internal state. The optimizer models the state of the CPU's functional units (integer, address generation, etc) so that it has an idea of which units will be in use at what time. If the optimizer has to allocate multiple instructions that will use some combination of those units, it can try to lay them out in an order that will minimize stalling on busy units while leaving other units unused.

That information also tells the optimizer about the latency of each instruction, so when it has a choice between multiple ways to compute the same operation it can choose the one that works better on this CPU.

See also: https://myhsu.xyz/llvm-sched-model-1/ https://myhsu.xyz/llvm-sched-model-1.5/

If you don't do this your code will still run on your CPU. It just won't necessarily be as optimal as it could be.

Arnavion··on How we reduced the impact of zombie clients
They definitely can't cope with the load at midnight, or at least couldn't back in 2022, and the fact that they mention midnight specifically in this post makes me assume they still can't. I say this because I had cert issuance fail for multiple days because of DB timeouts on their end from that: https://community.letsencrypt.org/t/post-to-new-order-url-fa...

Incidentally the fact that it took them 4 days to respond to that issue is why I'll be wary of getting 6-day certs for them. The only reason it wasn't a problem there was that it was a 30d cert and had plenty of time remaining, so I was in no rush. (Also ideally they'd have a better support channel than an open forum where an idiot "Community Leader" who doesn't know what he's talking about wastes your time, as happened in that thread.)

Arnavion··on Why Use Structured Errors in Rust Applications?
The better way is to do what I wrote in the first paragraph; ie each layer gets its own error type with a bespoke context type. The second paragraph is about the case where you want to use a single error type.
Arnavion··on Why Use Structured Errors in Rust Applications?
If you don't `impl From<UnderlyingError> for MyError` then you can force the code to do `.map_err(|err| MyError::new(err, context))?` instead of just `?`.

This doesn't work when the error is already MyError so you want to make sure that `context` contains everything you might want to know about the call stack. Eg if you're writing a web server application you might have an error at the network layer, the HTTP layer, the application layer or the DB layer. So your context can have four Option fields and each layer can populate its field with whatever context makes sense for it.

Arnavion··on The radix 2^51 trick (2017)
With C, it is _BitInt(256) if the compiler supports it. The upper limit of _BitInt is implementation-defined though, so 256 is not guaranteed to be supported. Eg clang on RV64 only supports upto 128, but does support 256 on x64_64. gcc seems to not support _BitInt on RV64 at all, but does support 256 on x86_64.

With C++ the existence of such "extended integer" types is implementation defined. clang at least supports the same _BitInt construct for C++ too. gcc seems to not support it.

So, for the 256 case on x86_64, both clang and gcc seem to only generate the simple adc ripple version: https://gcc.godbolt.org/z/nxoEda3q5 https://gcc.godbolt.org/z/bYf4bor3f

Arnavion··on Run a C# file directly using dotnet run app.cs
In 2010 I met a person from India who pronounced it "C pound", and they were as confused by my reaction as I was by their pronunciation. I guess somehow that pronunciation became popular enough that it acquired momentum and everyone in their circle (or maybe all of India?) assumed it was correct. The # key on the phone is called the "pound key" in India, which is where it would've started from, and I guess they never heard any foreigner Youtube video etc pronouncing it.

I don't know if they still pronounce it that way or not.

Arnavion··on Run a C# file directly using dotnet run app.cs
The builtin subcommand is unstable, but a long time ago a dev I knew at the time maintained an external subcommand for it. https://crates.io/crates/cargo-script

Although it's old and its dependencies are old, it doesn't have a dependency on cargo (it spawns cargo as a subprocess instead of via cargo API directly), so it might still work fine with latest toolchain. I haven't tried myself.

Arnavion··on Japan Post launches 'digital address' system
See also this CGP Grey video where he talks about post codes / zip codes in general and mentions Ireland's system. https://www.youtube.com/watch?v=1K5oDtVAYzk
Arnavion··on xAI to pay telegram $300M to integrate Grok into the chat app
Wonder if DDG can be convinced to append that automatically for !g queries...
Arnavion··on Why I no longer have an old-school cert on my HTTPS site
My webhost only supports RSA keys, so I use an RSA-4096 key just to annoy them into supporting EC keys.
Arnavion··on Why I no longer have an old-school cert on my HTTPS site
You can also use an NS record directly instead of CNAME'ing to a different domain.
Arnavion··on Why I no longer have an old-school cert on my HTTPS site
You can have multiple TXT records for the same domain identifier, and the ACME server will look through all of them to find the one that it expects. So for an order that requests SANs example.org and *.example.org, where the server asks for two authorizations to be completed for _acme-challenge.example.org, you can create both TXT records at the same time.

https://datatracker.ietf.org/doc/html/rfc8555#section-8.4

>2. Query for TXT *records* for the validation domain name

>3. Verify that the contents of *one of the TXT records* match the digest value

(Emphasis mine.)

Arnavion··on Why I no longer have an old-school cert on my HTTPS site
If you want to actually implement an ACME client from first principles, reading the RFC (plus related RFCs for JOSE etc) is probably easier than you think. I did exactly that when I made a client for myself.

I also wrote up a digested description of the issuance flow here: https://www.arnavion.dev/blog/2019-06-01-how-does-acme-v2-wo... It's not a replacement for reading the RFCs, but it presents the information in the sequence that you would follow for issuance, so think of it like an index to the RFC sections.

Arnavion··on The Future of Flatpak
It doesn't have to be gated by "the people who run the distro". I started packaging a few pieces of software for a distro I use because I wanted to use that software, and I don't "run" the distros in any capacity. Package maintainers aren't born that way, they become that way by volunteering, just like most everything in Linux.

If you don't have even one user willing to do that for the distro they use, you probably weren't going to have users on that distro anyway.

Arnavion··on Rocky Linux 10 Will Support RISC-V
Not necessarily. DT can be loaded separately from u-boot tree / kernel tree / dtoverlay file.
Arnavion··on Rocky Linux 10 Will Support RISC-V
Yes. See https://github.com/aarch64-laptops/edk2/tree/dtbloader-app?t... for example.
Arnavion··on Rocky Linux 10 Will Support RISC-V
publicmail was asking about ACPI vs DT, not UEFI. Using UEFI and ACPI/DT are orthogonal; DT-using devices can also boot from UEFI if the firmware provides it. See https://github.com/TravMurav/dtbloader for example.
Arnavion··on Rocky Linux 10 Will Support RISC-V
All RISC-V consumer boards running Linux also use DT. RISC-V is also working on getting ACPI but primarily for the sake of servers, just like with ARM where ACPI is primarily used for servers (ARM SBBR / ServerReady).

ARM Windows laptops only use ACPI because Windows has no interest in DTs, but under Linux these devices are still booted using DT. I don't know for sure, but the usual reason is that these ACPI implementations are hacked up by the manufacturer to be good enough to work with Windows, so supporting them on Linux requires more effort than just writing up the DT.

Arnavion··on Writing into Uninitialized Buffers in Rust
It's for the sake of providing a &mut [u8] to the initialized region for callers that cannot work with &mut [MaybeUninit<u8>] for whatever reason, eg if they wanted to use this with a std::io::Read impl. In particlar, Read impls are discouraged but not prohibited from reading the content of the [u8] given to them, so calling them with a [MaybeUninit<u8>] transmuted into a [u8] is not generally safe.
Arnavion··on Writing into Uninitialized Buffers in Rust
Unfortunately this hypothesis is also wrong. MAP_UNINITIALIZED can only be enabled in the kernel when there is no MMU, and in that case the page will already be in physical memory, so the very first pointer dereference will read the correct byte, not a fake zero because it's "uninitialized".
Arnavion··on Writing into Uninitialized Buffers in Rust
That's correct.
Arnavion··on Writing into Uninitialized Buffers in Rust
In that case the bug he described simply does not exist.
← PreviousPage 4 of 34Next →