User avatar
Irenes (many) @ireneista@irenes.space
6d
... but the headers are way more legible than we're used to them being on Linux. it was nice and short, and relatively limited in its use of preprocessor magic that would have required a lot of supplemental reading to understand.

see, if we're going to bind to this from Rust, we can't use the C preprocessor, because it goes to a different programming language... we have to just know what ioctl numbers we want...
3
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
but we discovered something really cool about how those numbers are allocated within NetBSD's cod

we're used to it being, like, a long list of numbers that are allocated in some central place, because they need to be unique across every device driver - that is, across the entire kernel

so we were surprised to not see such a list anywhere
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
but! that's because they aren't allocated that way. instead, there's a family of macros that combine a few separate fields into a single integer. there's an ASCII character that's unique to the API, and there's a serial number that's not actually unique at all except in combination with all the other fields, and then there's a field that describes the length of the parameter data that needs to be copied into our out of the kernel

and it's only this 4-tuple (direction, length, mnemonic letter, serial) that's unique
2
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
but since that all fits in 32 bits, it's just a number from the perspective of a C userspace program that's trusting the preprocessor to compute it

annoyingly, of course, we'll need to implement that logic ourselves, but it shouldn't be a big deal and the ABI is meant to be compatible and all that
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
sigh unrelatedly, we really need to improve the driver for our trackpad. right now it's detected as a generic ps2 mouse, because the Synaptics-specific code doesn't handle this particular version, and that means we aren't able to configure it in ways that would stop it from getting stray inputs

and those stray inputs are responsible for a lot of typos, including in this thread. kind of frustrating.
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
somebody a few years ago already wrote to the mailing list with all the details we'd need to get started on that effort, but it's, mm, ... one thing at a time. we'll get our status bar to its first feature plateau before we start doing anything in the kernel...
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
incidentally, also, the laptop's wifi driver becomes inoperable after an hour or so of uptime. that's probably the result of us using our own kernel and module builds instead of an official release, though it could also be that our custom boot ramdisk is somehow only loading part of the runtime wifi firmware and not all of it as we intend

the practical implication is that when we're coding from bed, we're doing so without internet
2
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
fortunately over the last year or two we've been re-cultivating the habits we had in the 90s as kids (when we often had to go days at a time without internet, due to the logistics of shared phone lines and the necessity of operating in secrecy to avoid our abuser's attention), and those habits have meant we mostly have everything we need offline anyhow
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
for example, any time we need to read someone else's code from a git repo, we don't even try the github search, we clone the whole repo locally and grep it. we have a directory where we keep repos we're just using as reference material in this way. being proactive about this means we usually already have the thing we need...
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
anyway, hmmmm

so we need an FFI wrapper for
ioctl(), and in the spirit of keeping our dependency tree minimal, we're trying to see if we already have one somewhere. we're using the Rust library async-io which is usually used as part of smol (we're taking it a-la-carte, out of that same motivation)... we had previously dug into that and found that it manages its NetBSD compatibility by deferring to the library polling, which uses OS-specific APIs; on NetBSD it uses kqueue(2). and kqueue is an ioctl-based API, so it must have a way of calling ioctl...
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
we already have all this code on the laptop for ease of reference, per the practice we mentioned :)

so, hm hmm
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
ah! so it uses a library we hadn't heard of called rustix for its low-level FFI wrappers. nice. we usually make a point to at least glance at the name of every library in our dependency tree as it builds, but apparently we just hadn't noticed that one yet.

the limitation of our strategy of passing excessive data in front of our eyes to give our brain a chance to latch onto it is that it's stochastic and gradual, we have to actually do the full build a bunch of times before we notice everything
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
(but it scales in a way that the deterministic approach of reading every word every time can't, so we stand by it)
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
so, sigh, let's see... time to do the provenance dance and find the official repo for rustix, not any mirrors or impersonators...

duckduckgo
site:crates.io rustix because hope springs eternal, but it doesn't appear in the list of results, as per usual

click through on a top entry, use the site's own search feature, and it comes up. in general we disapprove of the hegemonic behavior of crates.io, but this one isn't really their fault, as far as we're aware, it's DDG and Bing who are asleep on the job
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
click into the crate's page, scroll to the bottom, get lost in a mess of unrelated graphs, scroll up until we find the repo link, right-click to copy it

go to the terminal and git clone it

yay. provenance.
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
cross-check: DDG rustix library, the docs.rs page comes up. we have slightly less trust in provenance here because their priority is being comprehensive, but any single mechanism is subvertible so it's important to have multiple sources.

click through their menu-driven navigation (very frustrating and slow, requires lots of visual parsing, no way to use muscle memory, though we understand what they must have been thinking in designing it this way), find the repo link, right-click, paste to terminal, it's the same one. good. done.
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
notice that at no point did we click through to github. that's not a principled stance; loading github puts us in two to three minutes of pain because the company treats our laptop's computational resources as assets to use however they want, and this is an old machine (because old hardware is more broadly compatible and we want it that way)
2
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
this provenance dance is one of those things that's probably unnecessary today, but we like to be in the habit because someday it will be needed, and to do security right, you have to make it boring. it has to be a set of procedures you do the same way every time no matter what, that you've done so many times you don't even have to think about it.

your brain is not designed for constant hypervigilance. not even
our brain is designed for that, and we have complex PTSD and autistic hyperfocus and clinical paranoia all working in our "favor".

it's important to do your threat modeling in advance, and turn it into katas you can practice. don't do it in-the-moment except as a last resort if you're caught by surprise.
1
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
we adopted key-based ssh authentication with passphrases and an agent keeping then in memory in, like, 2000, which was like fifteen years before most people we ran into seem to have bothered.

that meant that when hardware tokens became an easy thing to obtain, it was easy for us to adopt them because we already had strategies for key deployment. so we wound up using
those maybe five years before everyone else got in the habit, too
2
0
0
0
User avatar
Irenes (many) @ireneista@irenes.space
6d
the infinite spam generator makes impersonation attacks much lower-cost than they have historically been, in terms of human time on the attacker's end. so we think it makes sense, in the spirit of trying to stay ahead of the curve, to figure out our long-term strategy for dealing with them and get in the habit now, you know?
2
0
0
0
User avatar
walnut 🌱 @walnut@thesoftestpaws.net
6d
@ireneista
oh, very tangentially related I was thinking about hardware keys the other day and thought an unexpected benefit may easier access for close or loved ones to accounts after death, should that be necessary for whatever reason. provided they know how to use it
1
0
3
0

User avatar
Irenes (many) @ireneista@irenes.space
6d
@walnut yes, agreed for sure!
0
0
2
0