HNHacker News
TopNewBestAskShowJobs

musjleman

81 karma · joined June 28, 2021

https://twitter.com/JustasMasiulis | https://github.com/JustasMasiulis | https://secret.club/author/jm
submissionscomments
musjleman··on /dev/null: Anti-Cheat Kernel Driver (2020)
> No anticheat, kernel mode or not, has come even close to that. The situation has remained mostly unchanged for at least a decade now.

While the situation has mostly "unchanged" from the perspective of the end-user, the barrier of entry to start making cheats has been raised quite a bit.

I'd say making a commercially viable cheat (assuming you actually care about your customers not getting hit by every ban wave) isn't exactly a trivial matter nowadays.

> The proliferation of DMA cheats will make any time spent fighting software based cheating significantly less valuable.

The future you talk about is not yet here. External device based cheats are a miniscule part of the current cheating market.

musjleman··on /dev/null: Anti-Cheat Kernel Driver (2020)
> However, popular cheats aren’t malware, so they can’t do that

It is a rather popular practice to bundle things like discord token stealers amongst cheat developers to find people acting against them. While more uncommon, it isn't unheard of shipping a whole RAT alongside with the cheat.

> It’s a lost battle anyway, DMA cheats keep getting better every day. They will inevitably render clientside anticheat obsolete.

If an anti-cheat manages to stop all client-side cheating - it has already won. Requiring a hardware device to be shipped / being unable to start cheating right after a quick online purchase will deter most of the people that are considering purchasing cheats.

musjleman··on My students cheated... a lot
> But you should need a batchelor degree if if you want to be a high level specialist, programmer or architect

I'd like to ask, how are any of these specialties technically related to a bachelors degree?

One does not learn how to be a successful software architect in a semester or two of university. Neither does a bachelors degree make you anything more than a beginner in any specialized topic. While the definition of what's a "good" programmer is up for discussion, universities definitely do not produce them in any dependable capacity.

From my personal experience, at this point in time, major part of the students that complete a bachelors degree are in it just because programming is viewed as a well paying job and are about as worthless as a person that completed a 6 month bootcamp. The only difference being that the person with bootcamp experience might actually end up with an exact match of knowledge an employer wants, which hasn't had time to slowly evaporate over 4 years of "study".

Lastly to bring up another one of your points, I'd argue that learning from YouTube videos is not the same as going to a bootcamp. I do not view either highly, but I'd say that learning on your own deserves some level of commendation as it's the most crucial skill in a field that's constantly shifting and changing.

musjleman··on A database for 2022
> Do you want to know how popular systems are actually built, from the inside, or do you want carefully groomed triumphal announcements of new, perfectly-formed features?

IMO both this and "announcements of new, perfectly-formed features" are at the same level (if not lower, because a new feature is still something new). Both are essentially marketing with no technical content that's really worth your time. Except that it's now the third iteration of "we did an obviously questionable thing and replaced it with another questionable solution".

> it's better to relay what the team is actually doing, "warts" and all. We ranked on HN a few weeks ago with a post about user-mode WireGuard that was basically a litany of engineering mistakes, and it's one of the things I've most enjoyed writing.

I can agree with that, but I wouldn't bunch your writeup into the same group. That's some pretty decent technical content about the problems that were encountered. Meanwhile in these writeups what were the problems? "JSON file database too slow", "Hand-rolled software has to be maintained in-house"?

> Every serious product gets built the way Tailscale is describing. You start some components with the simplest thing that can reasonably work, and see how far you can take them. The JSON file Tailscale used to use was one of the most interesting and valuable things they wrote about.

Yet they keep changing it, migrating, writing tests for the new code and writing blog posts. The time all these things take even if the size of the new code is less than 100 lines is substantial.

musjleman··on A database for 2022
Sorry, I probably didn't phrase it very clearly. I don't think there is anything wrong with needing some external help for that, but the combination of their choices is IMO a bit bizarre:

  * SQLite which I mostly see as an embeddable database for applications, used on a server.
  * Single table with key-value pairs.
  * Having the tool for replication be a quite young project that's in active development.
musjleman··on A database for 2022
So to recap their timeline:

  * Instead of an actual database use a JSON file.
  * Write a blog post about how that didn't scale.
  * Instead of an actual database hand-roll something else.
  * Write a blog post about how that didn't scale.
  * Instead of a database with built-in replication which is tailor built for key-value storage use SQLite with a single table containing key-value pairs and some fresh glue to make it replicate.
I'm sorry, but what the fuck? Just writing the blog posts alone might have consumed more work-hours than what it would have taken to set a database up in the first place.

Are we supposed to expect another blog post somewhere around a year down the road titled "SQLite didn't scale" or "The new library for replication that was released a few months ago contained a bug that took our prod down"?

musjleman··on Buffet – An All-inclusive Buffer for C
> More like UAF ? Also, you can't. That was the idea. But it seems a bad one, according to you and user rom1v.

Well in your code if you bft_free OWN with outstanding REFs, nothing happens and the bft_free on last REF does nothing as well so it becomes just a leak.

> I'll try to make it so. This aspect is new to me. Anyway I hear it's quite hard, beyond that, to have a thread-safe lib, so I'll advertize it as non-TS.

IMO thread-safe should be the default with an easy opt-out by defining a single macro or something like that.

> Maybe that's the price for compacting str+str_view into a single type ?

Kind of. Without the VUE functionality I think you could refactor it into 2 states - SBO or REF.

  struct Buffet {
    union {
      struct {          // | u32 refcnt | char data[] |
        void*     ptr;  // --------------^ points to data. at offset -4 is refcount / start of alloc
        SIZE_TYPE size;
      } large;                                        // cap > sizeof(void*) + sizeof(SIZE_TYPE)
      char small[sizeof(void*) + sizeof(SIZE_TYPE)];  // cap <= sizeof(void*) + sizeof(SIZE_TYPE)
    } storage;
    SIZE_TYPE cap; // on big endian this value could also function as the null terminating byte
  }
musjleman··on Buffet – An All-inclusive Buffer for C
I'm going to be skeptical on this. Shoving refcounting + SBO + non owning views into a single type is not a smart decision.

Before going into why I think so, some general implementation things to look into:

  * Power of 2 exponent is not optimal. You will never be able to reallocate into the same stretch of memory that the arrays have previously occupied, as the sum of their sizes will always be smaller than the next one. C++ stdlibs have switched to values closer to 1.5.
  * Extra care should be taken when using memcpy. It's possible to copy overlapping buffers which is not allowed. using memmove instead is a simple solution. Also note the case when appending the Buffet structure itself to its array.
  * You can't yet count on all machines having ctlz/lzcnt instruction. There have been quite a few cases of this instruction crashing software because no fallback was provided lately.
  * If someone asks for bft_new(bft, 0x1000) you'll end up allocating 0x2000 bytes even though an exact size was specified. IMO scaling should be done only on appends.
  * If you force the structure alignment to 16 you might as well say that your type is 24 bytes in size, because you'll very likely be adding tons of padding to structures that include your buffer.
  * Seems like quite a few checks for malloc failure are missing + proper reporting for that.
Now why I think this is a terrible idea:

  * The model of your reference counting is a minefield and will 100% lead to problems when used in real world.
    - Free'ing OWN before all refs = leak (although this could be fixed by giving OWN refcount of 1 instead of 0)
    - Reference count is non-atomic = potential corruption
    - bft_view() has differing behaviors of output depending on what state it's in = hard to reproduce bugs.
  * You won't be fast just because you fit into 16 bytes.
    - Your code has branches on every single hot path that is virtually free on other implementations. There isn't really even anything you can optimize as all the branches essentially have equal weight, so you'll be having mispredictions by design.
    - You have multiple levels of indirection for data pointers so you'll be stalling the pipeline on cache misses and dependent loads as well as bad speculation.
  * SBO - OK, refcount - OK, but why add non-owning view into the equation? What's wrong with good old pointer+size or pointer start+pointer end for that. There already are enough footguns to worry about with 3 states.
← PreviousPage 2 of 2