Andrey Sokolov | 21 Mar 11:00 2011
Picon

GSOC2011

I'd like to participate in "Linux binary support without zones" project. Is it possible?
_______________________________________________
oi-dev mailing list
oi-dev <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev
Deano | 21 Mar 12:33 2011
Picon
Picon

Re: GSOC2011

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:keremet <at> solaris.kirov.ru]
Sent: 21 March 2011 10:01
To: oi-dev <at> 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 <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev
Andrey Sokolov | 21 Mar 12:54 2011
Picon

Re: 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 <deano <at> 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:keremet <at> solaris.kirov.ru]
Sent: 21 March 2011 10:01
To: oi-dev <at> 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 <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev


_______________________________________________
oi-dev mailing list
oi-dev <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev
Deano | 21 Mar 14:33 2011
Picon
Picon

Re: 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:keremet <at> 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 <deano <at> 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:keremet <at> solaris.kirov.ru]
Sent: 21 March 2011 10:01
To: oi-dev <at> 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 <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev

 

_______________________________________________
oi-dev mailing list
oi-dev <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev
Nikola M. | 21 Mar 14:53 2011
Picon

Re: 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 <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev
Nikola M. | 21 Mar 14:59 2011
Picon

Re: 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 <at> openindiana.org
http://openindiana.org/mailman/listinfo/oi-dev
Cyril Plisko | 21 Mar 15:16 2011

Re: GSOC2011

On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov
<keremet <at> 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
Garrett D'Amore | 21 Mar 15:38 2011

Re: GSOC2011

On Mon, 2011-03-21 at 16:16 +0200, Cyril Plisko wrote:
> On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov
> <keremet <at> 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
Andrew Gabriel | 21 Mar 17:55 2011
Picon
Picon

Re: GSOC2011

Cyril Plisko wrote:
> On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov
> <keremet <at> 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
Albert Lee | 23 Mar 20:41 2011

Re: GSOC2011

On Mon, Mar 21, 2011 at 12:55 PM, Andrew Gabriel
<illumos <at> cucumber.demon.co.uk> wrote:
> Cyril Plisko wrote:
>>
>> On Mon, Mar 21, 2011 at 1:54 PM, Andrey Sokolov
>> <keremet <at> 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, developer <at> 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
Joerg Schilling | 24 Mar 13:39 2011
Picon

Re: GSOC2011

Albert Lee <trisk <at> opensolaris.org> wrote:

> 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.

LKP exists before BrandZ amd Sun did buy a license from SCO for LKP.

> 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.

Being generally able to run Linux binaries may be a security risk as there are 
plenty of attacks that rely on being able to run Linux binaries.

Sun on the other side did introduce BrandZ instead of LKP in order to avoid 
rnning Linux binariers to become too simple - Sun was in fear that this could 
harm the stand of Solaris.

In general, something like LKP should be nice as it allows e.g. pipes between 
Solaris binaries and Linux binaries. I would however make the general ability 
to run Linux binaries a configurable option. This could be made global via 
/etc/system and process group specific via privileges.

Jörg

--

-- 
 EMail:joerg <at> schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js <at> cs.tu-berlin.de                (uni)  
       joerg.schilling <at> fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
Eric Schrock | 24 Mar 14:05 2011

Re: [oi-dev] GSOC2011



On Thu, Mar 24, 2011 at 8:39 AM, Joerg Schilling <Joerg.Schilling <at> fokus.fraunhofer.de> wrote:

Sun on the other side did introduce BrandZ instead of LKP in order to avoid
rnning Linux binariers to become too simple - Sun was in fear that this could
harm the stand of Solaris.

As a member of the original BrandZ team, I can say for a fact that this is false.  Prior to BrandZ, there was an internal implementation of the next-generation 'lxrun'.  But running binaries is much more than an execution problem.  Binaries rely on all kinds of environmental infrastructure that doesn't exist in Solaris (libraries, /proc, devices, etc).  The more you try to fake this up, the more invasive and brittle the implementation gets (and the previous project was indeed both).  Having a dedicated zone allows you to model the entire environment in a well-defined and supportable fashion.

It was all about maintainability and supportability, and had nothing to do with making it "less simple" or protecting "the stand of Solaris".

- Eric

--
Eric Schrock
Delphix

275 Middlefield Road, Suite 50
Menlo Park, CA 94025

http://www.delphix.com

_______________________________________________
Developer mailing list
Developer <at> lists.illumos.org
http://lists.illumos.org/m/listinfo/developer
Garrett D'Amore | 21 Mar 15:34 2011

Re: 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 <at> 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

Gmane