HNHacker News
TopNewBestAskShowJobs

prattmic

237 karma · joined February 3, 2012

At Google working on the Go runtime and compiler.
submissionscomments
prattmic··on Dropbox's Jan 1st 2027 terms of service
I wonder if they are actually going to start enforcing this. I’ve been receiving emails that my account is at ~200% capacity for a little over 13 years (just went through my email to double check). I’ve logged into my account a handful of times over the years, but certainly not every 12 months.
prattmic··on Size-Specialized Memory Allocation
I’m not sure if you were getting at this by mentioning the ABI specifically, but for Go the “faster size class computation” isn’t purely about the computation itself.

There are lots of cases in the allocator that are conditional on size class (tiny allocations have a bunch of special cases, as do large allocations). Pointer/no-pointer allocations also have lots of special cases.

In the specialized functions, these conditionals become constant and lots of code falls away. We don’t pay the cost for those comparisons anymore, plus since code size is smaller it is now more reasonable to inline callees a bit more aggressively.

Michael also put a lot of time into finding the right balance of code size. At first you want to specialize everything, but that is going to increase code size a lot and thus hurt icache performance. If I recall correctly, our initial version had a code size increase ~4x higher than what we ended up with in 1.27. The final version specializes far fewer size classes yet actually had better performance than the original version.

Regarding the ABI, we definitely see an improvement with static calls vs computing the size class in the runtime. If I recall correctly, it’s the indirect call to the specialized function through a lookup table that stalls the dynamic case.

prattmic··on Splitting a Git Commit
> “That moment when you realize that a tool simply fixes all the UI issues that you had and that you have been developing for the last 20 years was not exactly great." He had two options: despair or learn from the competition. He chose to learn from it.

https://lwn.net/Articles/1057561/ which goes on to explain that this was the motivation for git history.

prattmic··on Ruff v0.16.0 – Significant new updates – 413 default rules up from 59
-vettool allows using different analyzers built with the analysis framework: https://pkg.go.dev/cmd/go#:~:text=The%20%2Dvettool%3Dprog%20...
prattmic··on Feds Fine Durham Energy Efficiency Co $722M
“His specialty was alfalfa, and he made a good thing out of not growing any. The government paid him well for every bushel of alfalfa he did not grow. The more alfalfa he did not grow, the more money the government gave him, and he spent every penny he didn't earn on new land to increase the amount of alfalfa he did not produce. Major Major's father worked without rest at not growing alfalfa. On long winter evenings he remained indoors and did not mend harness, and he sprang out of bed at the crack of noon every day just to make certain that the chores would not be done. He invested in land wisely and soon was not growing more alfalfa than any other man in the county. Neighbours sought him out for advice on all subjects, for he had made much money and was therefore wise. “As ye sow, so shall ye reap,” he counselled one and all, and everyone said “Amen.”

-Joseph Heller, Catch-22

prattmic··on Go 1.26 Release Notes
We changed the way we track Go threads in syscalls/cgo calls, which allowed us to remove one atomic store and one atomic compare-and-swap from the cgo call path. https://go.dev/cl/646198 and https://go.dev/cl/708596 are the relevant changes.

(It's basically an easter egg, but if you look at the source of the release notes, you will see that most entries in the release notes have an HTML comment referencing the Go CL or issue that the entry refers to.)

prattmic··on Capital One to acquire Brex for $5.15B
How does this work when using a US credit card in the EU? I assume the merchant still pays the lower interchange fee, so are the banks just betting that customers won’t do a large proportion of spending abroad?
prattmic··on I program on the subway
I do get through lots of books this way!
prattmic··on I program on the subway
> 2. Cell service has, at the same time, become ubiquitous in subway tunnels.

Not in New York, unfortunately. All of the stations have cell service, and one tunnel (14th Street L train tunnel under the East River), but everywhere else has no service between stations. It’s an annoying limitation that most cities seem to have fixed by now.

prattmic··on iOS 18.2 Lets EU Users Delete App Store, Safari, Messages, Camera and Photos
I can’t quite tell if this is satire! You may be familiar with a small startup (https://en.m.wikipedia.org/wiki/Netflix) in the business of buying a million DVDs and continuously renting them out on demand to make something resembling a video rental store.
prattmic··on Hash Ordering and Hyrum's Law
In addition to the DoS aspect mentioned in a sibling comment, the primary reason you would do this is to avoid constraining the implementation. If you want to change the design to improve performance, for example, being forced to match the implicit ordering of the old implementation may be very difficult.

It certainly may be useful to define an specific ordering. Maps ordered by insertion time and maps ordered by key order are fairly common. But maps with these constraints probably won't be as fast as those with arbitrary ordering, so there is a trade-off decision to be made. A map constrained to the arbitrary ordering of the initial implementation is the worst of both worlds: difficult to make faster despite not having a particularly useful ordering.

As a concrete example, I am currently in the middle of rewriting Go's map implementation to use a more efficient design (https://go.dev/issue/54766). If Go hadn't randomized map iteration order this work would likely be impossible. It is unlikely we could completely change the design while keeping iteration order identical to the old implementation (assuming we want the new version to be faster at least).

prattmic··on Stashpad launches Google Docs alternative you can use without any login
It is just a TLD. https://get.new/
prattmic··on S.3819 – Shrinkflation Prevention Act of 2024
I think the closest analog to this is digital services getting worse rather than more expensive. For example, recently rather than increasing the price of Amazon Prime Video, the price has remained the same, but the product is worse (now has ads).

That said, I don’t think this bill would target something like that, as it clearly discusses the “size” and “amount” of a product.

prattmic··on Reddit Threatens to Remove Moderators from Subreddits Continuing Blackouts
Q1 earnings (https://s25.q4cdn.com/442043304/files/doc_financials/2023/q1...) says 383M daily active users and $1.3B in costs (including sales, administrative, etc), for ~$3.50/user/quarter or ~$14/user/year. So far above $2.50/user/year. Even just using cost of revenue is ~$4.50/user/year.
prattmic··on Linux /proc/pid/stat parsing bugs
See https://news.ycombinator.com/item?id=34097179. A comm is limited to 64 bytes, so I don't think it is possible to fit a long enough comm to match the full regexp.
prattmic··on Linux /proc/pid/stat parsing bugs
Neat! Your parser [1] almost has a similar issue because a comm could contain parenthesis, e.g., `foo) R 123 456`. But since a comm is limited to 64 bytes, I don't think it is possible to fit a fully matching string inside of the comm before the closing parent after the comm, which would thus make your regexp fail to match.

[1] https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/...

prattmic··on Jetbrains Space
Gerrit is pretty strongly opinionated, but it is not mailing-list based. Review notifications are sent via email, but otherwise everything needs to be done via the web UI (or other tool using the API).
prattmic··on Jetbrains Space
I’m not familiar with Upsource, but what you describe sounds somewhat like the Gerrit review process. Each commit is reviewed individually, but sending multiple dependent commits for review is supported as well. It is technically possible for a coworker to build on top of your unsubmitted changes (by checking out your commits and adding more on top). However this process gets somewhat painful if the coworker updates their commits, which would require you to do a convoluted rebase.
prattmic··on Disney's mosquito control program
NYC still does nighttime spraying: https://www1.nyc.gov/site/doh/health/health-topics/west-nile...
prattmic··on AWS Lambda Cold Start Times
Google Cloud Run also scales to zero by default, but you can configure the minimum number of instances: https://cloud.google.com/run/docs/configuring/min-instances
prattmic··on Go 1.17 Release Notes
The benefits come primarily from avoiding extra work spilling arguments to/from the stack on function calls. If you are making lots and lots of function calls, particularly to small functions that can't be inlined, there could certainly be much bigger improvements.
prattmic··on Intuit sabotages the Child Tax Credit
ReadyReturn was a pilot program in California that provided pre-filled tax forms. Unfortunately, lobbying by Intuit helped kill it.

https://en.wikipedia.org/wiki/ReadyReturn

prattmic··on I Hacked Google App Engine: Anatomy of a Java Bytecode Exploit
Even the first-generation runtimes no longer use this mechanism. Note https://cloud.google.com/appengine/docs/standard/java/migrat...: "All standard Java classes are now available, and there is no class allowlist."
prattmic··on SSH and User-Mode IP WireGuard
It's here: https://github.com/tailscale/depaware

See also: https://twitter.com/bradfitz/status/1303776199907311617?s=19

prattmic··on SSH and User-Mode IP WireGuard
This is awesome! In the post you mention "For a couple hundred lines of code (not counting the entire user-mode Linux you’ll be pulling in from gVisor, HEY! Dependencies! What are you gonna do!) ..."

I'll note that while all of gVisor's user-mode Linux is in the same Go module, we've actually gone to decent lengths to keep the network stack logically separate from the rest of the user-mode Linux code.

So while go.sum might look a bit frightening, Brad's depaware shows that the extra code you pull in to binaries by using netstack is actually quite minimal: https://github.com/tailscale/tailscale/commit/5aa5db89d6a9a6....

prattmic··on ARM64 Popcount in Golang and Assembler
While CPUID itself is far from elegant, I don't think ARM is fundamentally different. e.g., the ID_AA64ISAR1_EL1 register (ARM wins no naming awards here) indicates the presence of certain instructions.

https://developer.arm.com/docs/ddi0595/h/aarch64-system-regi...

prattmic··on Ampere’s Product List: 80 Cores, up to 3.3 GHz at 250 W; 128 Core in Q4
ARM has a weakly-ordered memory model, while x86 is much more strongly-ordered. See https://en.wikipedia.org/wiki/Memory_ordering#Runtime_memory....

So e.g., on x86 if you store to A then store to B, then if another core sees the store to B it is guaranteed to see the store to A as well. This guarantee does not exist on ARM.

prattmic··on Binary Authorization for Borg
I work on gVisor, I can answer this!

gVisor is not a rewritten version of an internal tool. The code you see really does run in production for App Engine and Cloud Run. While there are some internal modifications to better integrate with internal infrastructure, the vast majority of the code is identical to open source, critically including all of the system call handling, filesystem, and memory management code.

While browsing through our issues will show that we still have plenty to work on, the vast majority of applications work well inside gVisor.

prattmic··on GKE Sandbox: Independent operating system kernel to each container
For sure, implementing Linux is no easy task, and there is no magic bullet. For compatibility testing, we have extensive system call unit tests [1] and also run many open source test suites. Language runtime tests (e.g., Python, Go, etc) are particularly useful. We also perform continuous fuzzing with Syzkaller [2].

> how do you implement features that ostensibly require calls to the OS anyways?

gVisor's kernel is a user-space program, so it can and does make system calls to the host OS. Some examples:

* An application blocks trying to read(2) from a pipe. gVisor ultimately implements blocking by waiting on a Go channel. The Go runtime will ultimately implement this with a futex(2) call to the host OS. * An application reads from a file that is ultimately backed by a file on the host (provided by the Gofer [3]). This will result in a pread(2) system call to the host.

The purpose here isn't to avoid the host completely (that's not possible), but to limit exposure to the host. gVisor can implement all the parts of Linux it does on a much smaller subset of host system calls. Anything we don't use is blocked by a second-level seccomp sandbox around the kernel. e.g., the kernel cannot make obscure system calls, or even open files or create sockets on the host (those operations are controlled by an external agent).

[1] https://github.com/google/gvisor/tree/master/test/syscalls/l...

[2] https://github.com/google/syzkaller

[3] https://gvisor.dev/docs/architecture_guide/overview/

prattmic··on GKE Sandbox: Independent operating system kernel to each container
> From what I understand, basically a user-space program that wraps your container and intercepts all system calls. You can then allow/deny/re-wire them (based on a config).

gVisor actually intercepts and implements the system calls in the user-space kernel. Two specific goals of gVisor are that (1) system calls are never simply allowed and passed through to the host kernel, and (2) you don't need to write a policy configuration for your application; just put your application inside gVisor and go. These are significant differences over simply using something like seccomp on its own (what the architecture guide calls "Rule-based execution").

Some of this is covered in our security model: https://gvisor.dev/docs/architecture_guide/security/#princip...

Page 1 of 2Next →