Bug 13679 - python segfaults writing to a const array DEBUGLEVEL_CLASS
Summary: python segfaults writing to a const array DEBUGLEVEL_CLASS
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.9.1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2018-11-07 13:40 UTC by Andreas Schneider
Modified: 2018-11-20 11:26 UTC (History)
3 users (show)

See Also:

patch for 4.9 and 4.8 (1.45 KB, patch)
2018-11-08 12:44 UTC, Andreas Schneider
jra: review+
ddiss: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2018-11-07 13:40:59 UTC
We get a segfault with the following error:

    ==10142== Process terminating with default action of signal 11 (SIGSEGV)
    ==10142==  Bad permissions for mapped region at address 0x6F00A20
    ==10142==    at 0x6F1074B: py_set_debug_level (pyglue.c:165)

The code which segfaults is:

  (DEBUGLEVEL) = level;

This is the following define:


which is an:


and initialized with:

int     *DEBUGLEVEL_CLASS = discard_const_p(int, debug_class_list_initial);

So we are trying to write to a const pointer and fail!
Comment 1 David Disseldorp 2018-11-08 12:21:00 UTC
FWIW, given that your toolchain appears to be tagging and protecting const memory, I expect you'll see many more issues than just this.
Comment 2 Andreas Schneider 2018-11-08 12:43:24 UTC
Only if we try to write to that memory. However I didn't do a full make test yet. As I tried to fix failing tests.
Comment 3 Andreas Schneider 2018-11-08 12:44:37 UTC
Created attachment 14639 [details]
patch for 4.9 and 4.8
Comment 4 Andreas Schneider 2018-11-08 16:22:56 UTC
Karolin, please add the patches to the relevant branches. Thanks!
Comment 5 Karolin Seeger 2018-11-12 08:24:03 UTC
Pushed to autobuild-v4-8-test.
Comment 6 Karolin Seeger 2018-11-14 11:32:10 UTC
Pushed to autobuild-v4-9-test.
Comment 7 Karolin Seeger 2018-11-20 11:26:59 UTC
Pushed to both branches.
Closing out bug report.