New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify cmd/link #622
Comments
Completely removing file names - tested and working (-3.7%) Together: -7.7% (81kb) |
For step 3 of the linker build, put the binary in
What do you mean by "at the end"? It sounds to me like we could store that "inputs hash" as a file alongside the linker binary, which would be easier to reason about. If either the binary or the hash file are missing, we would rebuild. As for the features - I think we should begin by just shuffling magic numbers. That's an easy change, so we can focus on reviewing the linker patching logic, and let our users test it before we develop more features. I also don't think that feature should be behind a flag like I'm not going to comment on the two other proposed features for now. They sound interesting, but I think we can talk about them when the first one is in master and it works well :) |
"at the end" - just write to end of the linker binary, this should not affect workability in any way |
Gotcha. I'd still use a separate file, as that's easier to understand and debug. It's also how Go's own build cache works - some files contain the built content, other files just contain hashes. |
Okay, i will try to prepare a pullrequest on weekends |
Idea, is to modify and build
cmd/link
on the user's computer.Patch making
According to @mvdan idea to make a fork with changes and updates based on garble supported version of golang. Then manually use
git diff
to generate patches which will later be used to changecmd/link
.Build process and caching modified linker
$GOROOT
and get full path$GOROOT/src/cmd/link
go build -overlay ${tmp}/fileWithListOfModifiedFilesAt2Step.json -o ${os.UserCacheDir}/.garble/link cmd/link
patchesHash + golangVersion
nearby modified linker to keep it up to dateLaunch logic:
.garble/link
file - build linkerFeatures for first version
Randomize magic value in
moduledata
, to increase difficulty of automatic analysis (PoC)2. Completely removing function names (guaranteed to break reflexion) by writing an emptyruntime.functab
(code)2.1. Or a more difficult way, we can hash all the names
hash(name+randSalt)
and modify the reflection. This will hide filenames and keep the reflection working.4. Completely removing file names by writing an empty
runtime.filetab
(code)The text was updated successfully, but these errors were encountered: