[M3devel] [pinozollo at gmail.com: Installation Problem]

Tony Hosking hosking at cs.purdue.edu
Wed Apr 18 18:33:06 CEST 2007


Yes, use of setjmp/longjmp for *user*-level threads is bound to fail  
in the presence of the security mangling they now do, since new  
thread contexts are obtained by cloning a setjmp buffer from the root  
thread, and then hacking its stack pointer appropriately to match the  
new thread.  This doesn't work with the secure setjmp/longjmp  
implementations.  On platforms like Linux where setjmp/longjmp  
mangling prevent their use for user-level threading the only  
alternative is to use the explicit makecontext with getcontext/ 
setcontext.  This is how *user*-level threading is done on Solaris.   
With the newer PTHREAD threading (for SOLgnu, SOLsun, LINUXLIBC6,  
I386_DARWIN, PPC_DARWIN) this should not be an issue, but it does  
require NPTL on Linux platforms (I don't think 2.4 kernels support  
NPTL).   I do know that I can successfully build from the current CVS  
tree on recent releases of Fedora Core, without problems.

On Apr 18, 2007, at 12:15 PM, Rodney M. Bates wrote:

> This symptom (works when statically linked, segfaults during  
> startup when
> using dynamic libraries) is, as I remember, the symptom of the  
> problem with
> changes in newer setjmp/longjmp that I posted about on January 11.
>
> The newer setjmp/longjmp mangle and demangle a couple of the registers
> (apparently to prevent some security exploit).  When used as a  
> pair, the
> change is harmless.  But some uses of setjmp in the M3 libraries  
> actually
> use the contents of the setjmp buffer to get register contents for  
> thread
> switching, etc.
>
> There is an assembly-coded special version of setjmp in the M3  
> code, dating
> from many years back, that works with older longjmp, but not with  
> the newest.
> Tony committed a change that removes this version of setjmp. but I  
> don't think
> that fixes all the problems in all cases.

I don't see problems with this change.  What problems are you  
seeing?  In this case, setjmp/longjmp is only being used for  
exception handling, assuming threads are using PTHREAD (i.e., Linux  
NPTL).

>
> I think existing uses of setjmp have to be split into two  
> categories:  those
> that just use the result to pass back to longjmp, and those that  
> use the result
> for fetching registers.  Then different variants of setjmp have to  
> be used in
> the two cases.  Antony suggested getcontext/setcontext, but I guess  
> there are
> portability problems here?
>
> I looked at this briefly, and there are a very large number of uses  
> of setjmp
> to check out.  I have thought about working on it, but have been  
> busy with
> other things for a while.
>
> I never got -DPTHREAD working and ran out of time on that approach.  
> As I recall,
> -DPTHREAD is now the default, so I would guess Pino's installation  
> is using it.
>
> Olaf Wagner wrote:
>> Is this the stack encryption problem again? Has anybody tried on
>> Suse 10.1?
>> Olaf
>> ----- Forwarded message from Pino Zollo <pinozollo at gmail.com> -----
>> DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed;
>>         d=gmail.com; s=beta;
>>         h=domainkey-signature:received:received:message- 
>> id:from:to:subject:date:mime-version:content-type:content-transfer- 
>> encoding:x-priority:x-msmail-priority:x-mailer:x-mimeole;
>>         b=U78B+w8R6V2/ 
>> WUP4jo0Lv4HJ9iGXHjfGLELvNGPtGjJK9Opw1mlxgXFRzGFuvesKInntAGKb4U0ZfiGWQ 
>> MJJ/wEFq0CsNyAhxU6OGNf60yMXqTx825qudBwKtMm/9IqA8K1RCKBYjk0GGVsh/ 
>> U4PrfCQw+NQLqPP2k0Vwncv7Ss=
>> From: Pino Zollo <pinozollo at gmail.com>
>> To: m3-support at elego.de
>> Subject: Installation Problem
>> Date: Tue, 17 Apr 2007 18:00:50 -0400
>> X-Spam-Status: No, score=2.7 required=5.0  
>> tests=DEAR_SOMETHING,RCVD_BY_IP,
>> 	RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS,SPF_PASS autolearn=no 	 
>> version=3.0.3
>> X-Spam-Level: **
>> X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on  
>> plane.elego.de
>> X-Virus-Scanned: ClamAV 0.88.7/3109/Tue Apr 17 05:59:17 2007 on  
>> plane.elego.de
>> X-Virus-Status: Clean
>> Dear Sirs,
>> I have installed the last version of cm3 but I have the following  
>> problem:
>> cm3 compiles all programs, but are correctly executed only the  
>> ones compiled
>> with the option build_standalone().
>> The programs which use shared libraries end in segmentation fault.
>> Also the script do-cm3-std.sh fails to compile everything for the  
>> same
>> problem: the program PklFonts in the directory
>> m3-ui/juno-2/juno-app/pkl-fonts/LINUXLIBC6 ends in segmentation fault
>> because needs shared libraries.
>> Any suggestion ?
>> I am using the distribution SuSE 10.1 with kernel 2.4.27
>> In the installation I have found that the command "export" was not  
>> doing
>> properly its job, so I had to put
>> the path /usr/local/cm3/bin in /etc/profile. For libraries I did  
>> put the
>> path in /etc/ld.so.conf
>> I noticed that executables contain the string "/lib/ld-linux.so.2"  
>> so I had
>> to make a symbolic link in /lib
>> as "ln -s ld-2.4.so ld-linux.so.2" but nothing did change.
>> I have also tried export "LD_POINTER_GUARD=0"  also without any  
>> change.
>> I have done quite a lot on Modula-3 programming years ago when  
>> kernel was
>> 1.2.13. I would like to make public my
>> old sources under the GNU licence. For this reason I am willing to  
>> check
>> them on the new version on m3.
>> I am available for doing development in Modula-3 in the limits of my
>> capabilities.
>> My name is Pino Zollo and my e-mail is  pinozollo at gmail.com
>> Some of my works are on http://www.qsl.net/zp4kfx  and a  
>> description of my
>> profesional experience is on
>> http://www.qsl.net/zp4kfx/CV
>> Thanks for the attencion.
>> Best regards
>>   Pino
>> ----- End forwarded message -----
>
> -- 
> -------------------------------------------------------------
> Rodney M. Bates, retired assistant professor
> Dept. of Computer Science, Wichita State University
> Wichita, KS 67260-0083
> 316-978-3922
> rodney.bates at wichita.edu
> _______________________________________________
> M3devel mailing list
> M3devel at elegosoft.com
> https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel




More information about the M3devel mailing list