🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3475

Re: how to prevent prevent .so-calling routine to crash from segfaults in .so

#3475
From: Nabeel Shaheen
Date: Wed, 09 Jul 2003 20:23
54 lines
3148 bytes
Neil Horman <nhorman@lvl7.com> wrote in message news:<4UTOa.1513$zJ6.1404@fe02.atl2.webusenet.com>...
> Nabeel Shaheen wrote:
> > Hi,
> > 
> > Guys I am stuck with a problem and need some help.
> > 
> > Platform     : Linux(RedHat 7.3)
> > Problem Area : Dynamic Shared Object Libraries, POSIX Threads
> > glibc        : 2.96
> > 
> > Problem:
> > =======
> > The Scenario is such that I have made a module which call a .so file
> > in a new thread and executes it. The .so file has to be provided by
> > the end-user and if that .so gives any runtime-error(SEGFAULTS), the
> > whole process terminates i.e. all the threads executing .so files and
> > more importantly my .so-calling module, which I dont want to be
> > terminated.
> > 
> > so ***IS THERE ANY WAY THAT MY SO-CALLING MODULE DOES NOT TERMINATE
> > DUE TO SOME SEGFAULTS IN A .SO FILE WRITTEN BY THE END-USER OF MY
> > MODULE?***.
> > 
> > Any relevant comment will be appreciated.
> > 
> > Best Regards,
> > 
> > Nabeel Shaheen
> > Sir Syed Research Labs
> > nabsha[at]UNIssuet.edu.pk (remove capitals)
> 
> How about instead of creating a new thread, you re-architect your 
> program to fork a child process to interact with the user supplied 
> shared library?  That way, if the .so file causes a segfault, the child 
> will terminate, but the parent can detect the unclean exit, and inform 
> the user, without needing to shut the whole program down.
> HTH
> Neil

Hi Guys,

Thanx a lot for ur valueable suggestion/information. 

I think Neil is right and therefore am restructuring the application
as this seems to be the only legal way out of this hazardous
environment.

Thanx again for your comments

Best Regards,

Nabeel Shaheen
Sir Syed Research Labs
nabsha[at]UNIssuet.edu.pk (remove capitals)
Technical Details
Message-ID: <5a41f079.0307091223.4753aebb@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
References: <5a41f079.0307090324.3822c1bb@posting.google.com> <4UTOa.1513$zJ6.1404@fe02.atl2.webusenet.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,e85a8f2945e25a1
X-Google-Attributes: gid11318c,public
X-Google-Thread: 10c696,e85a8f2945e25a1
X-Google-Attributes: gid10c696,public
X-Google-Thread: fc89c,e85a8f2945e25a1
X-Google-Attributes: gidfc89c,public
X-Google-Thread: f65d0,e85a8f2945e25a1
X-Google-Attributes: gidf65d0,public
X-Google-Thread: 107b38,e85a8f2945e25a1
X-Google-Attributes: gid107b38,public
X-Google-ArrivalTime: 2003-07-09 13:23:23 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: sonicshaheen@yahoo.com (Nabeel Shaheen)
Newsgroups: comp.unix.programmer,gnu.gcc.help,gnu.gcc,comp.os.linux.redhat,comp.os.linux.development.apps
Subject: Re: how to prevent prevent .so-calling routine to crash from segfaults in .so
Date: 9 Jul 2003 13:23:23 -0700
Organization: http://groups.google.com/
Lines: 54
Message-ID: <5a41f079.0307091223.4753aebb@posting.google.com>
References: <5a41f079.0307090324.3822c1bb@posting.google.com> <4UTOa.1513$zJ6.1404@fe02.atl2.webusenet.com>
NNTP-Posting-Host: 62.145.82.6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1057782203 4189 127.0.0.1 (9 Jul 2003 20:23:23 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 9 Jul 2003 20:23:23 GMT