Issue 10309: dlmalloc.c needs _GNU_SOURCE for mremap() (original) (raw)

Issue10309

Created on 2010-11-04 11:43 by hfuru, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg120391 - (view) Author: Hallvard B Furuseth (hfuru) Date: 2010-11-04 11:43
dlmalloc uses mremap() which is undeclared on Linux, needs _GNU_SOURCE. This can break at least on hosts where void* = 64 bits and int (default return type) 32 bits, since some bits in the return type are lost. A minimal patch is: --- Modules/_ctypes/libffi/src/dlmalloc.c +++ Modules/_ctypes/libffi/src/dlmalloc.c @@ -459,2 +459,4 @@ #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#elif !defined _GNU_SOURCE +#define _GNU_SOURCE 1 /* mremap() in Linux sys/mman.h */ #endif /* WIN32 */ However the (char*)CALL_MREMAP() cast looks like a broken fix for this, it suppresses a warning instead of fixing it. Maybe you should remove the cast and instead assign CALL_MREMAP() to a void*, to catch any similar trouble in the future.
msg140688 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-07-19 18:54
I'm running into this while trying to backport Python 2.7.2 to Ubuntu 10.04. Our build machines are throwing an error because they catch the implicit cast so as to prevent problems on ia64 and amd64. http://wiki.debian.org/IMplicitPointerConversions I haven't quite gotten the patch to work yet, but when I do, I'll look at applying this patch upstream as well.
msg140695 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-07-19 21:26
Python 3.1 is in security only mode, so this patch cannot be applied to that version.
msg140711 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-19 23:28
New changeset 8f3cc8ffc3ff by Barry Warsaw in branch '2.7': - Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper http://hg.python.org/cpython/rev/8f3cc8ffc3ff New changeset cc00e09404e6 by Barry Warsaw in branch '3.2': - Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper http://hg.python.org/cpython/rev/cc00e09404e6 New changeset 9986fff720a2 by Barry Warsaw in branch 'default': - Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper http://hg.python.org/cpython/rev/9986fff720a2
msg188140 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-30 08:05
New changeset 663800e18fef by Gregory P. Smith in branch '3.2': This local change was lost during the fixing of to update http://hg.python.org/cpython/rev/663800e18fef New changeset 7438d202e380 by Gregory P. Smith in branch '2.7': This local change was lost during the fixing of to update http://hg.python.org/cpython/rev/7438d202e380
History
Date User Action Args
2022-04-11 14:57:08 admin set github: 54518
2013-04-30 08:05:38 python-dev set messages: +
2011-07-19 23:30:37 barry set status: open -> closedresolution: fixed
2011-07-19 23:28:37 python-dev set nosy: + python-devmessages: +
2011-07-19 21:26:18 barry set messages: + versions: + Python 3.3, - Python 3.1
2011-07-19 19:07:07 barry set assignee: barry
2011-07-19 19:02:50 brian.curtin set assignee: theller -> (no value)nosy: - theller
2011-07-19 18:54:12 barry set nosy: + barrymessages: + versions: + Python 2.7
2010-11-04 13:15:41 hfuru set versions: + Python 3.1
2010-11-04 12:53:09 pitrou set assignee: thellernosy: + theller
2010-11-04 11:55:21 vstinner set nosy: + vstinner
2010-11-04 11:43:44 hfuru create