-
Notifications
You must be signed in to change notification settings - Fork 710
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
Replace C code for reading and parsing /proc/cpuinfo
and /proc/self/auxv
with Rust code
#357
Comments
See https://rbcommons.com/s/OpenH264/r/383/:
It might be the case that we can work around the bug another way. I think we should just delete this file I/O code and pursue other, simpler, avenues of workarounds. |
OK, it looks like |
I'm happy to tackle the i/o and parsing. Is the end goal to set |
Awesome!
The end goal is to do as much of this in Rust that we can do in a reasonable way without using unstable features. The most immediate goal is to get rid of the use of non-Rust I/O and non-Rust memory management, in particular the |
As I mentioned in the current PR., I think we should just implement
If we implement an analog in Rust then we can avoid weak linkage (which Rust doesn't support, forcing us to use a C wrapper), and we can avoid problems such as https://code.google.com/p/android/issues/detail?id=161012. |
The patches to actualy set See also https://lkml.org/lkml/2013/12/23/162. |
Of course, that doesn't work because it isn't safe (thread-safe or otherwise) due to the setenv fiasco. |
The deal-breaker for walking the stack from |
@marshallpierce Yes, I agree and that's what I was referring to when I referenced the setenv fiasco. I did some more research, and now I'm fine with just completely skipping the fallback for reading from For Android ARM builds
According to https://developer.android.com/about/dashboards/index.html, 88% of devices have Android version 4.3 or later. That number is going to grow over time. For non-Android ARM buildsFor non-Android ARM builds, we should simply require that libc implements |
Closing this. As of ring 0.14 we require |
cpu-arm-linux.c contains code that determines the CPU capabilities using
getauxval()
on newer versions of Android and by reading from/proc/cpuinfo
or/proc/self/auxv
ifgetauxval()
isn't available. This is the last bit of C code that does file I/O and one of the last remaining users of the C standard library in ring.Regarding the part that parses /proc/cpuinfo, here's an example of the bad CPU that reports NEON is available but where NEON is actually broken, from https://bugs.chromium.org/p/chromium/issues/detail?id=606629#c12:
Note that the spaces between the field name and the colon are actualy tabs.
We should have a test that verifies that the parser for the above output is correctly recognized as not supporting NEON, and probably other tests. We don't actually need to run the test on one of the buggy phones; instead we can have the test for this run on in all
#[cfg(all(test, feature = "use_heap"))]
builds on any CPU. In particular, this means that the code that opens the file and parses it needs to be callable from tests that pass in alternative file paths. Then we can put the above output into a test vector file.The text was updated successfully, but these errors were encountered: