From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: Crash when switching to buffer Date: Mon, 01 Jul 2024 16:42:34 +0200 Message-ID: References: <87v81pbgzi.fsf@localhost> <86a5j1fhd1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2393"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , Ihor Radchenko , emacs-devel@gnu.org, eller.helmut@gmail.com To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 01 16:42:56 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sOIF5-0000N8-Rc for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Jul 2024 16:42:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOIEu-0004Z7-AD; Mon, 01 Jul 2024 10:42:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOIEt-0004Qj-5W for emacs-devel@gnu.org; Mon, 01 Jul 2024 10:42:43 -0400 Original-Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOIEp-0006uZ-8P; Mon, 01 Jul 2024 10:42:42 -0400 Original-Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a7252bfe773so328276766b.1; Mon, 01 Jul 2024 07:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719844956; x=1720449756; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eMa51/gTzJr47VLyappZ37ckl1u8kfan6rYkjipN8p0=; b=k2xjaRxUBzR1jdC6acQKl1G5ZQu5Yp8RZorIo0rxw3aj77XmeCT0ASr3HC7S6wVfIP SyoxpbEuAlpCwsm9Pow6q0tY/ecxteuR1fQiurusin94KclKQli+SQi8Cy6L/bno/2OH lEmBe5+yIqPM5Z739+qgQC3cPZeSI9SpA4vtTLPMpHPBoEKUw37K0tKeMOu0q9HUUOoE kLtV/Q/AJMluy0dkI3oqQkAUBdBV9PsLm/uM3p91APRrV2z19qtlthDHHjn95Pcc9Wuw rwiruk+45H6qp4dTZBoG4muZudarUDHGuhfKW4uu9/oZGyzdLx1FgnEzj4SzgITNqYaz /kBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719844956; x=1720449756; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eMa51/gTzJr47VLyappZ37ckl1u8kfan6rYkjipN8p0=; b=nhC+BsZAULhAz3OEPy5tV/ppP9iY/Mdzy8jGdlIzcvFBusJ7sQ7FqxUbNN2s4aNkSU b8rekEAxGuqmzCvH7sgHuB5uEGRqR6EGVde4CNSzg86CahlUwjRU3uLhHDBgNgJhhZv3 Gl7Hjv1+57Ps8hUcfW0DZbLYcZgwekLrl4P0KQTNvXF6kXayGLNMLNDlgl2GFjyPERkz 2cN22eI7RRPst1UanP8o7zK0HGFYsVjarJ/A+cHjgSfckjxcmBt86Bbm3/KAXI2LLmMR B3gObxyybf+B1G0cL6Wp9XMnwFyfUyopZSzWdtvf3xZWuHgCU1JF4zGegKHOTiQMPDO6 viHA== X-Forwarded-Encrypted: i=1; AJvYcCWyue7pFL42tDubZNdkVwx/4UtTBKIwZPyFVCu9g2ZJD43NIZW15D64MXfNscwpCSBkWQyyLQ+D/ZjBFD9l6f63EEZl X-Gm-Message-State: AOJu0Yzv9Nm4/rWiLxgKCy/+8dVRH74eGsC4u2Iu2K1YETYb9Kf/Z5RD 3b4V3E1S/AO2OUpp/DyuRfLEdtSbnuSmsp/931XLHCfFwd5fm2El X-Google-Smtp-Source: AGHT+IGOokOACSYEOQgtYObsyvCCQIsVd++QdJ/fhcx0S9yPOhrectKdcHsQ+r5SO1lxrczknJ6woA== X-Received: by 2002:a17:907:724c:b0:a6e:fccc:e4a with SMTP id a640c23a62f3a-a75140576c8mr439365566b.0.1719844955732; Mon, 01 Jul 2024 07:42:35 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3a7fc.dip0.t-ipconnect.de. [79.227.167.252]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72b033f3a3sm312048866b.187.2024.07.01.07.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 07:42:35 -0700 (PDT) In-Reply-To: (Pip Cet's message of "Mon, 01 Jul 2024 14:14:47 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321028 Archived-At: Pip Cet writes: > On Monday, July 1st, 2024 at 12:04, Eli Zaretskii wrote: >> > From: Ihor Radchenko yantar92@posteo.net >>=20 >> > Cc: Gerd M=C3=B6llmann gerd.moellmann@gmail.com, Eli Zaretskii >> > eliz@gnu.org, >> > eller.helmut@gmail.com >> > Date: Mon, 01 Jul 2024 09:26:25 +0000 >> >=20 >> > Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=3Dsig@= entry=3D11, backtrace_limit=3Dbacktrace_limit@entry=3D40) at emacs.c:443 >> > 443 { >> > (gdb) bt >> > #0 terminate_due_to_signal (sig=3Dsig@entry=3D11, backtrace_limit=3Dba= cktrace_limit@entry=3D40) at emacs.c:443 >> > #1 0x00005555556e446b in handle_fatal_signal (sig=3Dsig@entry=3D11) at= sysdep.c:1800 >> > #2 0x00005555556e44d0 in deliver_thread_signal (sig=3D11, handler=3D0x= 5555556e4457 ) at sysdep.c:1792 >> > #3 deliver_fatal_thread_signal (sig=3Dsig@entry=3D11) at sysdep.c:1812 >> > #4 0x00005555556e44fd in handle_sigsegv (sig=3D11, siginfo=3D, arg=3D) at sysdep.c:1950 >> > #5 0x00007ffff3048050 in () at /lib64/libc.so.6 >> > #6 0x00007ffff304822b in kill () at /lib64/libc.so.6 >> > #7 0x0000555555880af9 in sigHandle (sig=3D, info=3D, uap=3D) at /home/yantar92/Dist/mps/code/protsgi= x.c:114 >> > #8 0x00007ffff3048050 in () at /lib64/libc.so.6 >> > #9 XCDR (c=3DXIL(0x32ec042e3)) at /home/yantar92/Git/emacs/src/lisp.h:= 1522 >> > #10 plist_get (plist=3D, prop=3Dprop@entry=3DXIL(0x8220= )) at fns.c:2611 >> > #11 0x000055555575a8de in Fget (symbol=3Dsymbol@entry=3DXIL(0x2aaa92d6= f288), propname=3Dpropname@entry=3DXIL(0x8220)) at fns.c:2631 >> > #12 0x0000555555664370 in resolve_face_name (face_name=3DXIL(0x2aaa92d= 6f288), signal_p=3Dsignal_p@entry=3Dfalse) at xfaces.c:2004 >> > #13 0x0000555555669e57 in get_lface_attributes >> > (w=3Dw@entry=3D0x7fffef8a0068, f=3Df@entry=3D0x7fffe26fd610, >> > face_name=3D, attrs=3Dattrs@entry=3D0x7fffffff5270, >> > signal_p=3Dsignal_p@entry=3Dfalse, named_merge_points=3D, >> > named_merge_points@entry=3D0x0) at xfaces.c:2105 >> > #14 0x0000555555670ea9 in lookup_derived_face >> > (w=3D0x7fffef8a0068, f=3Df@entry=3D0x7fffe26fd610, symbol=3D, face_id=3Dface_id@entry=3D45, signal_p=3Dsignal_p@entry=3Dfalse) at = xfaces.c:5279 >> > #15 0x0000555555671ef4 in merge_faces (w=3D, face_name= =3D, face_name@entry=3DXIL(0x30), face_id=3D,= base_face_id=3D45) >> > at xfaces.c:7128 >> > #16 0x00005555555c0751 in next_element_from_display_vector (it=3D0x7ff= fffff7dc0) at xdisp.c:9045 > > At first glance, the lface_id_to_name "vector" (just a pointer to > Lisp_Object, not a Lisp_Vector) isn't allocated using igc methods, so > references in it might not be traced. Is that possible, Gerd? I > confess I'm not totally sure how xmalloc and friends get translated in > the MPS build... That's very possible, and a bug :-). Good catch! If xmalloc/xfree and friends are used to alloc memory that contains references, we have replaced them with oen of these void *igc_xzalloc_ambig (size_t size); void *igc_realloc_ambig (void *block, size_t size); void igc_xfree (void *p); Lisp_Object *igc_xalloc_lisp_objs_exact (size_t n); void *igc_xpalloc_ambig (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, ptrdiff_t nitems_max, ptrdiff_t item_size); void igc_xpalloc_exact (void **pa_cell, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, ptrdiff_t nitems_max, ptrdiff_t item_size, igc_scan_area_t scan); void *igc_xnrealloc_ambig (void *pa, ptrdiff_t nitems, ptrdiff_t item_siz= e); Hope I got them all. All of them create roots, the ambig variants ambiguous roots, the exact variants exact roots. igc_xfree must be used instead of xfree so that the roots get destroyed when the memory is freed.