80xapp-gtk3-module.sh` appends `xapp-gtk3-module` to `GTK3_MODULES` unconditionally

Đang mở Phù hợp với người mới
#223 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash
Lĩnh vực
desktop

Hướng nghiên cứu

Bắt đầu bằng cách đọc /etc/X11/xinit/xinitrc.d/80xapp-gtk3-module.sh, tập lệnh được nêu trong báo cáo. Kiểm tra cách tập lệnh nối thêm vào GTK3_MODULES khi biến này đã chứa xapp-gtk3-module, sau đó xác minh rằng giá trị chỉ được thêm một lần. Công việc hoàn tất khi việc nạp tập lệnh nhiều lần hoặc đã có sẵn một mục chỉ để lại một mục mô-đun; issue không nêu bài kiểm tra nào, vì vậy hãy kiểm tra trực tiếp hành vi của tập lệnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Distribution

Fedora 45

Package version

3.4.0-1.fc45

Graphics hardware in use

ATI Radeon PRO WX 3200

Frequency

Always

Bug description
Summary

/etc/X11/xinit/xinitrc.d/80xapp-gtk3-module.sh appends xapp-gtk3-module to GTK3_MODULES without checking if it is already present. When cinnamon-session (or another session startup component) also sets GTK3_MODULES, the variable becomes:

GTK3_MODULES=xapp-gtk3-module:xapp-gtk3-module

This causes GTK3 to load libxapp-gtk3-module.so twice and register duplicate GDK event filters on GdkWindow instances.

Impact / Crash Details

With duplicate xapp-gtk3-module entries in GTK3_MODULES, cinnamon segfaults in gdk_event_apply_filters() when an X11 ClientMessage (event type 29) triggers destruction of a 10x10 InputOnly helper GdkX11Window inside the first filter callback:

  1. gdk_event_apply_filters() saves node = tmp_list->next before invoking the first filter.
  2. The first filter destroys the GdkX11Window (window->destroyed = 1, window->filters = NULL), freeing the remaining GList nodes.
  3. Because a duplicate filter node was queued next, the loop advances tmp_list = node into freed heap memory and segfaults on the next iteration.
GDB Backtrace
Program terminated with signal SIGSEGV, Segmentation fault.
#0  gdk_event_apply_filters (xevent=xevent@entry=0x7ffccd7d62a0, event=event@entry=0x55ad10c12320, window=0x55ad0fdb4770) at ../gdk/x11/gdkeventsource.c:69
69	      GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
(gdb) bt
#0  gdk_event_apply_filters (xevent=xevent@entry=0x7ffccd7d62a0, event=event@entry=0x55ad10c12320, window=0x55ad0fdb4770 [GdkX11Window]) at ../gdk/x11/gdkeventsource.c:69
#1  0x00007fcb678a3302 in gdk_event_source_translate_event (event_source=0x55ad0d9e9280, xevent=0x7ffccd7d62a0) at ../gdk/x11/gdkeventsource.c:205
#2  _gdk_x11_display_queue_events (display=0x55ad0d6adc50 [GdkX11Display]) at ../gdk/x11/gdkeventsource.c:341
#3  0x00007fcb6784052b in gdk_display_get_event (display=0x55ad0d6adc50 [GdkX11Display]) at ../gdk/gdkdisplay.c:442
#4  0x00007fcb678a3bae in gdk_event_source_dispatch.lto_priv () at ../gdk/x11/gdkeventsource.c:354
#5  0x00007fcb688dc564 in g_main_dispatch (context=0x55ad0d0c4870) at ../glib/gmain.c:3734
#6  g_main_context_dispatch_unlocked (context=context@entry=0x55ad0d0c4870) at ../glib/gmain.c:4603
#7  0x00007fcb688dd9e8 in g_main_context_iterate_unlocked (context=0x55ad0d0c4870, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4672
#8  0x00007fcb688ddc17 in g_main_loop_run (loop=0x55ad0d6c3f60) at ../glib/gmain.c:4877
#9  0x00007fcb68380ac7 in meta_run () at ../src/core/main.c:663
#10 0x000055acd8561a32 in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.c:394

(gdb) p tmp_list
\$1 = 0x1cd945e3354f663 = {Cannot access memory at address 0x1cd945e3354f663}
(gdb) p window->destroyed
\$2 = 1
(gdb) p window->filters
\$3 = 0x0
(gdb) p xevent->type
\$4 = 29
Steps to reproduce

unknown exactly

Expected behavior

the environment variable only gets the value appended if it's not already there

Additional information
Potential Fix

Guard 80xapp-gtk3-module.sh so xapp-gtk3-module is only appended if not already present in GTK3_MODULES:

#!/usr/bin/bash
# This file is sourced by xinit(1) or a display manager's Xsession, not executed.

case ":\$GTK3_MODULES:" in
    *:xapp-gtk3-module:*) ;;
    *)
        if [ -z "\$GTK3_MODULES" ] ; then
            GTK3_MODULES="xapp-gtk3-module"
        else
            GTK3_MODULES="\$GTK3_MODULES:xapp-gtk3-module"
        fi
        ;;
esac

export GTK3_MODULES
Ngôn ngữ chính
C
Star
173
Fork
52
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của linuxmint/xapp

Tất cả issue của linuxmint/xapp

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.