-
Notifications
You must be signed in to change notification settings - Fork 270
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
Souldn't it also work, if /proc/version" is read from an other process into buffer? #7
Comments
I'm not sure and must be depending on the environment.
I can't tell without the source code. |
As quick example, something like: and in an other terminal run: while [ 1 ]; do cat /proc/version > /dev/null; done Maybe I miss understood the whole thing but in my opinion the code is accessing data for which it has permission anyways. Is it possible to output /proc/version without So thanks for your test, but I don't get it at the moment. |
The kernel has the access to this memory, but not the userspace. But userspace can "read" it via cache accesses. Try playing with processes affinities. Maybe try change the criteria of the success (I believe checking that hist[i] > 2 may be enough). Try enabling debug and show the results again. |
OK, I played with the thresholds Maybe, it is really some timing problem. Secondly I changed your original code, but while reading one bit, I load the file only once in buf, there are already random changes/mistakes in output. |
I updated the code, it now reads whole bytes and uses a different approach to see what is the value read (a histogram). If you read the
|
@sebeka Please, next time just show the code by forking original and commiting in your fork. It is easy and it improves sociability. Git is a wonderful thing for this ability. |
Just for understanding,
you open (proc-)file "/proc/version" and to get one bit of output you read 10000 times 256bit of it (always at the same position)
(void) pread(fd, buf, sizeof(buf), 0);
I don't understand it completly, but I mean reading a file while opening it, is no big deal.
Should it not also work, if /proc/version is read for some seconds by an other process?
I put the read file stuff into an other file and recompiled both. With running read process I started
./run.sh but I only get:
ffffffffbbe00060 = 0
ffffffffbbe00061 = 0
ffffffffbbe00062 = 0
...
The text was updated successfully, but these errors were encountered: