Board index » kylix » Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1


2004-09-23 07:31:40 PM
kylix2
As reported in this newsgroup, applications built with Kylix crash
when executed on Linux installations running Kernel 2.6.8.1. This is currently
the case with Red Hat Fedora Core 2, but probably soon other Linux distributions
also will be affected.
Kernel 2.6.8 introduced an improved exec-shield, which prevents execution of code
in memory pages not marked for execution. This works on all x86 machines, not only
the new AMD64 CPUs that have the NX bit.
Sadly the Kylix compiler doesn't mark a section of the ELF file as executable,
which has code that is executed at runtime. This will cause a segmentation fault.
As a first step, I've now written a tool which will fix Kylix applications to have
the missing execution flag in the ELF section headers. This tool should work for
all Kylix build applications and shared objects.
It's a command line tool available for both Windows and Linux (so you can also
do the patching on a Windows machine), Source is included.
See this page for more detailed information:
crosskylix.untergrund.net/patchelf.html
Next step will be to try to create an RTL patch that marks the loaded section
as executable in memory. This way you won't have manually fix your ELF files
after each build anymore.
Simon Kissel
 
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Follow-up to myself:
Quote
As reported in this newsgroup, applications built with Kylix crash
when executed on Linux installations running Kernel 2.6.8.1. This is currently
the case with Red Hat Fedora Core 2, but probably soon other Linux distributions
also will be affected.
This is not entirely correct. Only 2.6.8 Kernels including exec-shield are affected.
Simon
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Simon,
Great job! This is definitely much improved over the previous solution.
We're now happily distributing this fix for our linux customers on FC2.
Thanks!
"Simon Kissel" < XXXX@XXXXX.COM >wrote in message
As reported in this newsgroup, applications built with Kylix crash
when executed on Linux installations running Kernel 2.6.8.1. This is
currently
the case with Red Hat Fedora Core 2, but probably soon other Linux
distributions
also will be affected.
Kernel 2.6.8 introduced an improved exec-shield, which prevents execution of
code
in memory pages not marked for execution. This works on all x86 machines,
not only
the new AMD64 CPUs that have the NX bit.
Sadly the Kylix compiler doesn't mark a section of the ELF file as
executable,
which has code that is executed at runtime. This will cause a segmentation
fault.
As a first step, I've now written a tool which will fix Kylix applications
to have
the missing execution flag in the ELF section headers. This tool should work
for
all Kylix build applications and shared objects.
It's a command line tool available for both Windows and Linux (so you can
also
do the patching on a Windows machine), Source is included.
See this page for more detailed information:
crosskylix.untergrund.net/patchelf.html
Next step will be to try to create an RTL patch that marks the loaded
section
as executable in memory. This way you won't have manually fix your ELF files
after each build anymore.
Simon Kissel
 

{smallsort}

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Simon Kissel wrote:
Quote
As reported in this newsgroup, applications built with Kylix crash
when executed on Linux installations running Kernel 2.6.8.1. This is currently
the case with Red Hat Fedora Core 2, but probably soon other Linux distributions
also will be affected.

Kernel 2.6.8 introduced an improved exec-shield, which prevents execution of code
in memory pages not marked for execution. This works on all x86 machines, not only
the new AMD64 CPUs that have the NX bit.

Sadly the Kylix compiler doesn't mark a section of the ELF file as executable,
which has code that is executed at runtime. This will cause a segmentation fault.

As a first step, I've now written a tool which will fix Kylix applications to have
the missing execution flag in the ELF section headers. This tool should work for
all Kylix build applications and shared objects.

It's a command line tool available for both Windows and Linux (so you can also
do the patching on a Windows machine), Source is included.

See this page for more detailed information:

crosskylix.untergrund.net/patchelf.html

Next step will be to try to create an RTL patch that marks the loaded section
as executable in memory. This way you won't have manually fix your ELF files
after each build anymore.

Simon Kissel
That's a great fix. I'm sure there are many happy Kylix3 - Fedora Core 2 users tonight. I
hope you're staying up late at night working on that RTL patch!
Corwin
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Cool! Thanks!
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

On 09/23/2004 08:40 PM +0900, Simon Kissel wrote:
Quote
Follow-up to myself:

>As reported in this newsgroup, applications built with Kylix crash
>when executed on Linux installations running Kernel 2.6.8.1. This is currently
>the case with Red Hat Fedora Core 2, but probably soon other Linux distributions
>also will be affected.

This is not entirely correct. Only 2.6.8 Kernels including exec-shield are affected.
Thanks very much for this patch! I've already used patchelf to offer a
maintenance release for BOINCprog.
Cheers!
trane
--
//------------------------------------------------------------
// Trane Francks XXXX@XXXXX.COM Tokyo, Japan
// Practice random kindness and senseless acts of beauty.
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Quote
>crosskylix.untergrund.net/patchelf.html
>
>Next step will be to try to create an RTL patch that marks the loaded section
>as executable in memory. This way you won't have manually fix your ELF files
>after each build anymore.
>
>Simon Kissel

That's a great fix. I'm sure there are many happy Kylix3 - Fedora Core 2 users tonight. I
hope you're staying up late at night working on that RTL patch!
Well, it took a few days to find how to do it, and I also had quite some other (commercial)
work to do. But well, here you go... :)
Simon
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Simon,
Thanks so much for this information. I recently updated my web server to
2.6.8.1 and my CGIs refused to load, strangely Kylix DSO did continue to
work.
I thought it was some kind of bug with the Kernal and Apache.
When are we going to see some improvements to Kylix via the Kylix Community
Project?
T
Simon Kissel wrote:
Quote
As reported in this newsgroup, applications built with Kylix crash
when executed on Linux installations running Kernel 2.6.8.1.
 

Re:Attention Kylix-Users - Kylix-built applications crash on Kernel 2.6.8.1

Quote
Simon,
Thanks so much for this information.
You're welcome.
Quote
When are we going to see some improvements to Kylix via the Kylix Community
Project?
It's pretty active, but I expect it to take some time until we'll see first
results coming out of it.
Simon