IRC channel logs

2021-10-02.log

back to list of logs

<Hagfish> https://security.googleblog.com/2021/10/introducing-secure-open-source-pilot.html
<Hagfish>" The program is initially focused on rewarding the following work: Software supply chain security improvements including hardening CI/CD pipelines and distribution infrastructure."
<Hagfish>i don't know if google fully appreciates the significance of bootstrapping work when it comes to SSCS, but they're spending $1m just to start, so there may be people/projects here that should look into this
<Hagfish>actually they are offering grants of between $500 and $10,000, and i think this tier may be the most relevant:
<Hagfish>"$5,000-$10,000 for moderately complex improvements that offer compelling security benefits."
<xentrac>SSCS?
<xentrac>oh
<xentrac>sorry
<xentrac>Software supply chain security
<xentrac>I think there are people at Google that do fully appreciate it
<Hagfish>i think i've seen an acronym like that used before, but yeah, sorry, i sort of relied on it being reverse engineered from the context :)
<xentrac>they developed their internal Titan CPU specifically to solve the bootstrapping problem we're working on
<Hagfish>the question is, are those people at Google the ones that decide how the rewards are distributed?
<Hagfish>oh, nice
<oriansj>stikonas: merged thank you
<xentrac>and they've also done most of the work on its OpenTitan successor
<Hagfish>it's sort of hard to quantify the security benefit of bootstrapping
<xentrac>I think they have spent significantly more than $1m developing OpenTitan
<stikonas>oriansj: thanks!
<xentrac>(which is a RISC-V implementation)
<Hagfish>if it did uncover some 40 year old self-propagating backdoor, then the value in finding and fixing that is almost limitless
<xentrac>yeah, but it's much more likely to prevent the introduction of a new one
<Hagfish>right, that's a better way to frame it
<stikonas>oriansj: so now with my local M2-Planet port I can build up to M1-0 and M1-0 seems to be working fine. hex2-1 is somehow not working properly (runs but outputs somewhat corrupted files)
<oriansj>stikonas: that would be a broken chmod function
<stikonas>oh?
<stikonas>why would chmod cause that?
<stikonas>I mean hex output is not what it is
<oriansj>oh, then that is different than the wrong permission bits issue I've seen with hex2 in testing
<stikonas>probably something in libc still
<stikonas>blood-elf and M1 probably exercise quite a bit of M2's functionality
<oriansj>well M2 just converts C to M1 without changing the things that would be valid in M1. (Like the inline assembly and immediates (unless the architecture requires it))
<stikonas>hmm, hex2-1 does seem to work on at least some files (e.g. catm_riscv64.hex1)
<stikonas>so it's not completely broken...
<stikonas>it's probably something in ELF header that upsets it
<stikonas>ok, it's the . notation that triggers some corruption
<stikonas>might be something to do with unsigned overflows...
<stikonas>since Development/hex2_riscv64.hex2 file works just fine (and it does not use . notation) but ".11111111 12345678" already fails
<stikonas>oriansj: I think I know what's going on
<stikonas>hex2.word in '.' processing uses constant 0xFF000000
<stikonas>which is probably outside what we correctly handle with LUI/ADDI
<stikonas>oriansj: yes, that's what was causing it
<stikonas>would you be willing to accept patch to workaround this (we should probably fix large numbers eventually)
<stikonas>i.e. replace 0xFF000000 with (0xFF << 24)
<stikonas>with this change I can build up to at least full kaem
<stikonas>but most likely M2-Planet will self-host too
<stikonas>yes, I have full M2-Planet binary now
<stikonas>oriansj: https://github.com/oriansj/mescc-tools/pull/24
<stikonas>and initial port of M2-Planet https://github.com/oriansj/M2-Planet/pull/22
<stikonas>argh, somewhat annoyingly self-hosted M2-Planet is broken, I guess same issue of large immediates
<oriansj>stikonas: let me take a look
<stikonas>oriansj: to M2-Planet?
<stikonas>I think we need to implement large numbers manually... Binutils is doing something like that
<stikonas> https://github.com/bminor/binutils-gdb/blob/master/gas/config/tc-riscv.c#L1573
<stikonas>although, large numbers break a bit earlier in M2-Planet toolchain
<stikonas>I think it's working up to 2^31 - 1 - 2^11
<oriansj>test1000 also tends to break real easily by design
<stikonas>yeah, I haven't implemented test1000 yet
<stikonas>although, it's mostly copy paste from mescc-tools-full.kaem file
<oriansj>yet your code changes in cc_core.c do change what test1000 expects: https://paste.debian.net/1214081/
<stikonas>oh, let me fix it then
<oriansj>easy mistake to make. Happens all the time
<stikonas>strange, I'm getting different hashes (compared to pastebin) in proof.answer
<oriansj>well that means we are doing something different
<stikonas>hmm, I have newest M2libc there
<stikonas>but that's only riscv changes
<stikonas>shouldn't affect amd64
<stikonas>I get 92c8b0a0e142e2a825bd10cb7d7e2d581ca2ba608f4e21009c1d9837728205d2 test/test1000/proof
<oriansj>less me check to see what M2libc I am on
<stikonas>I've also added --little-endian to that blood-elf command in test1000
<oriansj>which shouldn't change anything
<oriansj>M2libc is at b58dbe11e6111489aca54c57a8bd1087a9d5db90
<stikonas>yes, it's the sam then
<oriansj>I am on M2-Planet commit f5f5f8942de9f89b2eed6290a2442d38cb2e1397
<oriansj>and I am doing an x86 and armv7l build test
<oriansj>(which all architectures should produce identicial results)
<stikonas>hmm, yes, I'm on that commit too
<stikonas>and no local changes?
<oriansj>yet different build results when running RISC-V?
<oriansj>interesting
<oriansj>I guess we need to find the delta
<stikonas>well, that 92c8b0a0e142e2a825bd10cb7d7e2d581ca2ba608f4e21009c1d9837728205d2 hash is amd64 test
<stikonas>oh, actually it's in your file too
<stikonas>in - part of the diff rather than +
<stikonas>I think I was looking at the wrong line
<stikonas>oriansj: which one is the new and which one is the old?
<oriansj>the old is the minus and the plus is the new
<stikonas>hmm, so I was getting the old hash...
<stikonas>strange
<stikonas>oh, I see, my mistake
<stikonas>I was looking at the wrong file
<stikonas>ok, I'll then update my PR
<oriansj>you can also git apply the paste and git will understand
<stikonas>yeah, I know
<stikonas>well, I just wanted to check that it indeed matches, but it does
<stikonas>ok, updated
<oriansj>and I'll have the updated blood-elf flags in place in a couple minutes
<stikonas>and then I guess stage0-posix needs to pull-in new M2-Planet...
<stikonas>(or maybe I should first try to fix large numbers)
<stikonas>although, that should be a smaller change and only affect risc-v
<oriansj>well we might as well get risc-v fully into M2-Planet
<oriansj>and then I'll update stage0-posix x86, AMD64 and AArch64 ports to use the new blood-elf flag
<oriansj>and the blood-elf flag update for M2-Planet is now up
<oriansj>stikonas: you'll want to add this to makefile-tests https://paste.debian.net/1214086/
<stikonas[m]>Ok
<oriansj>and I assume you can make test/test1000/hello-riscv64.sh to mirror what is in AArch64's test/test1000/hello-aarch64.sh
<oriansj>which will make risc-v output part of the test suite
<stikonas[m]>Well, once self-hosting works
<stikonas[m]>right now it is broken
<oriansj>actually that is fine as cross-hosting checks, even for broken output matters
<oriansj>as all architectures given the same input (and flags) must always produce the exact same output
<stikonas[m]>Well, I guess test will fail for now but rightfully so
<oriansj>well how does this sound as a reasonable compromise: add the tests that currently pass on RISC-V and I'll verify that other architectures confirm matching results
<oriansj>also if RISC-V is producing a correct proof result for test1000, it means it self-hosted just fine
<stikonas>ok, let me pull in blood-elf changes and then I cna add tests
<oriansj>because if you see: out=test/test1000/proof: OK when running test1000 for RISC-V you are done successfully porting M2-Planet to RISC-V
<oriansj>and if it is the wrong checksum, we then compare the proof files to hunt down the problem.
<stikonas>ok, test0020 now fails...
<stikonas>it's actually segfault
<oriansj>good
<stikonas>hmm, might be hex2 issue
<stikonas>test0020.M1 and test0020.hex2 look fine
<oriansj>do you get 626ca275bbb320e6b5ebde0bff50d10bd1dc78ee8163d37f71fb77d10099ca7c test/test0020/tmp-riscv64/struct.M1 ?
<oriansj>and 8e4c805f0aa40c8904f11811e827a5a4198165148b96f195d3f6acd027039202 test/results/test0020-riscv64-binary
<stikonas>oriansj: yes for .M1 but no for hex2
<stikonas>oh, sorry, you pasted binary, not hex2
<stikonas>but still no
<stikonas>maybe my hex2 (riscv64 build) is indeed buggy
<oriansj>is this your hex2? b6f289956fd3623f0545e8521ec2023b042109d83a3791c3aab4014b6116dd2d test/test0020/tmp-riscv64/struct.hex2
<stikonas>yes
<oriansj>good. So now we have reduced it down to a local hex2 issue
<stikonas>so must be issue in hex2 binary
<stikonas>yes
<stikonas>probably again issue or large numbers
<oriansj>use GCC to build hex2 to eliminate self-host as a potential cause
<stikonas>yes, it's almost surely that
<stikonas>I can see 0xfffff000 in hex2_word.c where ~ is handled
<stikonas>and AUIPC instruction is where crash happens
<oriansj>in fact you should just do a GCC build of all of mescc-tools and use those binaries while hunting down issues in M2-Planet
<stikonas>yeah...
<oriansj>that way we are only testing one thing at a time
<stikonas>yeah...
<stikonas>I'll do that...
<oriansj>after we get M2-Planet happish, we will go back to figure out why it isn't happy in the self-host with something known good to compare against
<stikonas>ok, then test0020 is happy
<stikonas>it's now test0105 that fails
<oriansj>eded68800781a8986f0a0703edee6ebf6f23251365b7fb40d1cc04462e322869 test/test0105/tmp-riscv64/lisp.M1
<oriansj>62d7d6b7bae3c5006bcce96c726d7fb918ff84971c5a2b6c3d397765cded3245 test/test0105/tmp-riscv64/lisp.hex2
<oriansj>0a1cb20f6420950ade08152e8e25b546158db8bc4f13fe9bc5747fa8240b48ce test/results/test0105-riscv64-binary
<stikonas>one moment
<stikonas>it actually succeeds sometimes
<stikonas>and sometimes crashes
<oriansj>but the checksums?
<stikonas>checking
<stikonas>checksums are the same
<stikonas>and crashes in memset
<oriansj>trying to reproduce crash here (no crashes yet)
<oriansj>(using qemu-usermode emulation)
<stikonas>same here (qemu-usermode)
<stikonas>tries to access memory at 0x61c000
<stikonas>which is unallocated
<oriansj>how can two different people running the exact same static binary produce different behaviors
<stikonas>well, I get occasional passes and occasional crashes
<stikonas>it's kernel that's preventing access
<stikonas>and remaining tests pass with gcc'ed mescc-tools
<stikonas>including test1000
<oriansj>commit that. I'd like to verify we both have making checksums for all of the RISC-V binaries
<stikonas> https://github.com/oriansj/M2-Planet/pull/23
<oriansj>thank you stikonas
<oriansj>(you forgot to include checksums)
<stikonas>oh yes...
<oriansj>make Generate-test-answers will populate that after the tests run
<stikonas>and also need test1000 checksum...
<stikonas>oh, that one is unaffected...
<oriansj>the proof only changes if the code that makes up M2-Planet changes
<stikonas>ok, updated
<stikonas>yes, I realized that
<stikonas>so I think it's mostly hex2 issue that's left
<stikonas>when it's not compiled by gcc...
<stikonas>I can add another workaround like the one you merged...
<oriansj>lets not jump to conclusions with hex2
<stikonas>although, I think M2-Planet also needs to learn to handle large numbers
<stikonas>ok, let's see M2-Planet first
<oriansj>M2-Planet handles 32bit numbers just fine
<stikonas>not on risc-v
<oriansj>it uses 0xFFFFFFFF and 0xFF000000 without issue
<stikonas>on other arches...
<oriansj>So we need to understand what special care RISC-V needs
<oriansj>in regards to 32bit numbers
<stikonas>on risc-v it issues AUIPC + ADDI which fails for 32 bit numbers, works fine until routhly 2^31
<stikonas>I think just need to issue more assembly commands to shift everything to lower immediates
<stikonas>that's what binutils does
<oriansj>we are not binutils, so we need to understand what needs to be done at the individual instruction encoding level
<oriansj>for example do we need to do sign extension to full 64bits of the register?
<stikonas>yeah, we should check those
<stikonas>there might be some mess up with addi vs addiw
<oriansj>So when one does 0xFF000000 what does the register look like and what should it look like
<stikonas>well, I tested with basically the followign program, int i = 0xFF000000; convert to string; fputs(...);
<oriansj>on amd64 and AArch64 it sign extends
<stikonas>well, on riscv you can't just load 0xFF000000
<stikonas>you need to do AUIPC+ADDI
<stikonas>but I think it's limitted to 32 bit signed integers
<oriansj>ok and what do AUIPC+ADDI need to ensure the correct result? when needing to put 0xFFFFFFFFFF000000 into the register?
<stikonas>if we use ADDI then it sign extends to 64 bits, if we use AUIPC + ADDIW then it limits to 32 bits and sign is in 32'nd bit
<oriansj>(0xFF000000 in M2-Planet terms)
<stikonas>sorry, LUI instead of AUIPC, but rest applies
<oriansj>ok and what does LUI need to be for 0xFF00000000 ?
<oriansj>armv7l, x86, amd64 and AArch64 confirming riscv64 test results
<stikonas>well we do ~0xFF000000 which means LUI is getting FF000 as its immediate, hmm
<oriansj>Ok, so is Hex2 outputting that value?
<oriansj>correctly?
<stikonas>checking, I did that ~0xFF000000 test and binary contains lui with 0 as immediate
<stikonas>oh, sorry, too many 0 in .M1 file
<stikonas>well, not it loads 0xffffffffff000000 into register
<stikonas>with (gcc'ed hex2)
<stikonas>I'm just testing with
<stikonas>:_start
<stikonas>RD_A0 ~0xFF000000 LUI
<stikonas>RD_A0 RS1_A0 !0xFF000000 ADDI
<stikonas>:ELF_en
<stikonas>same with bootstrapped hex2-1 and M1-0
<stikonas>hmm
<stikonas>seems to work but that might not be the ideal testcase because ADDI gets 0 as immediate
<oriansj>and does hex2 produce 0 as the immediate given !0xFF000000 ?
<stikonas>oh that's in the code
<stikonas>it should produce 0 for ! part
<oriansj>well it wouldn't be that hard to iterate through all 2^32 possible inputs and make sure hex2 and M1 do the correct thing for all of them.
<stikonas> https://github.com/oriansj/mescc-tools/blob/master/hex2_word.c#L67
<stikonas>sorry, should actually point out to M1 code
<stikonas>that's the one dealing with immediates
<stikonas>hex2 is just labels
<stikonas>well, it's https://github.com/oriansj/mescc-tools/blob/master/M1-macro.c#L620
<stikonas>so 0xFF000000 & 0xfff gives 0
<oriansj>So if it works fine in M1+hex2; which means the binary is correct, what is the problem?
<oriansj>where is 0xFF000000 causing an issue?
<oriansj>M2-Planet is outputting the correct M1 instructions correct?
<stikonas>well, the problem is that M2-Planet segfaults
<stikonas>(and also remember that test0020 that failed with non-gcc'ed hex2)
<stikonas>I think M2-Planet is outputting correct thing
<stikonas>although, I'm not fully sure now, getting a bit confused with this bug
<oriansj>but not when building hex2
<oriansj>So let us look closer at hex2 for a second.
<oriansj>So build hex2 with M2-Planet and keep the gcc hex2 around
<stikonas>ok
<oriansj>and do the following have them both build test0020 binaries from the exact same hex2 file
<stikonas>different arches are fine I guess...
<oriansj>and what are the differences
<stikonas>gcc'ed hex2 is amd64
<stikonas>boostrapped hex2 is riscv64
<stikonas>ok, let me compare binaries
<oriansj>as hex2 should always behave the exact same regardless of host or target
<oriansj>and where they are different let us take a closer look
<oriansj>xeh will help with doing a compare with the resulting binaries
<oriansj>(its in stage0)
<stikonas> https://paste.debian.net/1214102/
<stikonas>oh, I just diffoscope
<stikonas>or do you wnat xeh?
<oriansj>that is fine as well
<stikonas>so 4 differences
<oriansj>4bytes total of differences
<stikonas>and I think those are LUI instructions
<stikonas>or addi after them
<oriansj>addiw a0, a0, 1900 vs sd s1, 240(a3) mv s2, a4
<oriansj>rasm2 -a riscv -b 64 -d 'e4fa 3a89'
<oriansj>well that would certainly cause a segfault
<stikonas>so second is wrong
<oriansj>very wrong
<stikonas>is addiw misencoded
<stikonas>in riscv defs
<stikonas>hmm
<stikonas>I'm confused
<stikonas>oh, maybe it's not immediates but label jumps
<stikonas>yeah, that's right
<stikonas>those differences are in the second line of AUIPC/ADDIW pairs
<stikonas>where we look up labels
<oriansj>can we distill the hex2 down into a smaller test by elimination
<stikonas>well, it's almost surely something https://github.com/oriansj/mescc-tools/blob/master/hex2_word.c#L66
<oriansj>it doesn't have to run but be different
<stikonas>in those 3 lines
<stikonas>yeah, some smaller test would be nicer
<stikonas>hex2 is a bit too big to debug
<oriansj>since they take the same hex2 as input. Cut it in half
<oriansj>bisect the input hex2 file until only the parts that are different remain
<stikonas>hmm
<stikonas>hex2 would complain once I cut out functions...
<stikonas>even if it's not run...
<oriansj>only if you remove lables needed
<stikonas>well, yes, if I keep labels, that should work
<oriansj>unless the issue is a specific offset size but then they will both match and you'll know you removed the diffference we are trying to distill
<stikonas>well, I'm removing one function at a time while keeping label
<stikonas>and recalculating hashes every time
<stikonas>so at the very least we should get a smaller test file
<stikonas>that is still broken
<oriansj>and if it is a difference you can replace lines with '00 00 00 00' to isolate the issue to the instructions in question
<oriansj>must smaller problem space to search
<stikonas>in the end it will probably be some stupid bug
<stikonas>it often is in these cases...
<oriansj>and a good test for mescc-tools
<stikonas>it's probably some specific offset
<stikonas>I can still try to minimize .hex2 file a bit
<stikonas>once I have 1 difference, we can just calculate offset
<stikonas>oriansj: removing one extra instruction from https://paste.debian.net/1214106/ causes files to be the same
<stikonas>this is still producing 1 byte difference
<stikonas>and it's probably related to 2048
<stikonas>file size is 2060 - first and last instructions would be 2052
<stikonas>and 2048 + 8 works fine
<stikonas>and 2048 is the range of !
<oriansj>So the difference is the 00050000 .00000500 !FUNCTION_putchar 1B000000
<oriansj>is the value = value + 4; the problem?
<oriansj>would moving it after shiftregister = shiftregister ^ tempword; produce the correct behavior in the M2-Planet tests?
<stikonas>well, value + 4 has to be there
<stikonas>but that's why problem comes at 2060 and not at 2056
<stikonas>so another data point is
<stikonas>hex2-0 works fine on this file
<stikonas>this is what we do there https://github.com/oriansj/stage0-posix/blob/master/riscv64/GAS/hex2_riscv64.S#L357
<stikonas>I specifically use addiw a0, a0, 4 and slliw there in hex2-0
<stikonas>but M2-Planet issues addi and slli there
<stikonas>which is why things go wrong then
<stikonas>but using addiw in M2-Planet would break other things...
<stikonas>all the pointer arithmetic would go wrong if result is restricted to 32-bit
<stikonas>as stack pointer is outside 32-bits
<oriansj>So?
<oriansj>we don't use addiw when doing pointer work
<oriansj>we use addiw when working with integers
<stikonas>ok, I'll try to change some emit_out commands but after lunch
<oriansj>and I'm going to try to distill your test further
<oriansj>67800000 $_END_IF_fseek_5 6F000000 ??
<stikonas[m]>That's 2 commands
<oriansj>and can you sanity check that this: https://paste.debian.net/1214107/ produces different outputs between the gcc and the M2-Planet hex2
<oriansj>(if so there is exactly two calls into UpdateShiftRegister which makes for easy simple stepping to see the problem)
<oriansj>then we will know exactly where it goes wrong
<oriansj>melg8: I'll have the fix for https://github.com/oriansj/M2-Planet/issues/18 up in a couple minutes
<oriansj>and patches up
<stikonas> https://paste.debian.net/1214109/ still reproduces it
<stikonas>but ~ is essential...
<xentrac>huh, I didn't know AUIPC was capable of causing a crash
<stikonas>xentrac: it's not AUIPC that's causing a crash
<oriansj>xentrac: it is if hex2 converts addiw a0, a0, 1900 into sd s1, 240(a3) mv s2, a4
<stikonas>it's hex2 misencoding AUIPC/ADDI pair
<oriansj>So we are figuring out exactly why when built by M2-Planet hex2 does that
<xentrac>oh, heh, sorry
<oriansj>no worries, shared understanding is essential to effective cooperation
<oriansj>I guess I need to build hex2 from M2 myself to get a better look at this bug
<stikonas>that might be useful...
<stikonas>I'm trying to look with gdb...
<stikonas>although, I should probably build hex2 with gcc-riscv64
<stikonas>amd64 version has different registers, so harder to compare
<oriansj>fair
<stikonas>well, we have 2 good hex2's one is hex2-0 and the other is gcc'ed hex2
<oriansj>one can also compare the M2-Planet build hex2 (amd64) against the riscv64 M2-Planet build as they should be doing functionally the exact same thing
<stikonas>yes, there are a few things we can try that might all uncover where exactly things go wrong
<stikonas>oriansj: so I can see some difference already
<oriansj>good
<stikonas>when I'm on this line https://github.com/oriansj/mescc-tools/blob/master/hex2_word.c#L103
<stikonas>tempword on amd64 version is 0xfffff000
<stikonas>but riscv64 register is 0xfffffffffffff000
<stikonas>oh, but maybe that's alright
<stikonas>hmm
<stikonas>because on amd64 version I'm printing "p tempword" directly
<stikonas>gdb has access to source there
<stikonas>but yeah, that's probably causing it
<stikonas>since we were not using addw...
<stikonas>I think addw would have restricted it
<oriansj>well use gdb to hand set the register to see if it fixes the output
<stikonas>hmm, something very strange is happening
<stikonas>when I read shiftregister next time it's 0xffffffff
<stikonas>rather than zero
<stikonas>probably need to go back and see how it got this value
<stikonas>hmm, it got changed at some point between two invocations of UpdateShiftRegister
<stikonas>I guess in unsigned sr_nextb
<stikonas>ok, that makes sense
<stikonas> 0xfffff000 >> 8 would give 0
<stikonas>but not 0xfffffffffffff000 >> 8
<stikonas>oriansj: and yes, handsetting it to 0xfffff000 fixes the output
<stikonas>should we just restrict it in hex2_word.c to 32-bits using bitmask?
<stikonas>hmm, although, that's not really the right thing to do...
<stikonas>should figure out why M2-Planet generates it incorrectly
<stikonas>oriansj: hmm, arithmetic_recursion should issue the second string for unsigned?
<stikonas>ok, that doesn't actually matter...
<stikonas>but it's right, the correct 2nd string was issued
<stikonas>oriansj: so what should we do?
<stikonas>I can workaround this by restricting value to & 0xffffffff
<stikonas>but I'm a bit confused how to fix this properly in M2-Planet...
<oriansj>well let me think about it
<stikonas>that UpdateShiftRegister function really assumes that it's variables are 32-bit
<stikonas>with hex2_word.c workaround M2-Planet is self-hosting and seems to work fine
<stikonas>but it's a bit unsatisfactory solution
<oriansj>fair
<oriansj>what if we do this to hex2: https://paste.debian.net/1214115/
<stikonas>that should fix it too
<stikonas>although, let me check what happens if I replace add->addw in primary_expr_stubs
<stikonas>(and other operations, not just add)
<oriansj>can you confirm that the patch fixes hex2's behavior in regards to the M2-Planet produced hex2
<stikonas>yeah, I'll test it now
<oriansj>thank you
<stikonas>that change add->addw etc breaks pointers, so I'll undo it
<stikonas>well, as expected since it breaks all long int operations
<stikonas>oriansj: oh, actually, that will only fix value if . is encountered
<stikonas>I don't have any dots in my testcase
<stikonas>oh sorry
<stikonas>that's incorrect
<stikonas>swap is not inside UpdateShiftRegister_DOT
<stikonas>anyway, compiling
<stikonas>no, I think I still get M2-Planet segfault
<stikonas>let's fire gdb...
<oriansj>new patch https://paste.debian.net/1214117/
<oriansj>(also trying to clear out things that might cause issues with M0)
<stikonas>yes, those would cauase issues with M0...
<stikonas>although M1 which we use then is fine
<oriansj>as now UpdateShiftRegister should not include any values exceeding 24bits
<stikonas>I am seeing a couple of unrelated problems with my tests but maybe let's deal with hex2 first
<stikonas>(those are kaem issues)
<oriansj>easiest to solve one problem at a time
<stikonas>indeed
<oriansj>so new patch: fix or no fix?
<stikonas>at least hex2-0 is not as slow as on aarch64
<stikonas>still compiling
<stikonas>it takes about 2 minutes for hex2-0 to link everything
<stikonas>but better than 15 min on aarch64...
<stikonas>GAS version of hex2 actually works much faster, maybe 10s
<oriansj>well C-x e in bash really is so handy if one sets export EDITOR=emacs
<stikonas>so qemu must be slowing things down
<oriansj>(correction C-x C-e )
<stikonas>no, still segfault...
<stikonas>(when M2-Planet is built)
<oriansj>and the test?
<stikonas>test is now fine I think
<stikonas>so probably this helps with hex2
<oriansj>lets confirm and then isolate next possible problem
<oriansj>I'll commit if it does fix the behavior in question
<stikonas>yes, it looks like testcase is passign now
<stikonas>yeah, let's push it
<stikonas>when we had a lot of bugs, it's easy to confuse yourself...
<oriansj>yep, now we are slowly knocking out the last
<oriansj>of the RISC-V specific bugs
<oriansj>So using gcc built M2-Planet, M1, blood-elf and hex2 compared against M2 built output, what is the first layer that is different?
<oriansj>or is it identical all the way down to binary
<oriansj>The first program that produces a difference is where we need to look for the next bug to crush
<stikonas>M2.m1 is the same
<oriansj>good
<stikonas>hold produced by M1 is the same too
<stikonas>ok, that's good
<oriansj>so another hex2 bug or matching binaries?
<stikonas>ok, another hex2 bug
<stikonas>binaries are different
<stikonas>let's see diff
<stikonas>another addiw issue...
<oriansj>did you update the C source for hex2?
<stikonas> https://paste.debian.net/1214118/
<stikonas>yes, I pulled in mescc-tools
<stikonas>into stage0-posix
<stikonas>(--- is the correctly behaving binary, +++ is bootstrapped)
<stikonas>probably if ((value & 0xFFF) < 0x800) tempword = value & (0xFFFFF << 12);
<stikonas>if value is still 64-bit in the register
<stikonas>that would still trigger what we see
<oriansj>yet (0xFFFFF << 12) can only be a 32bit value
<oriansj>with the top 32bits being zero
<stikonas>hmm, that's true...
<stikonas>then problem must be somewhere else
<stikonas>strange...
<stikonas>I don't see anything else that might go wrong in UpdateShiftRegister
<oriansj>So let us isolate a test
<stikonas>oriansj: ok, I have a patch that fixes it...
<oriansj>nice
<stikonas>might want to figure out a smaller set
<stikonas>but this fixes:
<stikonas> https://paste.debian.net/1214122/
<stikonas>((0xFFFF << 16) + 0xFFFF) might be a bit over the top, I can try 0xFFFFFFFF
<oriansj>(0xFFFF << 16) | 0xFFFF will always be exactly 32bits of 0xFFFFFFFF
<stikonas>yaeh, bitwise or is faster...
<oriansj>and can't overflow
<oriansj>even accidentially
<stikonas>and 0xFFFFFFFF does not work
<stikonas>which is that 32-bit loading bug
<oriansj>until I teach M2-Planet to properly deal with 16, 32 and 64bit integer types
<stikonas>well, we have something that works...
<stikonas>just doing final test with & ((0xFFFF << 16) | 0xFFFF);
<stikonas>and then you can push it
<stikonas>or I can make a PR...
<oriansj>however you prefer as RISC-V is your success
<stikonas>well, you did a lot of work too. Anyway, it works and I have change locally
<stikonas>so might be quicker to commit
<oriansj>I'm just happy to see stage0 continue to make progress in ways previously thought impossible ^_^
<stikonas> https://github.com/oriansj/mescc-tools/pull/25
<stikonas>well, with risc-v we had to add word-based M1 syntax
<stikonas>which was slightly annoying to implement
<oriansj>merged
<stikonas>but is starting to work
<oriansj>and once solid enough it'll enable MesCC to finally be able to support RISC-V
<stikonas>well, mescc needs porting too
<stikonas>but it will be easier now
<stikonas>the tools have some testing in the field
<oriansj>and syntax details have been worked out
<stikonas>not just written speculatively and hoping that it would work
<stikonas>hmm, cd doesn't seem to work in kaem... should check M2libc function
<stikonas>oh, I'm misreading things again :(. It's not cd but blood-elf needing new flags
<oriansj>yep, I'm updating x86 blood-elf flags right now, then I'll be doing the AMD64 and then AArch64
<stikonas>yep, everything seems to build
<stikonas>need to add another ${ENDIANESS_FLAG} in mescc-tools-extra.kaem file
<oriansj>well ENDIANESS will be the same for hex2, M1 and blood-elf and the flags are identical for all tools
<stikonas>although, I have a very strange problem with kaem-minimal
<stikonas>I added ../bin/kaem --verbose --strict -f mescc-tools-full-kaem.kaem
<stikonas>and it fails to run
<stikonas>prints it but doesn't seem to run
<oriansj>well sanity check with the gcc built kaem to see if it would run without issue. Then we can see if we found a new issue
<stikonas>full kaem works
<stikonas>that's kaem-minimal bug
<stikonas>the one written in hex0...
<stikonas>I can test GAS prototype
<stikonas>GAS version has the problem
<stikonas>so a bug must be in the logic
<stikonas>well, I can try high level prototype
<stikonas>oh, that one works
<stikonas>and I think another bug is that kaem-minimal on riscv64 does not stop if child segfaults...
<oriansj>good find
<stikonas>ok, first issue is probably a bug in my kaem-minimal assembly
<stikonas>looks like it does not pass through any shell variables
<stikonas>so full kaem just exists
<stikonas>that's the only difference I can see from strace
<oriansj>well kaem should function just fine without any shell variables
<stikonas>I guess that's a bug in kaem.c actually
<stikonas>yes...
<stikonas>env -i ../bin/kaem --verbose --strict --file mescc-tools-full-kaem.kaem
<stikonas>segfaults
<oriansj>it is literally the standard nightmare-mode
<oriansj>(or bootstrap mode)
<oriansj>as one can't expect an environment when starting from kaem-optional
<stikonas>oh, there is kaem -i flag
<stikonas>which prevents reading environment
<oriansj>--init-mode
<stikonas>yes...
<stikonas>although still, populate_env shouldn't crash on empty environment
<oriansj>well there is an easy way to check to see if it is
<oriansj>set --init-mode and see if it clears out the issue
<stikonas>yes, I already tried
<stikonas>init mode works
<stikonas>I'm just looking at what's causing thecrash
<stikonas>it crashes in while loop
<stikonas>while(n->next->var != NULL) n = n->next;
<stikonas>well, n is env
<stikonas>so if env is NULL, then yes...
<stikonas>that would crash it
<oriansj>guess we need a single require in populate_env
<oriansj>just require(NULL != envp, "should not have received a NULL environment");
<stikonas>wel, that would alert user...
<oriansj>or return depending how you wish to treat a null envp
<stikonas>but cna we not deal iwth it?
<stikonas>exactly
<stikonas>just add if ( n != NULL)
<stikonas>well, maybe let's ask fossy
<oriansj>yeah if(NULL == envp) return will do the correct thing
<stikonas>fossy did a lot of work on kaem too
<oriansj>yep, fossy took my minimal kaem and made it into a much more real shell
<oriansj>impressive work honestly given the bugs of M2-Planet back then
<stikonas>yeah, it might benefit from a few other improvements but it's quite impressive now for such small piece of software
<stikonas>e.g. exec more might be nice
<stikonas>for chaining into thte next script
<stikonas>now live-bootstrap ends up with loads of kaem processes waiting
<stikonas>kaem-micro actually does the right thing
<oriansj>and fix for kaem is up
<stikonas>ok, testing it
<oriansj>it is kinda amazing how well a buggy C compiler's output hangs together.
<stikonas>indeed...
<stikonas>it's far simpler than what I imagined C compiler would be
<stikonas>and works alrightish
<stikonas>needs some workarounds in C but definitely easier to write than assembly
<oriansj>good enough to bootstrap GCC
<stikonas>well, at least mes as a first stage
<stikonas>outch, it still segfaults
<oriansj>in contrast with scheme/lisp interpreters which are *VERY* touchy (especially in regards to garbage collection)
<stikonas>so envp must not be NULL then...
<stikonas>it's probably treated as empty array
<stikonas>oriansj: I think you need a * before envp there
<stikonas>if(NULL == *envp) return;
<oriansj>that would be if envp[0] was null
<oriansj>but envp wasn't null
<stikonas>oh, but does M2-planet support *envp
<stikonas>?
<stikonas>probably not
<oriansj>yes it does
<stikonas>well, envp[0[ would work
<stikonas>oh ok
<oriansj>but not *foo = *bar; silliness
<stikonas>ok
<stikonas>so I think riscv64 is almost done then
<oriansj>and honestly *envp is probably the wrong thing everytime its written
<stikonas>I guess I'll leave riscv32 for somebody else to do :)
<oriansj>completely fair
<stikonas>would be far easier exervice
<stikonas>exercise
<oriansj>possibly depending on the amount of differences
<oriansj>and how skilled the developer is in assembly
<oriansj>but a good learning experience none the less
<oriansj>x86 and AMD64 done. Just need to do AArch64
<stikonas>will you then update M2-Planet submodule?
<stikonas>(and mescc-tools)
<stikonas>I can then submit remaining kaem scripts to build remaining binaries
<stikonas>ok and envp[0] works
<stikonas>so you need if(NULL == envp[0]) return;
<stikonas>riscv32 probably has very few differences... It's mostly using lw, sw instead of ld, sd and in some places 32-bit specific issues (pointers are 4-bit long, rather than 8-bit)
<oriansj>will do that once I verify AArch64 is good
<stikonas>ok, thanks
<stikonas>AArrch64 must be slow to test...
<stikonas>if you are running on qemu user mode
<xentrac>4-byte rather than 8-byte?
<oriansj>64bits is 8bytes 32bits is 4bytes
<oriansj>stikonas: very slow, so I avoid changing it when possible
<oriansj>but I probably need to byte the bullet and fix the hex2 performance
<xentrac>heh
<stikonas>yes, of course bytes...
<xentrac>just a matter of buffering?
<oriansj>xentrac: pointer size is register size
<stikonas>xentrac: it's due to qemu issuing a lot of other syscalls
<stikonas>and context switches are slow
<oriansj>hence a huge performance difference between hand written hex2 and M2-Planet hex2 (with M2-Planet's output being an order of magnitude faster)
<stikonas>so by moving io buffer to stack, I was able to achieve 8x speedup
<stikonas>well, it's mostly because that hex2 is buitlt with blood-elf
<oriansj>stikonas: or doing far less calls to write with bigger blocks
<oriansj>So doing a buffer and flush for hex2 would probably make a major difference but would be much harder to write in hex1
<xentrac>stikonas: is qemu issuing syscalls because hex2 is issuing a lot of syscalls?
<xentrac>that's what I meant by "just a matter of buffering": less calls to write() with bigger blocks
<stikonas>xentrac: qemu is issuing some extra syscalls because I guess it finds binary suspicious
<stikonas>no section headers, etc...
<stikonas>so it has to be extra careful
<stikonas>same binary compiled with GAS is much faster
<stikonas>it's not just calls to write
<stikonas>it's also calls to scratch space on heap
<xentrac>I added output buffering to qfitzah a week and a half ago, which turned out to make it slightly *smaller* (on i386) rather than larger; not sure how much that correlates with "harder to write in hex1"
<xentrac>especially "harder to write in hex1 for RISC-V"
<xentrac>but it's some sort of data point
<stikonas>ok, so some data for final M2 linking (which is normally done with C version of hex2):
<stikonas>time GAS/hex2 temp test
<stikonas>real 0m9,055s
<stikonas>user 0m5,777s
<stikonas>sys 0m2,889s
<xentrac>I switched from `mov $foo, %al; call putchar` to `mov $foo, %al; stosb`. so it's sort of a quirk of the i386 that there's a 1-byte instruction for "mov %al, (%edi); inc %edi"
<stikonas>C version: time ./hex2-1 --architecture riscv64 --little-endian --base-address 0x600000 -f temp -o test
<stikonas>real 0m2,577s
<stikonas>user 0m2,432s
<stikonas>sys 0m0,030s
<xentrac>while a call is 5 bytes
<xentrac>if I'd been hand-assembling the code it would have saved me a lot of jump offset calculations tho
<oriansj>well jump offset calculations are quite cheap.
<stikonas>and hex1 version of hex2: time ./hex2-0 temp test
<stikonas>real 2m23,123s
<stikonas>user 2m8,890s
<stikonas>sys 0m12,145s
<stikonas>note that GAS and hex1 version are running exactly the same assembly instructions
<stikonas>and this hex2 is already optimized, runs about 8 times faster than before
<stikonas>well, jump offset calculations are quite cheap for program to do, but quite annoying to do by hand
<stikonas>once you have hex1, rest of the stage-posix stuff becomes less tedious
<stikonas>and more time is spend on programming rather than enconding binaries
<oriansj>kinda
<oriansj>hex1 removes the biggest pain. hex2 pulls out the next big pain and M0 pulls out the last major frustration.
<oriansj>then cc_* makes everything SOOOOOOOOOOOOOOOOOOO much easier
<stikonas>yeah, after M0 I just wrote directly in M1 code
<stikonas>yeah, with cc_* porting is basically done
<stikonas>most of the other software is automatically unlocked
<stikonas>at least if you catch bugs...
<stikonas>which does take some time as we saw
<stikonas>but doable
<oriansj>and sorts out porting issues for those tools as well
<stikonas>yeah, but you get a lot of C software for free
<stikonas>at least non-toolchain stuff...
<oriansj>I just hope we can find someone willing to work on the porting work for the pieces after TCC, which will become more important over time
<stikonas>like kaem, and all mescc-tools-extra
<stikonas>even TCC...
<stikonas>riscv is not in tcc 0.9.26
<stikonas>need some backporting
<stikonas>or somebody to improve mescc and mes libc to build newer TCC
<oriansj>or enhancements to MesCC to build TCC without changes
<oriansj>or depending on level of ambition, a version of TCC that M2-Planet can build directly
<stikonas>oh, cp might be broken
<stikonas>actually no, it's fine
<oriansj>or perhaps I'll pick up the M3 work in the future. which would provide a binutils compatible assembly syntax and standard linker sort of details
<stikonas>I'm just forgetting that it has fewer features than coreutils version
<stikonas>no . support
<oriansj>nothing to stop you from adding it
<oriansj>but perhaps after we get a proper RISC-V stage0-posix port out as a major release
<stikonas>ok, mes will be a bit harder to build...
<stikonas>since some files need porting
<stikonas>it uses some of its own stuff instead of M2libc
<stikonas>but yes, at we first need a new stage0-posix release with riscv support
<stikonas>at least untar and ungz seem to work fine
<stikonas>I was able to unpack mes
<oriansj>well I don't think I ever managed to convince janneke that using M2libc would be worth his effort and there are things in meslibc that are not yet in M2libc.
<oriansj>I guess I probably need to find a week or two to incorporate all of those functions into M2libc and port to all of the architectures before he *might* reconsider
<stikonas>well, M2libc is newer anyway
<stikonas>when mes first appeared, I guess there was no other options
<stikonas>well, stage0-posix still has somewhat smaller immediate range on riscv...
<stikonas>but maybe we can survive with it
<stikonas>it's almost 31-bit
<stikonas>and branches are now all indirect, so should support 20 bits...
<stikonas>that's 1 MiB...
<stikonas>M2-Planet is about 250 KiB without debug sections...
<stikonas>mes is probably similar
<oriansj>mes-m2 is 212,325bytes
<oriansj>but uses a great deal more memory when running
<oriansj>M2-Planet is exactly 272,452bytes right now (for AMD64)
<oriansj>and I just fixed the mes-m2 kaem.run build file
<oriansj>now to get back to updating kaem
<stikonas[m]>Well, ricv binaries are a bit bigger
<stikonas[m]>Push/pop are 8 bytes each
<oriansj>stikonas: in kaem array_length would return a zero if NULL == envp[0]
<stikonas[m]>Yes
<stikonas[m]>But next while loop crashes
<stikonas[m]>For is skipped
<stikonas[m]>And n == NULL
<oriansj>ok got a good fix
<oriansj>and pathc up
<stikonas>mescc-tools?
<stikonas>ok, I can see it on savannah
<oriansj>forgot to also push to github for a second there
<oriansj>(now it is one both)
<stikonas>it's fine, git makes it easy to pull from multiple sources
<oriansj>true and savannah is always my preferred master source. ( just can't get bootstrap-seeds in )
<stikonas>well, yeah, I am not really a fan of github either
<stikonas>have some personal projects on gitlab though...
<oriansj>I never got gitlab to work without JavaScript
<oriansj>but then again, I am of the extreme N0-js perspective even though a more moderate LibreJS-only perspective would probably enable a good deal of functionality needed.
<stikonas>oh yes, I've whitelisted various gitlab servers in noscript...
<stikonas>yeah, gitlab's JS is libre as far as I'm aware..
<oriansj>well the FSF's LibreJS plugin does check for you
<oriansj>correction GNU LibreJS
<oriansj>so does the kaem update fix the remaining kaem issue for RISC-V64 for stage0-posix?
<stikonas>yes, it fixes that empty environment issue
<stikonas>well, there is a smaller issue in kaem-minimal
<stikonas>it fails to detect segfaults
<stikonas>but that's less of a problem if you don't segfault
<oriansj>but something you'll fix
<oriansj>perhaps the old kaem-minimal for RISC-V which read from kaem.run?
<stikonas>well, I'll try to figure it out
<stikonas>but not today...
<oriansj>fair
<oriansj>as your RISC-V work will be the next major release for stage0-posix
<stikonas>well, first you need to pull in M2-Planet...
<oriansj>it is on: 057724344431736d72e55cb51a1f8f1c3df256df
<oriansj>with commit fb5fe9c487c39a3e5349e022d199f1676da16bee for stage0-posix
<oriansj>So unless I missed something all that remains is for me to do the AArch64 verification for the new fixed kaem and do a commit
<oriansj>then all that remains would be the RISC-V kaem steps you are working on
<oriansj>(and the RISC-V64 checksums too)
<oriansj>possibly improvements to HACKING or docs/M2-Planet.1 if either can think of something that needs to fix updated or fixed in them to provide improved understanding.
<stikonas>yeah, we need to mention that RISC-V is also supported now in readmes...
<oriansj>and hopefully capture anything that tripped you up when porting RISC-V to M2-Planet into HACKING
<xentrac>yeah!
<xentrac>your experience will be super valuable to people like me
<xentrac>oriansj: yes, jump offset calculations are quite cheap — unless you're doing them in your head
<stikonas>well, that's why this is the first thing we write in hex0
<xentrac>amusingly my subroutine table size optimization in Qfitzah eliminates the need to calculate jump offsets for procedure calls, because the offset in the call instruction is just the offset into the procedure table
<xentrac>instead of being PC-relative
<oriansj>seems touchy to where it is loaded into RAM
<xentrac>20-bit branch offsets don't care how much memory mes-m2 uses when running; you don't compile jumps into the runtime heap into the binary :)
<stikonas>well, it's possible to avoid 20-bit limitation by doing jalr call...
<stikonas>but we are unlikely to hit that limit with M2-Planet
<xentrac>oriansj: what do you mean about the touchiness?
<stikonas>so we can let more advanced compilers worry about that
<xentrac>right now I'm writing Qfitzah with gas and GNU ld, so the procedure table gets populated by the linker from relocations when it builds the binary
<oriansj>xentrac: by touchy I mean the task of getting mes-m2 into any form for GCC or M2-Planet is quite painful
<xentrac>hmm? what were you saying was "touchy to where it is loaded into RAM"?
<oriansj>we spent 2 years trying to get mes-m2 into a form that could be built by M2-Planet and still run MesCC
<xentrac>sure
<oriansj>as for your table idea
<oriansj>you would need to do absolute loads or still do relative offsets
<xentrac>what do you mean? the procedure pointers in the procedure table are absolute addresses
<oriansj>xentrac: ok now if the location of the procedure table was changed what happens
<xentrac>well, the startup code loads its address into %ebp. the startup code gets the procedure table's address from the linker, but if that weren't feasible, you could put the procedure table in the same segment with the startup code and do `call *(.+5); pop %ebp` (wait, is it 5? I forget, but whatever it is)
<xentrac>I don't know if the trick is actually useful for hex0, hex1, hex2
<oriansj>call label label: pop %ebp
<xentrac>right
<oriansj>so your table is at some offset from your binary that runs
<stikonas>hmm, something is a bit broken now
<stikonas>might be envp commit
<xentrac>well, not in the way it's currently built; it's in the .data segment, and the linker pokes the proper immediate constant into the instruction when it links
<stikonas>oriansj: it's trying to run /M2-Planet --architecture -f /sys/types.h -f //Linux/sys/stat.h -f /stddef.h -f //Linux/unistd.h -f /stdlib.c -f //Linux/fcntl.h -f /stdio.c -f /string.c -f /bootstrappable.c -f sha256sum.c --debug -o sha256sum.M1
<stikonas>that looks like empty env variables
<xentrac>it does
<xentrac>in Qfitzah I came up with the procedure-table trick to save bytes, because although I'm easily under my 2 KiB goal, my 1 KiB stretch goal is looking dodgy without bytecode
<stikonas>even though this invocation of kaem should have some variables set
<xentrac>does kaem live long enough to look in /proc/12734/env?
<xentrac>I mean /proc/12734/environ
<oriansj>xentrac: yes but we are not going to make it Linux specific
<xentrac>stikonas can certainly debug the bug in a Linux-specific way
<xentrac>I'm not suggesting putting opening /proc/$pid/environ into the code :)
<oriansj>it can also use sleep
<stikonas>well, syscall numbers are probably linux specific but yeah, we shouldn't put anything more
<xentrac>yeah, lots of places support Linux syscall numbers but not Linux /proc
<oriansj>stikonas: well netbsd and freebsd seem to support them enough (now that we fixed up the ELF-headers to be more strict)
<stikonas>hmm, I guess if they want to support same C libraries it's simpler
<stikonas>to share syscall numbers between OSes...
<stikonas>even though Linux itself does not share syscall numbers between different arches
<stikonas>ok, switching back to envp[0] check seem to fix kaem
<stikonas>although, I'm a bit confused why checking for empty arrays break things
<oriansj>notice that M2libc does ${ARCH}/${OS}/things
<fossy>oriansj: stikonas, yes I think it is reasonable to just not read in the environment if there is a null envp
<stikonas>yeah, that's true, we can support different oses there
<stikonas>fossy: yeah, we already tried to do that but a couple of non-working commits
<fossy>but I cant recall if there was special logic for the first item in the linked list
<stikonas>let me try once more and you can both review
<xentrac>what were the aspects of the ELF headers NetBSD and FreeBSD were choking on?
<stikonas>fossy: maybe that's why current version fails to work
<fossy>I think probablt
<oriansj>xentrac: see for yourself https://github.com/oriansj/M2libc/blob/main/x86/ELF-x86.hex2#L30 it is labeled
<stikonas> https://github.com/oriansj/mescc-tools/pull/26
<stikonas>fossy: can you take a look?
<stikonas>I reverted the last commit that does not work
<oriansj>array_length(envp) shouldn't change right?
<stikonas>well, I can undo that 2nd bit
<stikonas>and see if it still works
<stikonas>ok, it works, PR updated
<stikonas> https://github.com/oriansj/mescc-tools/pull/26/files
<stikonas>it's just one-liner now
<oriansj>well that would be a null dereference if envp actually was a null pointer
<oriansj>as 0[0] will definitely segfault
<stikonas>hmm, it doesn't segfault here though
<stikonas>hmm
<oriansj>because envp isn't actually NULL
<oriansj>it is just an empty array
<stikonas>yeah, looks like it
<xentrac>oriansj: thanks!
<oriansj>So a one line change would be to add the if(NULL == envp[0]) return; after the if(NULL == envp) return;
<xentrac>just EI_OSABI and EI_ABIVERSION, eh?
<oriansj>xentrac: yeah the Linux emulation layer checks to make sure it isn't running for native binaries
<stikonas>ok, let's test that
<stikonas>ouch
<stikonas>sha256sum does not work
<stikonas>hmm, I guess large integer issues...