Bug 2252391 - [abrt] gcl: do_gcl_abort(): saved_ansi_gcl killed by SIGABRT
Summary: [abrt] gcl: do_gcl_abort(): saved_ansi_gcl killed by SIGABRT
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 39
Hardware: x86_64
OS: Unspecified
high
medium
Target Milestone: ---
Assignee: Ondrej Mosnáček
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:7770d2982beaf7affced76d8828...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-12-01 11:41 UTC by John Schneiderman
Modified: 2024-03-12 13:39 UTC (History)
27 users (show)

Fixed In Version: kernel-6.7.3-200.fc39
Clone Of:
Environment:
Last Closed: 2024-03-12 13:39:50 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: os_info (699 bytes, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: limits (1.29 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: environ (4.41 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: cpuinfo (3.09 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: maps (3.92 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: dso_list (705 bytes, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: core_backtrace (14.20 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: mountinfo (3.85 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: backtrace (29.48 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: open_fds (663 bytes, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details
File: proc_pid_status (1.50 KB, text/plain)
2023-12-01 11:41 UTC, John Schneiderman
no flags Details

Description John Schneiderman 2023-12-01 11:41:32 UTC
Description of problem:
Running a simple program.

Version-Release number of selected component:
gcl-2.6.14-3.fc39

Additional info:
reporter:       libreport-2.17.11
comment:        Running a simple program.
runlevel:       N 5
package:        gcl-2.6.14-3.fc39
crash_function: do_gcl_abort
rootdir:        /
journald_cursor: s=8ce7d0793b5d4423816eac809b75fb96;i=11d6571;b=92381493a519485395bd7461ed8705b1;m=2f429ab78;t=60b713cf4421a;x=a81b9f235bdb4c8d
cmdline:        /usr/lib/gcl-2.6.14/unixport/saved_ansi_gcl -dir /usr/lib/gcl-2.6.14/unixport/ -libdir /usr/lib/gcl-2.6.14/ -eval $'(setq si::*allow-gzipped-file* t)' -eval $'(setq si::*tk-library* "/usr/lib64/tk8.6")' day01-1.lisp
backtrace_rating: 4
kernel:         6.6.2-201.fc39.x86_64
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-org.kde.konsole-b2a36f56dab948619b816d1cfba92cc0.scope
uid:            1000
executable:     /usr/lib/gcl-2.6.14/unixport/saved_ansi_gcl
type:           CCpp
reason:         saved_ansi_gcl killed by SIGABRT

Truncated backtrace:
Thread no. 1 (46 frames)
 #4 do_gcl_abort at main.c:618
 #5 error at main.c:636
 #6 segmentation_catcher at main.c:823
 #8 _IO_putc at putc.c:31
 #9 my_putc at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/gcl_readline.d:192
 #10 rl_putc_em at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/gcl_readline.d:228
 #11 writec_stream at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/file.d:981
 #12 princ_char at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/print.d:2109
 #13 LI19 at gcl_serror.c:1283
 #14 LI18 at gcl_serror.c:1239
 #15 c_apply_n_fun at ../h/apply_n.h:92
 #16 call_vfun at eval.c:122
 #17 funcall at eval.c:162
 #18 LI16 at gcl_serror.c:1080
 #19 c_apply_n at ../h/apply_n.h:15
 #20 c_apply_n_fun at ../h/apply_n.h:92
 #21 call_vfun at eval.c:122
 #22 funcall at eval.c:162
 #23 IapplyVector at nfunlink.c:246
 #24 Icall_gen_error_handler_ap at error.c:146
 #25 Icall_gen_error_handler_noreturn at error.c:175
 #26 error at main.c:633
 #27 segmentation_catcher at main.c:823
 #29 _IO_putc at putc.c:31
 #30 my_putc at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/gcl_readline.d:192
 #31 rl_putc_em at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/gcl_readline.d:228
 #32 writec_stream at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/file.d:981
 #33 princ_char at /usr/src/debug/gcl-2.6.14-3.fc39.x86_64/o/print.d:2109
 #34 LI19 at gcl_serror.c:1283
 #35 c_apply_n_fun at ../h/apply_n.h:92
 #36 call_proc_new at funlink.c:456
 #37 LnkTLI91 at gcl_serror.c:2018
 #38 LI18 at gcl_serror.c:1239
 #39 c_apply_n_fun at ../h/apply_n.h:92
 #40 call_vfun at eval.c:122
 #41 funcall at eval.c:162
 #42 LI16 at gcl_serror.c:1080
 #43 c_apply_n at ../h/apply_n.h:15
 #44 c_apply_n_fun at ../h/apply_n.h:92
 #45 call_vfun at eval.c:122
 #46 funcall at eval.c:162
 #47 IapplyVector at nfunlink.c:246
 #48 Icall_gen_error_handler_ap at error.c:146
 #49 Icall_gen_error_handler_noreturn at error.c:175
 #50 assert_error at error.c:40
 #51 gcl_init_alloc at alloc.c:1256

Comment 1 John Schneiderman 2023-12-01 11:41:35 UTC
Created attachment 2002308 [details]
File: os_info

Comment 2 John Schneiderman 2023-12-01 11:41:37 UTC
Created attachment 2002309 [details]
File: limits

Comment 3 John Schneiderman 2023-12-01 11:41:38 UTC
Created attachment 2002310 [details]
File: environ

Comment 4 John Schneiderman 2023-12-01 11:41:39 UTC
Created attachment 2002311 [details]
File: cpuinfo

Comment 5 John Schneiderman 2023-12-01 11:41:41 UTC
Created attachment 2002312 [details]
File: maps

Comment 6 John Schneiderman 2023-12-01 11:41:42 UTC
Created attachment 2002313 [details]
File: dso_list

Comment 7 John Schneiderman 2023-12-01 11:41:44 UTC
Created attachment 2002314 [details]
File: core_backtrace

Comment 8 John Schneiderman 2023-12-01 11:41:46 UTC
Created attachment 2002315 [details]
File: mountinfo

Comment 9 John Schneiderman 2023-12-01 11:41:48 UTC
Created attachment 2002316 [details]
File: backtrace

Comment 10 John Schneiderman 2023-12-01 11:41:49 UTC
Created attachment 2002317 [details]
File: open_fds

Comment 11 John Schneiderman 2023-12-01 11:41:50 UTC
Created attachment 2002318 [details]
File: proc_pid_status

Comment 12 Jerry James 2023-12-01 21:45:22 UTC
Indeed, "setarch -X" no longer works in F39 or Rawhide.  (I don't have an F38 box handy to see if the same is true there.)  Running "sudo setenforce 0" makes gcl work again, but I cannot recommend that you expose your system that way.

Reassigning to the selinux-policy component to see if the maintainers can tell us if "setarch -X" not working is deliberate or not.  If it is deliberate, please reassign this bug back to gcl, but please also tell me what the gcl package needs to do instead of using "setarch -X".

Comment 13 Zdenek Pytela 2023-12-04 10:26:34 UTC
John and Jerry,

I am sorry but I don't understand what's the problem. Can you share reproducing steps and AVC denials you see?

Comment 14 John Schneiderman 2023-12-04 17:55:07 UTC
Run: gcl

Do not need to even run a specific file. When running, you'll see the following output:

$ gcl
mprotect failure: 0x883000 7282688 : Permission denied

Unrecoverable error: Segmentation violation..
Aborted (core dumped)

Comment 15 Zdenek Pytela 2023-12-05 11:59:21 UTC
What I can reproduce results in:

type=PROCTITLE msg=audit(12/05/2023 06:49:26.182:571) : proctitle=/usr/lib/gcl-2.6.14/unixport/saved_ansi_gcl -dir /usr/lib/gcl-2.6.14/unixport/ -libdir /usr/lib/gcl-2.6.14/ -eval (setq si::*all 
type=SYSCALL msg=audit(12/05/2023 06:49:26.182:571) : arch=x86_64 syscall=mprotect per=PER_LINUX|~ADDR_NO_RANDOMIZE success=no exit=EACCES(Permission denied) a0=0x883000 a1=0x6f2000 a2=PROT_READ|PROT_WRITE|PROT_EXEC a3=0x7ffff7a8c4a8 items=0 ppid=1448 pid=1907 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=4 comm=saved_ansi_gcl exe=/usr/lib/gcl-2.6.14/unixport/saved_ansi_gcl subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(12/05/2023 06:49:26.182:571) : avc:  denied  { execheap } for  pid=1907 comm=saved_ansi_gcl scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process permissive=0 

audit2allow suggests:

#!!!! This avc can be allowed using the boolean 'selinuxuser_execheap'
allow unconfined_t self:process execheap;

Please refer to the boolean description:
  # semanage boolean -l|grep execheap
selinuxuser_execheap           (off  ,  off)  Allow unconfined executables to make their heap memory executable.  Doing this is a really bad idea. Probably indicates a badly coded executable, but could indicate an attack. This executable should be reported in bugzilla

Additional information:
The Linux implementation of mprotect (unlike POSIX) allows changing the access protection of memory on the heap, e. g. allocated using malloc. This AVC denial indicates that heap memory was supposed to be made executable. While the permission can be granted turning the selinuxuser_execheap boolean on as suggested by setroubleshoot, it should not be done without a thorough code review as in most cases it indicates a bug in the code. If anonymous executable memory is needed, another method should be considered, e. g. allocating memory using mmap.

There was no related change in selinux-policy. If the permission is now needed, go ahead and change the boolean value.

setsebool -P selinuxuser_execheap on

Comment 16 Ondrej Mosnáček 2023-12-06 14:05:15 UTC
This actually seems to be a kernel regression caused by the following commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=68df1baf158fddc07b6f0333e4c81fe1ccecd6ff
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=11250fd12eb8a58205e69ea36f19fa8c084afb62

I will ask on the kernel mailing lists if this is an intended behavior and what can be done about it if it is not.

Comment 17 Ondrej Mosnáček 2023-12-07 08:38:12 UTC
The issue is being discussed here: https://lore.kernel.org/selinux/CAFqZXNv0SVT0fkOK6neP9AXbj3nxJ61JAY4+zJzvxqJaeuhbFw@mail.gmail.com/

Comment 18 Jerry James 2023-12-07 20:49:53 UTC
Thank you, Ondrej.  I appreciate you diagnosing the issue and kicking off a discussion.

Comment 19 Ondrej Mosnáček 2023-12-14 08:45:34 UTC
Update: A fix has now been merged into Andrew Morton's mm-hotfixes-stable tree and should get into mainline soon:

https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?h=mm-hotfixes-stable&id=d3bb89ea9c13e5a98d2b7a0ba8e50a77893132cb

Comment 20 Jerry James 2023-12-14 15:55:58 UTC
Fantastic.  Thank you again, Ondrej.

Comment 21 Ondrej Mosnáček 2024-03-12 13:39:50 UTC
This should be fixed in F39 as of kernel-6.7.3-200.fc39 - closing.


Note You need to log in before you can comment on or make changes to this bug.