From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4697 Path: news.gmane.org!not-for-mail From: John Mudd Newsgroups: gmane.linux.lib.musl.general Subject: Re: Build on linux 2.6 and run on linux 2.4? Date: Fri, 21 Mar 2014 13:54:34 -0400 Message-ID: References: <20140320231412.GG26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e011772015fad6204f521959d X-Trace: ger.gmane.org 1395424500 20044 80.91.229.3 (21 Mar 2014 17:55:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2014 17:55:00 +0000 (UTC) Cc: musl To: Rich Felker Original-X-From: musl-return-4701-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 21 18:55:08 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WR3et-0001tj-QJ for gllmg-musl@plane.gmane.org; Fri, 21 Mar 2014 18:55:07 +0100 Original-Received: (qmail 23644 invoked by uid 550); 21 Mar 2014 17:55:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 23636 invoked from network); 21 Mar 2014 17:55:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=82UI1oahGE2kHvHM9p/BvjDyxmBNDM7XONA0OoZorM8=; b=I0qEWKnqNqO5llQlF2QDZG5PxFsNEVX4lX0Uss6F2RmUnJT4QWmO2WmcgsA/XPd4lt 1HRCUKHaSROZ1cp4Q6In6raz1S5d/aW7n5O/KhMjwU9BLS608gr2kySOHUxesB5c35k4 t5wsb7rxixFgEB8NVNEbqlN9Mf2LvDWocFl7Cd0vgC27yWyim/q9js42BXP5qTrJ5TTP F/p0R3F4ug/z0ZT5cgWh1p7BIvE+GL4fBQqrayRso/QFpCFTOJ8NGEOX7DcY+f2lvq0r 4TCB3TPqW7jVNsog/wIYc/Xco04qru6RWiGQpT+DpR9b6S7yAokYguxqVQ/pmDmfPeEo VCPQ== X-Received: by 10.152.170.137 with SMTP id am9mr35086281lac.15.1395424495641; Fri, 21 Mar 2014 10:54:55 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:4697 Archived-At: --089e011772015fad6204f521959d Content-Type: text/plain; charset=ISO-8859-1 Here is the regular and strace output on 2.4 kernel, more specifically Linux 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686 i386 GNU/Linux. $ test_threads2 Counter value functionCount1: 1 Counter value functionCount1: 2 Counter value functionCount1: 3 Counter value functionCount2: 4 Counter value functionCount2: 5 Counter value functionCount2: 6 Counter value functionCount2: 7 Counter value functionCount1: 8 Counter value functionCount1: 9 Counter value functionCount1: 10 Final count: 10 $ $ strace test_threads2 execve("/home/jmudd/test_threads2", ["test_threads2"], [/* 26 vars */]) = 0 rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0 set_thread_area({entry_number:-1 -> 6, base_addr:0x804e540, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 set_tid_address(0x804e558) = 25884 mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75ea000 mprotect(0xb75eb000, 86016, PROT_READ|PROT_WRITE) = 0 clone(child_stack=0xb75fff30, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=0xb75fff58, {entry_number:6, base_addr:0xb75fff40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb75fff58) = 25885 mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75d4000 mprotect(0xb75d5000, 86016, PROT_READ|PROT_WRITE) = 0 clone(child_stack=0xb75e9f30, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=0xb75e9f58, {entry_number:6, base_addr:0xb75e9f40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb75e9f58) = 25886 futex(0xb75fff58, FUTEX_WAIT, 25885, NULLCounter value functionCount1: 1 Counter value functionCount1: 2 Counter value functionCount1: 3 Counter value functionCount2: 4 Counter value functionCount2: 5 Counter value functionCount2: 6 Counter value functionCount2: 7 Counter value functionCount1: 8 Counter value functionCount1: 9 Counter value functionCount1: 10 ) = 0 munmap(0xb75ea000, 90112) = 0 munmap(0xb75d4000, 90112) = 0 writev(1, [{"Final count: 10", 15}, {"\n", 1}], 2Final count: 10 ) = 16 exit_group(0) = ? $ > On Fri, Mar 21, 2014 at 9:02 AM, John Mudd wrote: > Thanks for your reply. > > I ran a test using an example thread app. I compiled the cond1.c example > from http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.htmlusing musl-gcc on Ubuntu 13.04, 2.6 kernel obviously. The executable runs > on 2.6 as well as 2.4. I actually expected some kind of failure on 2.4. Did > I pick a poor example or am I not understanding still? > > > On Thu, Mar 20, 2014 at 7:14 PM, Rich Felker wrote: > >> On Thu, Mar 20, 2014 at 04:58:49PM -0400, John Mudd wrote: >> > Probably a dumb question. Is part of the value of musl that I can build >> an >> > app using musl on linux 2.6 and then run the binary on linux 2.4? >> >> The version of Linux you build on has no bearing on the binary that >> comes out, so that's not a problem. >> >> However, Linux 2.4 is not officially supported since it lacks a lot of >> functionality needed to provide a modern POSIX conforming environment. >> The most notable is that it can't do threads. If you're ok with that, >> the other problems might be small enough that you don't mind. I >> remember some people in Freenode #musl trying out 2.4 recently and >> finding that a few of the busybox applets didn't work right, though, >> due to missing statfs64 syscall. >> >> This page has details on which kernel versions added which syscalls: >> >> http://man7.org/linux/man-pages/man2/syscalls.2.html >> >> so it may be helpful in evaluating if there's anything critical you'd >> be missing. If a syscall has two versions, one with "64" on the end, >> musl needs the one that ends in "64". >> >> This is definitely a topic we could attempt to document better if more >> people are interested in trying to use 2.4. >> >> Rich >> > > --089e011772015fad6204f521959d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Here is the regular and strace output on 2.4 kernel, m= ore specifically Linux 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686= i386 GNU/Linux.

$ test_threads2
Counter = value functionCount1: 1
Counter value functionCount1: 2
Counter value functionCount1= : 3
Counter value functionCount2: 4
Counter value funct= ionCount2: 5
Counter value functionCount2: 6
Counter va= lue functionCount2: 7
Counter value functionCount1: 8
Counter value functionCount1= : 9
Counter value functionCount1: 10
Final count: 10
$

$ strace test_threads2
execve("/home/jmudd/test_threads2", ["test_threads2&quo= t;], [/* 26 vars */]) =3D 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_= 2], NULL, 8) =3D 0
set_thread_area({entry_number:-1 -> 6, base= _addr:0x804e540, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, = limit_in_pages:1, seg_not_present:0, useable:1}) =3D 0
set_tid_address(0x804e558) =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D 25884
<= div>mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =3D 0xb= 75ea000
mprotect(0xb75eb000, 86016, PROT_READ|PROT_WRITE) =3D 0
clone(child_stack=3D0xb75fff30, flags=3DCLONE_VM|CLONE_FS|CLONE_FI= LES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETT= ID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=3D0xb75fff58, {entry_= number:6, base_addr:0xb75fff40, limit:1048575, seg_32bit:1, contents:0, rea= d_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidpt= r=3D0xb75fff58) =3D 25885
mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =3D 0x= b75d4000
mprotect(0xb75d5000, 86016, PROT_READ|PROT_WRITE) =3D 0<= /div>
clone(child_stack=3D0xb75e9f30, flags=3DCLONE_VM|CLONE_FS|CLONE_F= ILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SET= TID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=3D0xb75e9f58, {entry= _number:6, base_addr:0xb75e9f40, limit:1048575, seg_32bit:1, contents:0, re= ad_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidp= tr=3D0xb75e9f58) =3D 25886
futex(0xb75fff58, FUTEX_WAIT, 25885, NULLCounter value functionCount1:= 1
Counter value functionCount1: 2
Counter value functi= onCount1: 3
Counter value functionCount2: 4
Counter val= ue functionCount2: 5
Counter value functionCount2: 6
Counter value functionCount2= : 7
Counter value functionCount1: 8
Counter value funct= ionCount1: 9
Counter value functionCount1: 10
) =3D 0
munmap(0xb75ea000, 90112) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D 0
= munmap(0xb75d4000, 90112) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D 0
write= v(1, [{"Final count: 10", 15}, {"\n", 1}], 2Final count= : 10
) =3D 16
exit_group(0) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D ?
$=A0




On Fri, Mar 21, 2014 at 9:02 AM, John Mudd <johnbmud= d@gmail.com> wrote:
Thanks for your reply.

I ran a test using an example thread app. I compiled the=A0cond1.c example = from=A0http://www.yolinux.com/TUTORIALS/LinuxTutorialPos= ixThreads.html using musl-gcc on Ubuntu 13.04, 2.6 kernel obviously. Th= e executable runs on 2.6 as well as 2.4. I actually expected some kind of f= ailure on 2.4. Did I pick a poor example or am I not understanding still?


=
On Thu, Mar 20, 2014 at 7:14 PM, Rich Felker <d= alias@aerifal.cx> wrote:
On Thu, Mar 20, 2014 at 04:58:49PM -0400, John Mudd w= rote:
> Probably a dumb question. Is part of the value of musl that I can buil= d an
> app using musl on linux 2.6 and then run the binary on linux 2.4?

The version of Linux you build on has no bearing on the binary that comes out, so that's not a problem.

However, Linux 2.4 is not officially supported since it lacks a lot of
functionality needed to provide a modern POSIX conforming environment.
The most notable is that it can't do threads. If you're ok with tha= t,
the other problems might be small enough that you don't mind. I
remember some people in Freenode #musl trying out 2.4 recently and
finding that a few of the busybox applets didn't work right, though, due to missing statfs64 syscall.

This page has details on which kernel versions added which syscalls:

http://man7.org/linux/man-pages/man2/syscalls.2.html

so it may be helpful in evaluating if there's anything critical you'= ;d
be missing. If a syscall has two versions, one with "64" on the e= nd,
musl needs the one that ends in "64".

This is definitely a topic we could attempt to document better if more
people are interested in trying to use 2.4.

Rich


--089e011772015fad6204f521959d--