!djTaTBQyWEPRQxrPTb:nixos.org

Nixpkgs Architecture

215 Members
Discussions about Nixpkgs' architecture - https://github.com/NixOS/nixpkgs/labels/architecture47 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
11 Jun 2024
@nbp:mozilla.orgnbpMost of the time no.12:04:01
@nbp:mozilla.orgnbp * (patching path of different length) Most of the time no.12:04:30
@Minijackson:matrix.orgMinijacksonhow so? I would assume that the program knows the start address and the length of the string, so we can't put longer strings without having to shift the rest, and shorter strings aren't guaranteed to work either12:08:12
@nbp:mozilla.orgnbpthe program yes, the patching tool probably does not.12:23:58
@nbp:mozilla.orgnbpthen you have different encoding, depending on the language, and other variables that would have to be shifted otherwise, assumption on the addresses …12:25:46
@Minijackson:matrix.orgMinijackson
In reply to @nbp:mozilla.org
the program yes, the patching tool probably does not.
I'm not sure I understand this sentence. Isn't the point patching programs?
12:32:24
@nbp:mozilla.orgnbpWell patchelf is patching the header of the ELF binary, but it is assumed unsafe to attempt patching random strings, unless you are sure that they have the same length.12:37:40
@nbp:mozilla.orgnbp The replaceDependencies is the closest thing there is to replacing raw path to the nix store by another one in the nix-store, but beware that if the version changes from 0.4.0 to 0.4.0a this would cause a lot of issues. 12:39:24
@Minijackson:matrix.orgMinijackson so for the solution proposed by Alexandros Liarokapis, unless the paths are of the same length, there's quite a chance that it would lead to bug, then 12:44:24
@aliarokapis:matrix.orgAlexandros LiarokapisConverting longer paths to shorter relative ones should work12:44:27
@aliarokapis:matrix.orgAlexandros LiarokapisHmm yea I guess it depends on the encoding12:44:46
@aliarokapis:matrix.orgAlexandros LiarokapisProbably only works for c strings12:44:52
@Minijackson:matrix.orgMinijackson if the path are shorter, it could be padded with /, but seems hacky x) 12:44:57
@Minijackson:matrix.orgMinijackson
In reply to @aliarokapis:matrix.org
Probably only works for c strings
even then, depending on compiler optimisations and other factors, the length of the string might be assumed
12:45:33
@aliarokapis:matrix.orgAlexandros LiarokapisPadding with null strings is also possible12:45:34
@aliarokapis:matrix.orgAlexandros Liarokapis* Padding with null chars is also possible12:45:49
@Minijackson:matrix.orgMinijackson
In reply to @aliarokapis:matrix.org
Padding with null chars is also possible
not sure, if the compiler optimises printf("some string") to write(stdout, "some string", 11), replacing some string with something shorter but null padded will print null bytes to stdout
12:46:43
@nbp:mozilla.orgnbp
In reply to @aliarokapis:matrix.org
Converting longer paths to shorter relative ones should work
No, Pascal for example encode the length next to the string.
12:53:00
@nbp:mozilla.orgnbpSome compilers could bake-in strlen of constants at compile time.12:55:12
@willbush:matrix.orgwillbush infinisil: Philip Taron (UTC-8): I've been kinda wanting a place to share and discuss Rust blog posts / news with you guys. Any ideas? 13:08:56

Show newer messages


Back to Room ListRoom Version: 9