-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Move AT_EXECFN to fallback for /proc/self/exe #78958
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
Conversation
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsIn #66874, the missing header was added which enabled the fast (aux vector) path on Linux. The issue with The fix is to remove the usage of Fixes #78941 (we will probably need to backport this to .NET 7)
|
|
I have looked at the unsigned long entry = getauxval(AT_ENTRY);
st = dladdr((void*)entry, &info2);
if (st != 0)
{
printf("From AT_ENTRY: %s\n", info2.dli_fname);
}I've created a .sh script with the shebang pointing to my test app with the code above and when I ran it it printed this: |
Yes, that's how we discovered the missing header #66874 (comment) when running a .NET app on a system with broken procfs. After that I sent other PRs to remove the usage of procfs in runtime and sdk repos. This PR, however, is a correctness fix; both
Could you point me where the docs mention the |
|
@am11 I've found AT_ENTRY documented in the I have actually got an additional idea on fixing this issue. What if we just flipped the order of reading the |
ad27bfc to
87b691b
Compare
janvorli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
|
All the CI failures are known issues unrelated to this change. |
|
Thank you. I think we should backport this to .NET 7 (to unblock PowerShell users). cc @agocke, @vitek-karas |
|
/backport to release/7.0 |
|
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3586639149 |
In #66874, the missing header was added which enabled the fast (aux vector) path on Linux.
The issue with
AT_EXECFNis that it returns the path which was passed to the process vianamei. This breaks the scenario where the .NET process is used as interpreter (namely PowerShell's#!/bin/pwsh) and returns the path of script containing the shebang link to the interpreter rather than the interpreter's path. In other words,AT_EXCFNimplementation !=/proc/self/exe. In all the usages ofminipal_getexepath()in runtime repo, we need the behavior of latter on Linux.The fix is to remove the usage ofAT_EXCFNand rely solely on/proc/self/exefor Linux (which we were accidentally using in .NET 6 due to the missing header).The fix is to flip the order so
AT_EXCFNis used as a fallback to/proc/self/exe.Fixes #78941 (we will probably need to backport this to .NET 7)