Re: [oi-dev] GSOC2011
On Mon, Mar 21, 2011 at 12:55 PM, Andrew Gabriel illu...@cucumber.demon.co.uk wrote: Cyril Plisko wrote: On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov kere...@solaris.kirov.ru wrote: Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. Instead of [destructively] change the Linux binary in order to run it under Solaris, wouldn't it be better to do the job on the fly via dynamic linker ? Linux binaries conveniently use /lib/ld-linux.so.1 (as opposed to /lib/ld.so.1 for Solaris). So one would imaging that if you will provide a /lib/ld-linux.so.1 that knows how to fix the relocations that would get you what you need, w/o touch the binaries. Does it make sense ? Might want to look back at any info which still exists on lxrun which worked in a not dissimilar way, and also see if there's any info about Sun's Solaris 10 Janus project still knocking around (which may be useful even though you are not proposing the same route). lxrun still works for older Linux binaries, but it used the rather ugly method of userspace syscall emulation by trapping SIGSEGV. Applications receive this signal when they cause a general protection fault by making an invalid system call using the traditional i386 INT 0x80 (the syscall vectors used by Linux happen to be unused on Solaris). I'm not sure what happens when applications try to use SYSENTER instead. BrandZ just implemented the Linux system calls instead, which works well, but obviously requires extensive kernel support. While we can bring it back into illumos fairly easily, it is still incomplete and also suffers from the fact that Linux has had some changes in the time it's gone unmaintained. Modern Linux applications as they do not embed system calls in their executables [1], so we do not have to perform syscall translation if we don't want to. They expect a code segment containing functions with stable interfaces to be mapped when they are run, and use those functions to perform syscalls. On Linux this segment is actually provided by the kernel (as a sort of virtual library named linux-gate.so.1) and this allows the syscall implementations to be replaced easily [2]. illumos can provide this functionality as a real library or in the dynamic loader. If we want Linux executables to load native shared libraries (which would be really really cool), the dynamic loader would also need to support redirecting Linux application libc calls to GNU libc or wrappers around the native libc to handle interface and structure differences. Your suggestion to modify Linux executables on disk is an interesting one (reminds me of a similar but far too ambitious project for Win32 executables) and I'd like to hear more. I have investigated the options here (actually started some work on a modified dynamic loader that lives at ld-linux.so.2) and would be happy assist you. BTW, develo...@lists.illumos.org is better for future discussion, and I have CC'ed it. [1] Some exceptions exist in closed software, often intended to discourage reverse engineering. [2] See the description of __kernel_vsyscall here: http://articles.manugarg.com/systemcallinlinux2_6.html -Albert ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. 2011/3/21 Deano de...@rattie.demon.co.uk Hi Andrey, We would more than happy to work with you and receive your proposal to work on this item. There are several possible approaches to this problem, do you have any thoughts about which you’d like to take? Thanks for your interest, Deano *From:* Andrey Sokolov [mailto:kere...@solaris.kirov.ru] *Sent:* 21 March 2011 10:01 *To:* oi-dev@openindiana.org *Subject:* [oi-dev] GSOC2011 I'd like to participate in Linux binary support without zones project. Is it possible? ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
Hi Andrey, That look very interesting, A mentor who knows much more about this topic (I don't I'm afraid) will be I'm sure in touch soon J Thanks, Deano From: Andrey Sokolov [mailto:kere...@solaris.kirov.ru] Sent: 21 March 2011 11:55 To: OpenIndiana Developer mailing list Subject: Re: [oi-dev] GSOC2011 Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. 2011/3/21 Deano de...@rattie.demon.co.uk Hi Andrey, We would more than happy to work with you and receive your proposal to work on this item. There are several possible approaches to this problem, do you have any thoughts about which you'd like to take? Thanks for your interest, Deano From: Andrey Sokolov [mailto:kere...@solaris.kirov.ru] Sent: 21 March 2011 10:01 To: oi-dev@openindiana.org Subject: [oi-dev] GSOC2011 I'd like to participate in Linux binary support without zones project. Is it possible? ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
On 03/21/11 12:54 PM, Andrey Sokolov wrote: Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. I'd like to participate in Linux binary support without zones project. Is it possible? It seems to me like an Illumos.org project. There are Linux branded zones and that project is stalled it might be interesting to renew it. If it is a proposed project as a new program/application or system service then it might be good making a project page on openindiana.org and start from there. Does your idea could work on x86 only or it can be done for Linux binaries on SPARC, too? ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
On 03/21/11 02:53 PM, Nikola M. wrote: On 03/21/11 12:54 PM, Andrey Sokolov wrote: Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. Sorry all, It was OI-Dev thread. ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov kere...@solaris.kirov.ru wrote: Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. Instead of [destructively] change the Linux binary in order to run it under Solaris, wouldn't it be better to do the job on the fly via dynamic linker ? Linux binaries conveniently use /lib/ld-linux.so.1 (as opposed to /lib/ld.so.1 for Solaris). So one would imaging that if you will provide a /lib/ld-linux.so.1 that knows how to fix the relocations that would get you what you need, w/o touch the binaries. Does it make sense ? -- Regards, Cyril ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
On Mon, 2011-03-21 at 13:00 +0300, Andrey Sokolov wrote: I'd like to participate in Linux binary support without zones project. Is it possible? ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev Yes. I've thought a bit about this problem, and recommend we have a chat at some point. I'd recommend you start by filling out those parts of the application template that you can already do, and then lets take some time to talk further. - Garrett ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
On Mon, 2011-03-21 at 16:16 +0200, Cyril Plisko wrote: On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov kere...@solaris.kirov.ru wrote: Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. Instead of [destructively] change the Linux binary in order to run it under Solaris, wouldn't it be better to do the job on the fly via dynamic linker ? Linux binaries conveniently use /lib/ld-linux.so.1 (as opposed to /lib/ld.so.1 for Solaris). So one would imaging that if you will provide a /lib/ld-linux.so.1 that knows how to fix the relocations that would get you what you need, w/o touch the binaries. Does it make sense ? This was pretty much my idea on the topic. There may be a need for a system call translation as well. Still, I think the *first* attempt should stick to library interfaces, and as much as possible reuse the lib interfaces we already have. There are likely some interfaces that will need work to make them function in a more linux friendly fashion. In a world where we had truly achieved success here, it would be possible to run, e.g. skype, without having to resort to branded zones. (Admittedly skype is a hard program to support, but it's a particular itch I want to see scratched. :-) - Garrett ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev
Re: [oi-dev] GSOC2011
Cyril Plisko wrote: On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov kere...@solaris.kirov.ru wrote: Hi Deano, I would like to write a program that will convert linux binaries to opensolaris binaries. The program will change dynamic relocation records. I did a little experiment: http://forum.os-solaris.ru/index.php?topic=223.0 I have converted a simple linux binary to opensolaris binary using hex editor. Instead of [destructively] change the Linux binary in order to run it under Solaris, wouldn't it be better to do the job on the fly via dynamic linker ? Linux binaries conveniently use /lib/ld-linux.so.1 (as opposed to /lib/ld.so.1 for Solaris). So one would imaging that if you will provide a /lib/ld-linux.so.1 that knows how to fix the relocations that would get you what you need, w/o touch the binaries. Does it make sense ? Might want to look back at any info which still exists on lxrun which worked in a not dissimilar way, and also see if there's any info about Sun's Solaris 10 Janus project still knocking around (which may be useful even though you are not proposing the same route). -- Andrew ___ oi-dev mailing list oi-dev@openindiana.org http://openindiana.org/mailman/listinfo/oi-dev