HackerTrans
TopNewTrendsCommentsPastAskShowJobs

ashdnazg

no profile record

Submissions

Abusing the Harvard Architecture in Nand2Tetris Assembly

ashdnazg.github.io
3 points·by ashdnazg·8 bulan yang lalu·0 comments

comments

ashdnazg
·25 hari yang lalu·discuss
I worked on a transpiler from Nand2tetris assembly to WebAssembly, and had some really annoying memory corruption bug that I just couldn't solve.

That is, until I checked the program I used for testing (which I didn't write), and found the following code:

  dealloc(this)
  return this->field
With the original allocator, this worked fine, since the deallocation didn't touch the memory.

My allocator, however, overwrote the field during the deallocation with bookkeeping stuff, which meant the returned value was not what the programmer intended and after a short while the program crashed.

Unlike TFA, I had the luxury of just fixing the test program.
ashdnazg
·28 hari yang lalu·discuss
That's no surprise, telling the AI what to do is basically the IKEA effect.

https://en.wikipedia.org/wiki/IKEA_effect
ashdnazg
·bulan lalu·discuss
Kind of depends on the definition of no one.

If the company puts an artificial proof of work demanding a rack of the latest data center GPUs, that should be illegal.

If the binary has the same hardware requirements that the company used when the service was up, I see it as totally fair.
ashdnazg
·bulan lalu·discuss
The key is communication. If the company says the binary has a certain min. requirement, then the vast majority of people will accept that.

Of course there'll be idiots, but I doubt you'll see a stronger backlash than to a company shutting down the servers without any solution, like they can do now.
ashdnazg
·bulan lalu·discuss
> But the server binary doesn't start unless you have 190GiB of RAM and 38 available CPUs.

As far as I understand that situation is accepted by the initiative. The requirement is not that it works on any specific hardware or software stack, just that it can theoretically work.

> a binary that can be used to create cheats against the next version of the product

Anti-cheat solutions aren't required to be released, and if there are bugs in the server, they might even be found and patched by the community.
ashdnazg
·2 bulan yang lalu·discuss
The real question is how many other things it's missing.

Reading the process in TFA, it's very much dependent on the comprehensiveness of the testing framework. And apparently, the tests never built a lobby in the bottom left corner...

Anything else it didn't try, is probably also not documented and not implemented.

With the growing use of AI in reverse engineering, we might need to shift our goals to more strongly verifiable ones, such as matching decompilation.
ashdnazg
·3 bulan yang lalu·discuss
Fluent means different things to different people (and in different languages!).

As I understand it, B2 means one has a solid, functional proficiency in the language. They conversate/listen/read/write in diverse situations, without needing to switch to a different language or to prepare in advance.

They're very likely, however, to make mistakes, say things in non-idiomatic ways etc. although this is expected to be minor enough to not affect the ability to understand them.

In order to get to C1 and above, one needs a deeper understanding of the language - phrases, idioms, connotations, registers, etc. and a broader set of situations they can handle, e.g., a philosophical discussion. An of course, errors are expected to be rarer.

So, literally speaking, B2 is rather fluent, since the language is "flowing" out of them and they're not stopping to think every other word (which is, as far as I understand, a common interpretation of flüssig in German).

But as "fluent" speakers should know, words come with expectations beyond the literal meaning :P
ashdnazg
·3 bulan yang lalu·discuss
I'm back to searching for numbers that are palindromes both in decimal and in binary. [0]

I had an insight the other day, that as I fix the n least (and most, it's a palindrome!) significant decimal digits, I also fix the remainder from division in 5^n. Let's call it R. Since I also fix by that point a bunch of least (and most) significant bits, I can subtract how much they contribute mod 5^n from R, to get the remainder from division in 5^n of the still unknown bit. The thing is, maybe it's not possible to get this specific remainder with the unknown bits, because they're too few.

So, I can prepare in advance a table of size 5^n (for one or more ns) which tells me how many bits from the middle of the palindrome I need, to get a remainder of <index mod 5^n>.

Then when I get to the aforementioned situation, all I need to do is to compare the number in the table to number of unknown bits. If the number in the table is bigger, I can prune the entire subtree.

From a little bit of testing, this seems to work, and it seems to complement my current lookup tables and not prune the same branches. It won't make a huge difference, but every little bit helps.

The important thing, though, is that I'm just happy there are still algorithmic improvements! For a long while I've been only doing engineering improvements such as more efficient tables and porting to CUDA, but since the problem is exponential, real breakthroughs have to come from a better algorithm, and I almost gave up on finding one.

[0] https://ashdnazg.github.io/articles/22/Finding-Really-Big-Pa...
ashdnazg
·3 bulan yang lalu·discuss
I did some manual golfing with nand2tetris assembly and developed similar hacks to the max() implementation, where one appropriates an arbitrary, conveniently placed, memory address.

After reading the article, though, I feel like I definitely need a superoptimiser, to see what could be improved :)
ashdnazg
·3 bulan yang lalu·discuss
I can also thoroughly recommend https://store.steampowered.com/app/684270/Silicon_Zeroes/ which uses smart design to remove having to deal with binary in the circuit design. This reduces complexity by a surprising amount.
ashdnazg
·4 bulan yang lalu·discuss
No idea if it's not already optimised, but x2 could also be x*x and not just abs_x * abs_x, shifting the dependencies earlier.
ashdnazg
·4 bulan yang lalu·discuss
If you're using mobile, there's an "English" button in the menu.

Note to website owner - it could be nice to have a permalink to the English version.
ashdnazg
·5 bulan yang lalu·discuss
> for this game you can throw the usual tools away...

> The reason is that Starflight was written in Forth

I recently reverse-engineered another game from the 80's, and had a similar issue because it was written with Turbo Pascal.

The different tools didn't like quirks such as data stored inline between the instructions or every library function having a different calling convention.

Turns out the simplest way to handle this was to write my own decompiler, since Turbo Pascal 3 didn't do any optimisations.
ashdnazg
·5 bulan yang lalu·discuss
In academia, seeing your research being published by someone else sucks, but the consolation prize is that you know you had the right instincts choosing what to research.
ashdnazg
·6 bulan yang lalu·discuss
https://ashdnazg.github.io

Mostly silly posts about silly projects.
ashdnazg
·7 bulan yang lalu·discuss
My wife did one of the years in Matlab. Some of the problems translate very nicely into vectors and matrices.
ashdnazg
·8 bulan yang lalu·discuss
Seems to be hugged to death: https://archive.is/UauYs
ashdnazg
·8 bulan yang lalu·discuss
The bare basics are working with a hex editor and understanding data types - ints, floats, null-terminated strings, length-prefixed strings etc.

I'd recommend taking a well documented binary file format (Doom WAD file?), go over the documentation, and see that you manage to see the individual values in the hex editor.

Now, after you have a feel for how things might look in hex, look at your own file. Start by saving an empty project from your program and identifying the header, maybe it's compressed?

If it's not, change a tiny thing in the program and save again, compare the files to see what changed. Or alternatively change the file a tiny bit and load it.

Write a parser and add things as you learn more. If the file isn't intentionally obfuscated, it should probably be just a matter of persevering until you can parse the entire file.
ashdnazg
·9 bulan yang lalu·discuss
First of all, really cool initiative!

It's interesting that a bunch of the funded products have been funded by a single person.

Do you know if it's the producers themselves? Worried rich people?
ashdnazg
·9 bulan yang lalu·discuss
Porting my binary & decimal palindromes[0] finding code[1] to CUDA, with which I had no experience before starting this project.

It's already working, and slightly faster than the CPU version, but that's far from an acceptable result. The occupancy (which is a term I first learned this week) is currently at a disappointing 50%, so there's a clear target for optimisation.

Once I'm satisfied with how the code runs on my modest GPU at home, the plan is to use some online GPU renting service to make it go brrrrrrrrrr and see how many new elements I can find in the series.

[0] https://oeis.org/A007632

[1] https://github.com/ashdnazg/palindromes