-
Notifications
You must be signed in to change notification settings - Fork 322
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
Building git-core's ICS branch... #9
Comments
|
Thank you for the reply. I have a Verizon Galaxy Nexus running AOKP b23 (4.0.3). The segmentation fault is definitely still an issue on ICS and ICS ports, failing on commands such as 'pm'. I follow zeppelinrox's SuperCharger thread on XDA ( http://forum.xda-developers.com/showthread.php?t=991276 ) and there have been other reports of the same errors including by zep himself. In fact he found the other open issue #6 discussing the problem on this git, which brought me here. Both the mentioned workaround of passing LD_LIBRARY_PATH and your patch have fixed the issue on my phone and his (I believe he runs an ICS port on a Milestone). So yes, I think it's worth looking at this issue again. A few more followup question, if you would indulge me. I'm new to AOSP and compiling against it. I followed your build instructions in your git wiki, so I believe I have the current 4.0.3 branch.
Thank you again! |
I've merged gc into gc-ics, so you may use the version w/o known bugs and security issues now.
|
I'd like to test a version of your patch that inherits LD_LIBRARY_PATH only. It seems that is the only one that matters, so it would be nice if that's all it took to fix the problem. Another question then... I've done a bit of searching and it seems that Android 4 dropped support for armv6. I'm guessing then it is not possible to compile su as armv6 with the current source tree? I see a post on androidsu.com from Oct. 23rd, 2011 that seems to hint at the same problem. It looks like ChainsDD found a way to compile for ARM generic. Was this with an old source tree, some other cross-compile method maybe? |
I've pushed the patch into both chainsdd:gc-ics and git-core:ics repos.
I don't know details but what I see in AOSP tree it is controlled by TARGET_PRODUCT, full sets generic as PRODUCT_DEVICE and, hence, chooses cpu arch and abis for armv7, generic_armv5 sets generic_armv5 (what a coincidence!) as PRODUCT_DEVICE and chooses default abis and armv5 as cpu arch. |
I found the target setting and compiled for armv5, thanks for that! However the patch doesn't seem to be working. After running su there is still no LD_LIBRARY_PATH environment string, and I get the seg faults. Relevant logcat entries: E/su (22700): sudb - Opening database |
Got it. I forgot to test w/ non-root credentials. Could you test the following: |
The reason is explained there. The workaround is to pass LD_LIBRARY_PATH over su. |
Odd... passing LD_LIBRARY_PATH as suggested there there is no errors in logcat but nothing happens... |
I think our line numbers are a bit off. In the current su.c, the call to populate_environment is on line 377, and line 535 is in the middle a if (setgroups(0, NULL)) { block. Can you give me a line before / after marker to move that call? I'm thinking you may have meant move to line 545 after the three set* calls. |
Ok, I fixed it. I moved the call to populate_environment(ctx) down about 9 lines, just above #define PARG(arg), and left it as is, not (&ctx). Tested with no errors or seg faults. I also verified LD_LIBRARY_PATH is set for the root shell. I just want to verify that's the proper patch? |
Wraithdu nice done! |
I checked ChainsDD:gc-ics:su.c in the github source browser again. It shows populate_environment is on line 378. Oops, wait, this stupid piece of crap starts counting from line 5 actually. At least, for me. OK. You shall move populate code in main just before "if (setgroups(0, NULL)) {"
It works only for cases when you switch to root. It doesn't work at all if you switch to a non-privileged user. If you may outlive this restriction you may keep your approach. The final patch will fix the bug differently, anyway. I'll rather add temporary identity change to populate_environment or near it and keep it exactly in the place it's being located now. But I'm not sure still. |
Thanks for the clarification. I got your patch to work, so it's good for now until you finalize it. Just a question... should you be able to 'su 1000' from a non-root shell? Or must you be root first, ie 'su; su 1000' ? |
It's quite legally to change identity from one uid to another. Superuser still asks a user for permissions though. |
Well the reason I ask that, is that 'su 1000' from a non-root shell fails.
But issuing 'su' first, so the shell is root, allows 'su 1000' to succeed.
|
Well, you've caught a bug in su. My congratulations if it's your first su bug. |
Heh, thanks :) I think it's a real bug though, I did a fresh git clone when you merged master into ics. But I can do a fresh clone when I get home to test. BTW, should I be pulling from ChainsDD's gc-ics branch, or your repo / ics branch? |
No doubt, I do too. |
Ok, so I re-cloned ChainsDD's gc-ics branch, now I see your call to seteuid in the get_parent_env function. However after incorporating the above change to move the call to populate_environment, I'm still seeing the same logcat errors and failure when trying 'su 1000' from a non-root shell. I believe the problem is this block
where seteuid is called again, changing away from root, before calling allow. Since we moved the call to populate_environment out of allow to fix the previous error, we still get this one :/ |
Bah, nevermind. I just realized your patch supersedes the earlier one. Successful test just now, inheriting LD_LIBRARY_PATH works and so does 'su 1000' from non-root shell. Nice :) |
Hi masters, |
Yeah, you have to setup the whole build environment. But I have it done obviously, so I'll post a link with a compiled version for you to test out. git-core is committing a few things today, so I'll probably make sure I have the latest sources and do a fresh build tonight then post it. |
Definitely, not today. I plan to implement and test all new stuff during next weekend. Even everything is needed is a move of a pair of lines in the code. |
Ok thanx, |
@perettigiuliano I just compiled the binary for ICS (as I have a similar interest in this getting fixed). Additionally, the wiki page for this project has all the information you need to setup an environment. |
Thanx for the binary but int the wiki page i can't see anything, just a welcome message... |
@perettigiuliano The instructions are on git-core's wiki page |
Thanx men, i am searching at wiki link at the top of this page. I will never ever find that link without you... |
Actually, it's linked from Issue #1 in this wiki... that's how I found it. |
I just recompiled using chainsDD's gc-ics branch and re-uploaded the binary. I had originally used git-core's ICS branch and I'm having better results with this version. |
What was wrong w/ git-core:ics branch? They're virtually the same as long as I don't forget to pull from gc-ics to ics. Or do you really mean the events of the past two weeks? |
@git-core It was actually a problem in my own code. The two builds work the same. |
Actually, there is a problem with git-core:ics, I just thought you knew about it already, or it was somehow intentional. This is actually why I had asked above which repo I should be using, git-core:ics or ChainsDD:gc-ics. Your branch is missing this small block from line 128 in the get_parent_env function in su.c
which fixes my 'su 1000' bug. |
Fixes a bug reported in a comment to the issue #9 against su-binary (see #9 (comment) for details). Thanks to Erik Pilsits ([email protected]) for the report. Add the euid change before populate_environment() anticipating we have to merge the commit "Inherit LD_LIBRARY_PATH ...", which needs root credentials in order to successfully open /proc/<ppid>/environ.
But in the end has the issue described in #6 been fixed or not? |
You could check yourself, could you? |
I see the fix, thanx. |
So I got this built last night to fix the ICS segmentation fault error and I had a few questions, if you don't mind.
When compiled, this binary is about 150K, versus about 20K for the master branch. Any idea why? I built both and the make files look the same.
It seems your gc branch is the most up to date, but does not include the segmentation fault / environment fix. Is there a plan to merge that or release a fixed su binary into the wild soon?
Thanks!
The text was updated successfully, but these errors were encountered: