HNHacker News
TopNewBestAskShowJobs

hun3

304 karma · joined February 21, 2022

submissionscomments
hun3··on Let rand = main as usize (2022)
> I kind of wish that this pointer casting required unsafe, just because this code should send up red flags, and probably deserves a close look during code review.

How about a new lint instead?

hun3··on TPM GPIO fail: How bad OEM firmware ruins Intel TPM security
You could scramble/authenticate the signals though, if you don't mind the huuuuuuuge performance penalty.
hun3··on Ruby's Timeout is dangerous and Thread.raise is terrifying (2015)
C has this problem too: see signal-safety(7).

> * If a signal handler interrupts the execution of an unsafe function, and the handler terminates via a call to longjmp(3) or siglongjmp(3) and the program subsequently calls an unsafe function, then the behavior of the program is undefined.

Also note that pthread_cancel() provides a way to block asynchronous cancellations via pthread_setcancelstate().

hun3··on SSD death, tricky read-only filesystems, and systemd magic?
Right, you need at least some dm-linear device mapper device in between to ensure a device is RO I think. Also, ext4 has separate "noload" option that actually instructs it not to touch the disk (ofc relying solely on "ro,noload" to not mess with your broken FS is a bad idea)
hun3··on Making a Postgres query 1k times faster
This can be mitigated somewhat by not having ORs at top level.

Of course UNION [ALL] does often yield better performance, yes.

hun3··on Alan Kay on Donald Knuth
> node.js application with 100000 dependencies where an update from package version 34.2.4 to 34.2.5 breaks everything because the developers decided to change the order of parameters in one function just for fun.

aka "totally unknown environment" which you "need feedback about what works and what doesn’t"

hun3··on Why does Windows use backslash as path separator? (2019)
Relevant: https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html
hun3··on XZ backdoor: "It's RCE, not auth bypass, and gated/unreplayable."
Carelessness could arguably a part of operation: testing/probing how thoroughly the community scrutinizes communication from untrusted individuals.
hun3··on What part of Rust compilation is the bottleneck?
As a workaround, split into multiple crates.

Disclaimer: I concur that this is merely a workaround, not the real fix

hun3··on DBeaver – open-source database client
> First say which of my above statements you refer to.

Nothing in particular.

> Also, why should I not be here? You have any problem with it?

Not at all.

You might be reading too much into my comment, though.

hun3··on DBeaver – open-source database client
That makes sense.

Why are you here, though?

hun3··on DBeaver – open-source database client
Karma is unimportant, but downvotes fade away the comment. There is little point in making a comment that will disappear anyway, since no one will see it.
hun3··on DBeaver – open-source database client
Sort of like defence against possible downvoters.

If OP went along the "father, son, and donkey story," then the OP won't have posted it at all.

hun3··on Don't Invent XML Languages (2006)
Norway.

https://hitchdev.com/strictyaml/why/implicit-typing-removed/

hun3··on How user groups made software reuse a reality
https://github.com/sindresorhus/awesome might be a reasonable starting point for anyone looking for software curations.
hun3··on Modder re-creates Game Boy Advance games using the audio from crash sounds
You're generally right, but I wasn't talking about the length of signals.

I was talking about if long period of "high" can be distinguished from long period of "low"--DC offsets.

hun3··on Modder re-creates Game Boy Advance games using the audio from crash sounds
This is probably irrelevant. The audio is analog (requires DAC to decode into bitstream) and is transmitted with some fixed frequency (44.1kHz or 48kHz), without any particular synchronization.
hun3··on test, [, and [[ (2020)
> Noo-ot really except in a Turing-tarpit sort of way.

That means bash has applications (e.g., batch processing and file management) that JS can't be (easily) used for. And they never said bash is bad at them. That...proves my point?

hun3··on test, [, and [[ (2020)
> it’s also a fairly strong contender as a programming language in the paradigm of many pipelined imperative processes—probably because that paradigm remains largely unexplored.

The paradigm is called point-free programming[1], right? I don't know how "imperative" is relevant here--you can rewrite most of the coreutils in Haskell, for example.

[2]: https://en.m.wikipedia.org/wiki/Tacit_programming

hun3··on test, [, and [[ (2020)
You can replace bash with JS. Scripting is their common application domain. Can you replace JS with bash, though?

If the answer is "no," that means JS has applications (e.g., servers and web clients) that bash can't be used for. And they're saying JavaScript is bad at them. Bash is arguably worse, but it's usually not an option in the first place so you don't get to complain.

hun3··on Why doesn't Windows have an "expert mode"? (2003)
> drive-by exploit

It's worth noting that UAC is not a security boundary[1]. Sure, a safeguard mechanism, but not a security feature against stealth rootkits trying to escalate from non-privileged environment.

[1]: https://security.stackexchange.com/questions/189491/microsof...

hun3··on Rust without crates.io
Great work! For unobfuscated or lightly packed ones, I guess your approach could mostly work.

One question: how do you detect when a binary is intentionally made to statically look similar to one binary, while its behavior actually mimics another?

hun3··on Rust without crates.io
> There are products (Nexus Firewall) that can check dependencies for vulnerabilities

Products can only do best effort scanning for known patterns of vulnerabilites. Those are only added after someone (or something) discovers it and verifies that it's not a false alarm. In between the time gap, scanners are ineffective and anything in your infrastructure can run the malicious code and get hacked. (Google supply chain incidents on npm or pypi.)

In general, there is always a way to bypass it, since the language is turing complete and unsandboxed. Anything going beyond that is a lie, or simply impractical. Systems with latest software and antivirus get hacked all the time. Nothing can really stop them. Why?

- https://web.archive.org/web/20160424133617/http://www.pcworl...

- https://security.stackexchange.com/questions/201992/has-it-b...

- https://en.wikipedia.org/wiki/Rice%27s_theorem

> and either block them from entering the network or fail CI pipelines.

Also, relying solely on an endpoint security product for protection is dangerous since antiviruses themselves get hacked all the time. Sonatype for an example:

- https://nvd.nist.gov/vuln/search/results?form_type=Basic&res...

hun3··on Why the Human Brain Perceives Small Numbers Better
Maybe it could also explain why we decided on hexadecimal radix e.g., each digit has 2^4 possible values.
hun3··on i386 Assembly Language trick for storing data in .text
Nit, but specifically on this:

> call 1f > > 1: <next instruction>

It's worth noting that "call $+5" degrades performance if used improperly. Consider:

      call 1f
  1:
      pop %eax
See the problem? (Hint: it's branch prediction)

That's right! The CPU has its own idea of an approximate "call stack" (a.k.a. return stack buffer), which it uses to predict branch target for RETs.

Note that the POP doesn't count as a "return," so it usually does not pop from the return stack buffer at all. In this case, the CPU confidently mispredicts the branch when the next matching RET gets queued into the pipeline, sometimes severly degrading performance.

hun3··on i386 Assembly Language trick for storing data in .text
Reading the call return address is basically how you write position-independent code (relocatable without modifying the on-memory executable image).

On Linux there's a stub subroutine that does exactly that: __i686.get_pc_thunk.<reg>.

Here's the entire subroutine:

  __i686.get_pc_thunk.bx:
      MOV EBX, DWORD PTR [ESP]
      RET
Yup, that's all. If you compile with gcc -m32 -fPIC, you'll see a call to that thunk whenever a function accesses GOT or other relocatable symbols.
hun3··on Was Rust Worth It?
Yeah, blaiming the compiler for pointing out potential runtime bugs is just shooting the messenger.
hun3··on My personal C coding style as of late 2023
Better example:

  #define FLAG_63 (1ULL << 63)
  long long flags = FLAG_63;
In this case,

  if (flags & FLAG_63) pass();
will pass, but

  typedef int BOOL;
  BOOL set = flags & FLAG_63;
  if (set) pass();
won't pass, due to truncation.

Question: Would you argue that a datatype that holds the smallest (1-bit) datum should be as wide as the largest integer type just to handle such cases?

If so, that would be highly inefficient for storage purposes. Note that Win32 has 32-bit BOOL type, but internally NT uses 8-bit BOOLEAN type to store bools in structures.

hun3··on Recovering secret keys from devices using video footage of their power LED
It's a low-pass filter. It won't eliminate side channel transmissions in very low frequencies, though.
hun3··on Getting the ^D
The `c_cc` array is configurable via the stty command or the termios(3) API.

To override the character for "EOF," change ^D to something else in the following command and run it:

  stty eof ^D
← PreviousPage 4 of 5Next →