log☇︎
593 entries in 0.188s
bvt: Ada.Sequential_IO is wired straight into fopen/fread/fwrite, by the way.
bvt: re syscalls -- fair enough. but imo this shows extreme brokeness of linux portability -- i can't think about a sane reason for syscall numbers to differ across arches.
bvt: asciilifeform: re exotic flags -- sure. but i don't expect different results with syscall numbers as well. some subset will match, later in the table -- complete mess
bvt: http://btcbase.org/log/2018-10-25#1866029 << asciilifeform, it seems that i accidentally made you believe that only mips is wrecked. Well, check this out http://p.bvulpes.com/pastes/sWrur/?raw=true ☝︎
bvt: http://btcbase.org/log/2018-10-25#1866027 << thanks! ☝︎
bvt: http://btcbase.org/log/2018-10-25#1865825 << if you don't force the 'tempfiles ./tmp' scheme, i would much prefer to implement the 'temp. file in ./' variant. vpatch coming at latest tomorrow. ☝︎
bvt: given that there is a single temporary file -- would ./ also work? ./tmp directory would have to be separately created and removed, and the less unix fs is touched, the better, i guess.
bvt: this was re http://btcbase.org/log/2018-10-25#1865784 ☝︎
bvt: http://btcbase.org/log/2018-10-24#1865707 << i see a point re not writing above ./; will reimplement using ./tmp. ☝︎
bvt: would you consider /tmp security issue resolved from vpatch's view if TMP/TMPDIR is respected?
bvt: hi, phf! i can provide a follow-up vpatch for respecting TMP/TMPDIR
bvt: comment approved, i would do a writeup on this topic (so far ETA middle of next week, this sunday night very optimistically).
bvt: i would much prefer going pure ada for a subset of posix. otherwise it's the same as relying on GNAT-specific packages -- it exports plenty of interesting stuff, not sure about networking though.
bvt: yes, i skimmed through it. all these sockaddr structures would be a bitch to do in ada. this is why i believe it would be useful to define, what subset we'd need.
bvt: well, for the library that i had in mind was strictly a database of flag name->int mappings, syscall numbers, maybe structure definitions.
bvt: but so far it's not clear what the subset should be, what to do about C structures (with problems like e.g. https://www.openwall.com/lists/musl/2017/01/25/1)
bvt: i would try to make some sort of write-up about this. i wanted to suggest making a Ada library that exposes a subset of Linux system calls without C code, because i clearly needed it for the tempfile.
bvt: and the amount of damage is ridiculous, even errno codes are different on mips.
bvt: asciilifeform: re open flags: this is exactly what i was pointing at. should have made the text bold, i guess. if all these flags numbers were the same, i would have used the syscall wrapper functions.
bvt: a better write-up on the vpatch temporary file creation: http://bvt-trace.net/2018/10/vpatch-replacing-mktemp3 ☟︎☟︎
bvt: thx
bvt: hi, i have mp-wp set up now: http://bvt-trace.net/2018/10/instead-of-hello-world-fg-tests/ . I will publish writeup and updated vpatch for vpatch later today. ☟︎
bvt: BingoBoingo: ty
bvt: !!v 314FFA01ECAE3BF4FD9863521D78063D3329D513BBF082B11172B54A17B8A7B3
bvt: !!pay-invoice BingoBoingo 1
bvt: i have already reworked the code based on the following code from GNAT: http://p.bvulpes.com/pastes/xjjec/?raw=true (g-locfil.adb, lockfile implementation). i.e. System.Address of an aliased String as argument to C function.
bvt: thanks, i see what you mean. the Interfaces.C.Strings.New_String() comments explicitly say that the heap allocation is necessary for the large strings, which is not the case for vpatch temporary file names.
bvt: it seems that 'c strings' in ada are still controlled by ada mechanisms, i.e. they are ada strings (with bounds checking), just with null byte in the end
bvt: so no primer is necessary
bvt: i have my own painful experience with them
bvt: http://btcbase.org/log/2018-10-15#1863102 -- well they moved to another file, with tempfile implementation. i guess ave1 knows a total cure ☝︎
bvt: yes, these lockfiles are just a big mess.
bvt: http://btcbase.org/log/2018-10-15#1862867 -- i'd bet this is file-system- and linux-version-specific. at least in the NFS case lack of support for some versions is explicitly advertised. ☝︎
bvt: the System/GNAT.OS_Lib find is interesting, i have missed it.
bvt: ave1, can you expand on getting rid of string allocations? I see a way to get rid of it for Mode, but not for the Path argument. i can move its c-string from heap to stack, but that would be it. anyhow, i will revise this aspect. ☟︎
bvt: http://btcbase.org/log/2018-10-15#1862638 -- i agree that this solution is not that great. however, other alternatives have problems of their own. ☝︎
bvt: btw, now vpatch.adb does not require Interfaces.C/Int.C.Strings for anything, they will go away in the revised vpatch. ☟︎
bvt: that's what I think as well
bvt: re naming: i agree that it clashes with Ada naming convention. will rename to Temporary_File.
bvt: http://btcbase.org/log/2018-10-15#1862604 -- specialization was exactly the issue for me ☝︎
bvt: http://btcbase.org/log/2018-10-15#1862597 -- good catch, you must be right. i'll check that. ☝︎
bvt: should set everything up till the end of the week. i didn't rent a rk; but already tested pressing mp-wp locally. ☟︎
bvt: http://btcbase.org/log/2018-10-15#1862641 -- mircea_popescu, diana_coman, i'm in the process of getting some btc currently, after that will get pizarro shared hosting. ☝︎
bvt: hello
bvt: would love to hear your comments
bvt: short writeup on what i did and why: http://p.bvulpes.com/pastes/GLopH/?raw=true
bvt: vtools_tempfile_standalone.vpatch http://wotpaste.cascadianhacker.com/pastes/A0SPK/?raw=true vtools_tempfile_standalone.vpatch.bvt.sig http://wotpaste.cascadianhacker.com/pastes/IVy7W/?raw=true
bvt: hello
bvt: should have implementation done over weekend
bvt: i will have a look at what primitives i need for the implementation today and tomorrow, and will come back here if i get stuck on something.
bvt: yes, i misread
bvt: uhm, strace shows me here that the temporary filename changes
bvt: perhaps better way would be to create a temporary directory (for which there is atomic create-or-die) at the vpatch start, and place all temporary files there?
bvt: and i'm don't know yet if files created this way can be mv'ed to file system
bvt: there is a recent linux O_TMPFILE flag to open(2), but i'm not sure we want to use that
bvt: right, Ada.Directories.Exists was the missing piece.
bvt: i will give it a try. i'm still learning ada, will have to take a look at how strings and interfacing with C are done properly.
bvt: did you use ave1's gnat or the adacore-provided distro? My understanding is that it should work with both, taking 2 different code paths, and fail only with gnat17.
bvt: that was a wtf moment for me, i'm not used to such service from the runtime
bvt: I understand this, but still it's better to drop the vpatch, at least in the logs, in case someone else stumbles upon this problem.
bvt: Apparently those addresses are used as 'poor man's RNG'
bvt: 3. Musl calculates a simple hash over current time, address of variable on stack, and address of template to generate the random characters for mk*temp family of functions: http://git.musl-libc.org/cgit/musl/tree/src/temp/__randname.c#n6
bvt: There seems to be no useful code to take from GNAT for this problem.
bvt: The code in question is in gcc/ada/adaint.c in function __gnat_tmp_name (char *tmp_filename), http://wotpaste.cascadianhacker.com/pastes/cxakJ/?raw=true
bvt: 2. Ada internally uses mkstemp(3) to generate a random name when empty string is passed as filename to Open procedure.
bvt: vtools_fixes_mktemp_template.vpatch.bvt.sig http://wotpaste.cascadianhacker.com/pastes/A5VIC/?raw=true
bvt: 1. The vpatch which solved the problem for me: vtools_fixes_mktemp_template.vpatch: http://wotpaste.cascadianhacker.com/pastes/3xcAF/?raw=true
bvt: decided to add some information to the yesterday's thread on mktemp use in vpatch:
bvt: hello
bvt: iirc mkdir does atomic 'create or error-out'
bvt: Reapplied ave1's patches over gnat17, and musl-cross-make (https://github.com/richfelker/musl-cross-make/)
bvt: I was man-aloning for quite some time
bvt: I was too naive when I entered academia. Hoped for honest investigation of technology, but everyone there seems to be ok with building on broken stuff.
bvt: Hello mircea_popescu!
bvt: "security", so in the end in boils down to handwaving problems away with TLS (aka pseudosecurity)
bvt: I live in germany, ukr by origin
bvt: I can't say I'm doing anything interesting in everyday life (PhDing in CS) ☟︎
bvt: well, I was reading logs for a really long time
bvt: thanks
bvt: Nope, ave1's is 2016
bvt: Which explodes at http://btcbase.org/patches/vtools_vpatch#L789, after close at http://btcbase.org/patches/vtools_vpatch#L778
bvt: GNAT 2017, though, deletes such files on Close call.
bvt: GNAT 2016 runtime deletes all files with temp bits at the Finalization stage, so everything should work fine. (Not an ada specialist, so when finalization is actually run is a mistery to me)
bvt: sorry, slow typer
bvt: but also sets a Temp bit in File record
bvt: empty string ("") is special-cased in GNAT runtime, which does mktemp equivalent internally ☟︎
bvt: musl wants 6 template chars: http://git.musl-libc.org/cgit/musl/tree/src/temp/mktemp.c#n13
bvt: basically, template variable here: http://btcbase.org/patches/vtools_vpatch#L285 is too short.
bvt: sure, but I guess you are interested in explanation as well?
bvt: Sorry, don't have a WWW, but the fix should be a one-liner
bvt: I have a bug report for vpatch from phf
bvt: Hello, I am BT from the recent diana_coman's comments section ☟︎
bvt: !!register http://p.bvulpes.com/pastes/DPctA/?raw=true