Languages

Menu
Sites
Language
[ANSWERED] Uploading and running a test binary using sdb, possible?

Hi,

I know I can upload and download files using sdb. But is it possible to upload a test binary to the device, and run it from "sdb shell"? I have tried to do this, and upload the binary (to /tmp - that the reasonable place to try), and even after chmod +x and checking the permissions are correct, the binary still won't run, not even under sdb shell.

Is this possible at all under Tizen (perhaps I choose the wrong directory? Perhaps it should be somewhere else, not in /tmp)? Or this is strictly forbidden an everything has to be uploaded under the auspices of a TPK? Inquiring mind wants to know.

PS: I have tried uploading a static binary, a shared binary, all results are the same. I know that Tizen implements SELinux and stuff but I'm not very clear on its policies of what are and aren't allowed.

Thank you.

PS: Platform: Tizen 2.3.2, Device: Gear S3.

Edited by: James B on 21 Feb, 2017
View Selected Answer

Responses

10 Replies
Peter Wegner

Good question...

 

I think this is little Security thingie...

With rooted device less problem... simple copy to "correct" folder...

 

Ehm for instance I made some experiments in:

/usr/bin

 

But with commercial device and non rooted...

You have no really permissions to execute something... also no scripts *.sh

 

Correct me. if I am totally wrong.

:)

 

Best Regards

James B

Yeah, I know.

It makes testing or debugging any programs that built outside Tizen CLI/IDE very difficult (e.g. https://developer.tizen.org/forums/native-application-development/closed-building-open-source-library-uses-autoconf. I'm hoping there is a way around it, because most people cannot get a Development Version of Gear S3, for example? :(

Anyway I'm accessing it from "sdb", which has a very limited context already, not from a random remote shell.

To think that the underlying frameworks of Tizen are all Free Software and open platforms (Linux, glibc, gcc, glib, libcurl, etc) ...

Anyway, enough rant. If anybody has any useful information, I'm all ears. Thanks.

Mark as answer
Peter Wegner

In theory it is not impossible to root SM-R760 etc...

 

Or you can try to find path... from where it is possible to execute... without Smack blabla Security...

Maybe:

/home/developer/usr/bin

or

/home/developer/bin or something in this direction...

 

whoami Command shows you, you are Developer user...

apps should be app user

 

You could study source code...

http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=SM-R760

 

Check RPM file:

coreutils-6.9.rpm

 

Here is for instance su Binary inside...

 

Best Regards

 

James B

Thanks Peter !!!

/home/developer is the correct location. Why didn't I think of that :) I uploaded it there, and it works straight away!

Thanks for the link too. I'm downloading it, it's 975MB, too small for the entire Tizen OS, but we'll see what's inside when I'm done.

On another note - so Tizen uses Smack? I thought it uses SELinux.

Onur Şahin

Sorry for bargin in into the thread and correct me if I'm wrong but isn't just pushing su binary pointless? I mean su works based on SUID bit (aka. setuid). If you push su binary as any other user than root it simply won't work. Rooting process is usually like;

1)find an exploit to gain root rights,

2)push su binary,

3)set suid for su binary, so you won't have to use that exploit everytime.

 

Again, correct me If i'm wrong.

James B

Hi Onur you're right, of course.

As I understand Peter was suggesting to check the su source to find location where we are allowed to run binaries - if indeed such locations exist and are recorded inside su. Turns out this is unnecessary because his original suggestion of /home/developer does work.

As for rooting, I'm not trying to root device, nor do I want to create a root-only application. I was just trying to get my test binary to work.

cheers!

Peter Wegner

Hello Onur Şahin.

I am not sure what exactly... but in case of ROOT.

I was able to root Z-series... found solution 2 years ago and successfully tested with:

SM-Z130H

SM-Z300H

SM-Z200F

SM-Z300F

su Binary/file was ever the same... and method...

Find Firmware package for Odin... extract TAR... ---> rootfs.img

Mount rootfs.img in any Linux device you have...

For instance my first device was GT-I9300 to create rootfs.img for SM-Z130H

Push su into bin folder...

Create valid TAR for Odin with modified rootfs.img and flash to device.

----------------

Bad, I've tried this method now with Gear S3... SM-R760...

And failed...

Not me but my friendly user with his device...

Result is Bootloop... and he seems not be able to enter "Download Mode"... so bricked at the moment.

:( :(

I am not sure what happens exactly... if Gear require more then rootfs.img for flashing or I made mistake... or Knox or...

:(

su Binary was taken from leaked Combination file...

 

Only as info about my knowledge about root...

 

Best Regards

Onur Şahin

Yea, I thought you were saying by pushing su into some directory we could gain root. Which is not the case, sorry for misunderstanding.

I've read the topic at XDA, sorry for tids2k's gear s3, hope you guys find a way to un-brick it and I really would like to see android wear on gear so good luck at rooting.

Peter Wegner

Ehm, Smack was only Security example...

 

As it seems Knox Security is low in Tizen devices...

I have no idea of all names of Security stuff inside Tizen device...

IMHO toooooo much security against fun.

:)

 

Best Regards

James B

Well I got the source and there was a Smack source but not SELinux, so I suppose you're right ;) Knox is coming to Tizen devices, but since it's Samsung proprietary I don't think it will be available on non-Samsung devices. And yes, of course, I agree, security is important but too much security against devs are no fun.

 

As for rooting, somebody did root Gear S2 and put Android on it ... someone on XDA wrote about it.

 

cheers!