[Python-Dev] OpenBSD anyone? (original) (raw)
Guido van Rossum guido at python.org
Mon Dec 22 16:56:40 EST 2003
- Previous message: [Python-Dev] OpenBSD anyone?
- Next message: [Python-Dev] OpenBSD anyone?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
(JD: yes, it's real!)
Script started on Mon Dec 22 15:20:25 2003 hydra /home/kbk/proj/sandbox/pythonclean$ gdb ./python GNU gdb 4.16.1 Copyright 1996 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-openbsd3.3"... (gdb) run -S Starting program: /home/kbk/proj/sandbox/pythonclean/./python -S
Program received signal SIGSEGV, Segmentation fault. 0x401900a0 in strchr () (gdb) bt #0 0x401900a0 in strchr () #1 0x1d11d in loadnext (mod=0x10905c, altmod=0x10905c, pname=0xcfbfd640, buf=0xcfbfd230 "builtin", pbuflen=0xcfbfd22c) at Python/import.c:2004 #2 0x1cc40 in importmoduleex (name=0x19786 "builtin", globals=0x0, locals=0x0, fromlist=0x0) at Python/import.c:1888 #3 0x1ce29 in PyImportImportModuleEx (name=0x19786 "builtin", globals=0x0, locals=0x0, fromlist=0x0) at Python/import.c:1922 #4 0x1dfe9 in PyImportImport (modulename=0x115598) at Python/import.c:2333 #5 0x1caec in PyImportImportModule (name=0xb895e "builtin") at Python/import.c:1853 #6 0xb8b3d in PyExcInit () at Python/exceptions.c:1755 #7 0x25ad4 in PyInitialize () at Python/pythonrun.c:205 #8 0x282f in PyMain (argc=2, argv=0xcfbfd82c) at Modules/main.c:376 #9 0x17e3 in main (argc=2, argv=0xcfbfd82c) at Modules/python.c:23 (gdb) q The program is running. Quit anyway (and kill it)? (y or n) y hydra /home/kbk/proj/sandbox/pythonclean$ Script done on Mon Dec 22 15:21:06 2003
Same result w/o -S ============================================================= Slightly later: (gdb) b import.c:2004 Breakpoint 1 at 0x1d10f: file Python/import.c, line 2004. (gdb) r Starting program: /home/kbk/proj/sandbox/pythonclean/./python Breakpoint 1, loadnext (mod=0xe98ec, altmod=0xe98ec, pname=0xcfbfd88c, buf=0xcfbfd47c "", pbuflen=0xcfbfd478) at Python/import.c:2004 2004 char *dot = strchr(name, '.'); (gdb) p *pname $1 = 0x19786 "builtin" (gdb) p name $2 = 0x19786 "builtin" (gdb) p strchr(name, '.') Program received signal SIGSEGV, Segmentation fault. OTOH, if I break at 2004 and then step once, I get by the strchr call OK. Also if I stepi through it. If I continue, it segfaults at the next execution of line 2004. Weird. Investigating.
The most likely cause then is some kind of bug in the platform's strchr(). This could explain why -O3 fixes the issue: I think I've heard of GCC replacing calls to strchr(), strcpy() etc. with inline code, thereby avoiding the buggy library version (and explaining why the buggy code could persist undetected in the library -- most system code is of course compiled fully optimized).
As to why stepi doesn't trigger the segfault: possibly it's a timing bug that doesn't occur when run one instruction at a time. This would even make it CPU dependent, which would explain that some folks didn't see this. I don't have the OpenBSD strchr.c source code online here so I'll stop speculating here...
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] OpenBSD anyone?
- Next message: [Python-Dev] OpenBSD anyone?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]