Skip to content
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

Version scripts that hide symbols break linkage for compartmentalized builds #415

Open
randomPoison opened this issue Oct 3, 2024 · 5 comments

Comments

@randomPoison
Copy link
Contributor

randomPoison commented Oct 3, 2024

If a project has a function foo that is used as an address-taken function that has been rewritten by the rewriter, and the project uses a linker script to mark foo local, then the function gates in libcallgates.so will generate linker errors when they can't find foo in the compartmentalized library. Note that this is basically the same error as in #414, but caused by a linker script instead of a static modifier.

@randomPoison
Copy link
Contributor Author

@ayrtonm
Copy link
Contributor

ayrtonm commented Oct 4, 2024

The problem here is basically the same thing as 414 (missing the right type of callgate), but I'm not sure this can be fixed in the rewriter alone. Basically we'll need something similar to IA2_BEGIN_NO_WRAP to get the rewriter to create the correct callgates for these functions.

@randomPoison
Copy link
Contributor Author

I think this is just something we need to document in the usage docs. The user will have to do some additional source annotation (e.g. add the used attribute) to handle this case since we can't do it automatically, so we should note this limitation and tell the user how to manually fix it.

@ayrtonm
Copy link
Contributor

ayrtonm commented Oct 4, 2024

Right, though I don't think the used annotation by itself does the right thing here.

@ayrtonm ayrtonm changed the title Version scripts that hide symbols break linkage for containerized builds Version scripts that hide symbols break linkage for compartmentalized builds Oct 4, 2024
@rinon
Copy link
Collaborator

rinon commented Oct 5, 2024

The simplest thing I can think of is a CLI param for the rewriter that tells it to treat a symbol as internal. Were you thinking of adding an annotation to the sources instead, Ayrton? That works too, probably cleaner, but technically the linker script allows the build system to hide the symbol independently from the source file, so in some configurations it might and in some it might not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants