From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#41321: 27.0.91; Emacs aborts due to invalid pseudovector objects Date: Fri, 29 May 2020 09:43:24 +0000 Message-ID: References: <83zha8cgpi.fsf@gnu.org> <83y2phwb9x.fsf@gnu.org> <83r1v9w9vi.fsf@gnu.org> <83mu5xw50d.fsf@gnu.org> <83k110wxte.fsf@gnu.org> <4bab5f55-95fe-cf34-e490-1d4319728395@cs.ucla.edu> <837dwyvi74.fsf@gnu.org> <1484f569-c260-9fb0-bfe1-67897de289d3@cs.ucla.edu> <83blm9tn4j.fsf@gnu.org> <4aeb8963-4fd1-fcd4-e6e1-be409ab54775@cs.ucla.edu> <83r1v5s2p1.fsf@gnu.org> <5351703b-1780-561b-7f68-cdd4ed45e599@cs.ucla.edu> <838shcseng.fsf@gnu.org> <309544a0-d857-13f3-e211-41a40966dcc5@cs.ucla.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000f9762c05a6c6483b" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="87894"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Paul Eggert , 41321@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 29 11:45:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jebZg-000MpY-CX for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 May 2020 11:45:12 +0200 Original-Received: from localhost ([::1]:58978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jebZf-0006u6-6f for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 May 2020 05:45:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jebZX-0006tu-8L for bug-gnu-emacs@gnu.org; Fri, 29 May 2020 05:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42277) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jebZW-0002iq-VG for bug-gnu-emacs@gnu.org; Fri, 29 May 2020 05:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jebZW-0003ee-Cs for bug-gnu-emacs@gnu.org; Fri, 29 May 2020 05:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 May 2020 09:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41321 X-GNU-PR-Package: emacs Original-Received: via spool by 41321-submit@debbugs.gnu.org id=B41321.159074544913971 (code B ref 41321); Fri, 29 May 2020 09:45:02 +0000 Original-Received: (at 41321) by debbugs.gnu.org; 29 May 2020 09:44:09 +0000 Original-Received: from localhost ([127.0.0.1]:53823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jebYe-0003dG-Gw for submit@debbugs.gnu.org; Fri, 29 May 2020 05:44:09 -0400 Original-Received: from mail-ot1-f65.google.com ([209.85.210.65]:38169) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jebYd-0003cu-BG for 41321@debbugs.gnu.org; Fri, 29 May 2020 05:44:07 -0400 Original-Received: by mail-ot1-f65.google.com with SMTP id o13so1471892otl.5 for <41321@debbugs.gnu.org>; Fri, 29 May 2020 02:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lwlcT3xM5ePH3gDNjuyZMBkm9lvuAsM6EmJBo+7EFYk=; b=keGXJuaQoigdwvp2YFVa/F8np7bH89LMCfpf4idhv20wwJEJvkonvq+ynbVNbzBwPH 6jbxBmJxGBAMudFBjYtwrcvdvYFTrDC0CTxeoFBCyCbfUTiHgTIsGjI/yTRgC7HqIBhz gwmca7K7zx/bPSSLhpZLvhE7AXxtTwXHXEI1ztwUKDUSNcONQfotOeL663SSeb7qrtto YhpHHf9YUsJCFzcRvp2Q8BguQzIltaJ4Wytu0VoYWHHzM3YhjryUNtDW+KAuHMTE6csq RKxHChE30DU2gS67xHLLhCdGC1DObq/PaUdDfdye8Au6WHxSpA+MlXh04ecnrZylz/Q+ 6UbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lwlcT3xM5ePH3gDNjuyZMBkm9lvuAsM6EmJBo+7EFYk=; b=D90QDaTHNC/0kEfru4uDnFmbgOV6dYziUdb7nXUHb5pd+J5ADPfja+1ZciSL1A0smn vumloXPotqgEyR2Krl6XZrgoVuM2x1s4AAntfuO6CltYwiKO198z1xnzQawCQAFjPByB 8XEaI5t3A2ZWxYEuFDjK9Eu/CRrbi7EavB5Ifn3pRs22/AZJTZzx9Jjsfn8alzfqmCwb /79g+s7US/VV3eNoKnaRJjzp44ZrXo1KGlrkzszt37eJvE3yKEHH6UPD03dTc96M+cxv ZXwSae8vn1gAp4Ok1Piq9uRKReL8UhZxub7G3JOt5EMgd+h9OXtA9esaUOjyR8zdh/a8 ow2w== X-Gm-Message-State: AOAM531SmcUT5dHAEchm21mMzKX0tF3yyeH6RR96UlcBJ28jXlFwYp1B GTke5vqi1yQWG59LJRdUufkDmbpbtl9jBg9PqnM= X-Google-Smtp-Source: ABdhPJxsanOyIjXQ1KiPvlgvRz0N3MWH/Lf12xbM4BAg5BBUpZzUwR7OgcEt/h4ASpXzN32pYfysMRGq9pcRZ5J76sw= X-Received: by 2002:a9d:4c97:: with SMTP id m23mr1362054otf.154.1590745441583; Fri, 29 May 2020 02:44:01 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181174 Archived-At: --000000000000f9762c05a6c6483b Content-Type: text/plain; charset="UTF-8" On Thu, May 28, 2020 at 2:28 PM Pip Cet wrote: > My suggestion is instead to put MEM_TYPE_SYMBOL blocks into the rbtree > twice, once at their proper address and once at the lispsym-based > offset. > > We could then look up each pointer precisely once, though sometimes > the blocks might overlap and we'd end up marking two objects for one > pointer. > > But that would lead to overlapping rbtree entries, and that requires > some extra code which wouldn't be exercised very often... still, I > think it might be worth doing, particularly since there are relatively > few symbol blocks on most systems. Okay, here's some initial code that does that. It's a little tricky, because real addresses and symbol offsets can overlap arbitrarily and become mapped and unmapped in any order. The basic idea is that symbol offsets are marked two ways: 1. an overlaps_with_symbols flag on a "normal" memory node 2. a mem node type of MEM_TYPE_SYMBOL_ADJUSTED (2) implies (1), but not the other way around. There's only one flag per normal memory node, which is true if any of the addresses in the node are also valid symbol offsets. MEM_TYPE_SYMBOL_ADJUSTED nodes have start and end addresses that do not necessarily correspond to symbol blocks or even symbols; their length is arbitrary. When we insert or delete memory nodes, we perform the obvious operations to keep MEM_TYPE_SYMBOL_ADJUSTED blocks accurate: i.e., when a MEM_TYPE_SYMBOL_ADJUSTED node is split by an intervening/overlapping normal node, we insert one or two new MEM_TYPE_SYMBOL_ADJUSTED nodes to cover the remaining offsets, and set the overlaps_with_symbols flag on the normal node, to cover those, etc. As I said, the code is tricky (i.e. might contain bugs that can only be discovered through extensive testing on 32-bit systems), and it complicates what should be generic functions for the rbtree implementation, so this is probably a 32-bit optimization that is too late because 32-bit systems are no longer that relevant... --000000000000f9762c05a6c6483b Content-Type: text/x-patch; charset="US-ASCII"; name="0001-snapshot.patch" Content-Disposition: attachment; filename="0001-snapshot.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kas0qa7y0 RnJvbSAyNDY0OTM0MjVmMDFmYzY4NzZlZDIyMjJmZDRjMTgwNmRjMGUxMmYxIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaXAgQ2V0IDxwaXBjZXRAZ21haWwuY29tPgpEYXRlOiBGcmks IDI5IE1heSAyMDIwIDA5OjQwOjM2ICswMDAwClN1YmplY3Q6IFtQQVRDSF0gc25hcHNob3QKCi0t LQogc3JjL2FsbG9jLmMgfCAyMDAgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrLQogMSBmaWxlIGNoYW5nZWQsIDE5OSBpbnNlcnRpb25zKCspLCAxIGRl bGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvc3JjL2FsbG9jLmMgYi9zcmMvYWxsb2MuYwppbmRleCBl MjQxYjk5MzNhLi42NWNiYWNiZTg3IDEwMDY0NAotLS0gYS9zcmMvYWxsb2MuYworKysgYi9zcmMv YWxsb2MuYwpAQCAtNDc1LDYgKzQ3NSw3IEBAIG5vX3Nhbml0aXplX21lbWNweSAodm9pZCAqZGVz dCwgdm9pZCBjb25zdCAqc3JjLCBzaXplX3Qgc2l6ZSkKICAgTUVNX1RZUEVfQ09OUywKICAgTUVN X1RZUEVfU1RSSU5HLAogICBNRU1fVFlQRV9TWU1CT0wsCisgIE1FTV9UWVBFX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g bGl2ZV9zeW1ib2xfaG9sZGluZyAobSwgdW5hZGp1c3Rfc3ltYm9sIChwKSk7CisJICBpZiAoIU5J TFAgKG9iaikpCisJICAgIG1hcmtfb2JqZWN0IChvYmopOworCX0KICAgICB9CiB9CiAKQEAgLTcw NzcsNiArNzI2MiwxOSBAQCBzd2VlcF9zeW1ib2xzICh2b2lkKQogICAgICAgICAgIC8qIFVuaG9v ayBmcm9tIHRoZSBmcmVlIGxpc3QuICAqLwogICAgICAgICAgIHN5bWJvbF9mcmVlX2xpc3QgPSBz YmxrLT5zeW1ib2xzWzBdLnUucy5uZXh0OwogICAgICAgICAgIGxpc3BfZnJlZSAoc2Jsayk7CisJ ICB2b2lkICpwID0gYWRqdXN0X3N5bWJvbCAoc2Jsayk7CisJICB3aGlsZSAodHJ1ZSkKKwkgICAg eworCSAgICAgIHN0cnVjdCBtZW1fbm9kZSAqbSA9IG1lbV9maW5kX25leHQgKHApOworCSAgICAg IGlmIChtLT5zdGFydCA+PQorCQkgIGFkanVzdF9zeW1ib2wgKHNibGsgKyAxKSkKKwkJYnJlYWs7 CisJICAgICAgcCA9IG0tPmVuZDsKKwkgICAgICBtZW1fc2V0X292ZXJsYXBzX3dpdGhfc3ltYm9s cyAobSk7CisJICAgICAgaWYgKG0tPnR5cGUgPT0gTUVNX1RZUEVfU1lNQk9MX0FESlVTVEVECisJ CSAgJiYgIW0tPm92ZXJsYXBzX3dpdGhfc3ltYm9scykKKwkJbWVtX2RlbGV0ZSAobSk7CisJICAg IH0KICAgICAgICAgfQogICAgICAgZWxzZQogICAgICAgICB7Ci0tIAoyLjI3LjAucmMwCgo= --000000000000f9762c05a6c6483b--