[Python-bugs-list] [Bug #110672] pythonlib.a makes SIGSEGV with LD_PRELOAD variable (PR#378)

noreply@sourceforge.net noreply@sourceforge.net
Thu, 3 Aug 2000 08:20:52 -0700


Bug #110672, was updated on 2000-Jul-31 14:12
Here is a current snapshot of the bug.

Project: Python
Category: Modules
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 5
Summary: pythonlib.a makes SIGSEGV with LD_PRELOAD variable (PR#378)

Details: Jitterbug-Id: 378
Submitted-By: epx@conectiva.com
Date: Fri, 30 Jun 2000 16:10:23 -0400 (EDT)
Version: 1.5.2
OS: Linux glibc 2.1.3 kernel 2.2.16


Modules/posixmodule,c, function convertenviron(), uses a dirty trick when
parsing POSIX environment variables. All variables are formatted as

<variable>=<value>
Example: KDEDIR=/usr

Python changes '=' to '\0' for a moment while parsing, in the line

*p = '\0'

But, if LD_PRELOAD variable is present, it SIGSEGVs in this command. I guess
this variable is in a mprotect()ed page for security reasons. The environment
variable parser should strdup() the variables or change the parsing algorithm so
it no longer writes directly the environment var. array.




====================================================================
Audit trail:
Tue Jul 11 08:24:21 2000	guido	moved from incoming to open

Follow-Ups:

Date: 2000-Aug-03 08:20
By: twouters

Comment:
Fixed by revision 2.113 of posixmodule.c, checked in by Guido. Code now uses PyString_FromStringAndSize to 'substring' the environment variables, rather than writing \0's in them.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110672&group_id=5470