From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 07 06:31:36 2022 Received: (at submit) by debbugs.gnu.org; 7 Nov 2022 11:31:36 +0000 Received: from localhost ([127.0.0.1]:33496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1os0Ln-0005XU-TN for submit@debbugs.gnu.org; Mon, 07 Nov 2022 06:31:36 -0500 Received: from lists.gnu.org ([209.51.188.17]:48824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1os0Lm-0005XN-6U for submit@debbugs.gnu.org; Mon, 07 Nov 2022 06:31:34 -0500 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 1os0LY-0007nH-JG for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2022 06:31:27 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1os0LW-0008B9-Oa for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2022 06:31:20 -0500 Received: by mail-lj1-x22e.google.com with SMTP id u2so15775924ljl.3 for ; Mon, 07 Nov 2022 03:31:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=MNyCTi9H+Z98NRH76z3bnjWHe+97qc/yPXNyU+VAydk=; b=BmYy65mtggX3Kl5lHb9xE6Ynxoqz+QMk5nGa4K7+duo9+qgb6E0zR8VelbOixuMf0l saP0QKgi/DJ8z3iWWhsHEXh7fdnzOeQzc+Mu5oq6UXbalnxW5EiqaHfhlVJbrDx935fx BuzgROEqL8QucTwQ4O1pAARESrTFEM7kKMZfV84u8hOzQZ8fXPz97I2UufHPqCJcfkLR 4mY3NaC6qMgyB0ey1d3GHmuq016BAMyfssTEO8R/qrArPcgcJ1w1ZSapUYlZisGxcn+O TyWk2A4LAl/2NPhx5GiG56b9XMM744+q2fo+6lbA8EhkBgYxQOYPULE/it3CfBLT5BeG GPhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MNyCTi9H+Z98NRH76z3bnjWHe+97qc/yPXNyU+VAydk=; b=k/ZfltJc8ZG0jmcuxs2qYL7KCQf8uvbbrvSQCdI4NmfJd53a0tOtZ/Y59WRtNqXha9 IiVnPtMP9bQ18BDTQ9FkKdE3qnn3BcWhpyRKKta7IOwjW23f/WBihJ9GXw1oGr4+TJF+ 4OQSMDBsZRRQmuvvF+3L0PlAEpgUZvNE9Q+p8iT4gsDp44xarWO31tQ/l9zl/8D3Q5Jf VSqxez4E7FYzidqWh2dE4rTRZ7B4OZhigx4hyzCZQL/KlW9dozSAJeWGaLtWbLejrLfl eSKY4hQxIsXokm7Nttl/gvjCl24QANIh4xSwgK7HG9AqsnhcUhpY2smDg7kZgpDFbSRJ T5OQ== X-Gm-Message-State: ACrzQf3zH8epGXDd2nBN4nKYRsRiBzft1T4XGygjUrsSADTwlPjhkAvh 5t0kRDxtm+L+uoFr6x5dRAP1JNCxxmFn7QpdxGF4HyEWiJQ= X-Google-Smtp-Source: AMsMyM7Mv5b0/jk8YDbzSAbi7ulSOniobvzfE+Gq6KH8W0/rirFa+IqbjWfQEyDXp6EFHPf6CjtoEy1zU1skHhx+7ug= X-Received: by 2002:a2e:9248:0:b0:277:5b:2212 with SMTP id v8-20020a2e9248000000b00277005b2212mr18556736ljg.299.1667820676350; Mon, 07 Nov 2022 03:31:16 -0800 (PST) MIME-Version: 1.0 From: Richard Copley Date: Mon, 7 Nov 2022 11:30:51 +0000 Message-ID: Subject: 28.2; Uninitialized field command_modes in Lisp_Module_Function To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=rcopley@gmail.com; helo=mail-lj1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 1. Save the "next-prime" sample C program in section E.8.3 "Module Values" of the Elisp manual to file "sample.c" 2. Add these three lines before "return 0;" in function "emacs_module_init" at the end of the file: const char s[] = "nInteger: "; emacs_value spec = env->make_string(env, s, sizeof s - 1); env->make_interactive (env, func, spec); 3. Save and compile (compile-command: "gcc --shared -o ~/sample.so sample.c -lgmp"). 4. (Dangerous) Load the module and attempt to access the command_modes field of the Lisp_Module_Function object for the next-prime command. emacs --batch -eval "(load-library \"~/sample.so\")" -eval "(print (command-modes 'next-prime))" The command_modes field seems to be uninitialized. This might print a random integer, print a randomly selected lisp object from memory, or segfault. In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-10-11 built on fv-az365-328 Repository revision: b35f9af313a5d5c42988eb5a7751209b4234a67e Repository branch: master Windowing system distributor 'Microsoft Corp.', version 10.0.19045 System Description: Microsoft Windows 10 Pro (v10.0.2009.19045.2130) Configured using: 'configure --prefix=/mingw64 --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --with-modules --without-dbus --without-compress-install --with-native-compilation 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe' CPPFLAGS=-D__USE_MINGW_ANSI_STDIO=1 LDFLAGS=-pipe' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XPM ZLIB Important settings: value of $LANG: ENG locale-coding-system: cp1252 Major mode: Fundamental Minor modes in effect: shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs password-cache json map mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date misearch multi-isearch shell pcomplete compile text-property-search comint ansi-color ring vc-git diff-mode easy-mmode vc-dispatcher cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs dired-aux dired comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode seq byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv dired-loaddefs iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads w32notify w32 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 166842 11642) (symbols 48 11063 1) (strings 32 38698 2749) (string-bytes 1 1480785) (vectors 16 24357) (vector-slots 8 430076 60478) (floats 8 42 269) (intervals 56 2483 0) (buffers 992 18)) From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 09 11:24:48 2022 Received: (at 59104) by debbugs.gnu.org; 9 Nov 2022 16:24:48 +0000 Received: from localhost ([127.0.0.1]:40683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1osnse-0001Uz-AX for submit@debbugs.gnu.org; Wed, 09 Nov 2022 11:24:48 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:36562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1osnsZ-0001Uj-5X for 59104@debbugs.gnu.org; Wed, 09 Nov 2022 11:24:46 -0500 Received: by mail-wr1-f53.google.com with SMTP id j15so26557274wrq.3 for <59104@debbugs.gnu.org>; Wed, 09 Nov 2022 08:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=UTd4K8NMSmHqLiu3APpRjbrRTLQNXNzUsMsthT6IhIo=; b=BOhoDX1qARUfrP8+GvYCFgrXkx1KbM9+cxrp7qOiDSZ3/jyJQE1j67hnY/cf7ddd+S 9SgoiCFcrX8qxKhyfueCo+8t5b2BbitoB6jE+DR5jjffR8oSQw49dhlEvJ5zy4/Cf52S fKZS/+5ME+yh7+wkMMFXTZGj3pKqSXwJ8nS/MwVT+28fYFN9HrYq4yiaVGsr7ZviM6sJ HFDZTjhNmb2vln0UWa7MkFgtANVdFiL9BWAqkOfmK50UD/JBJOR2MEmIkNfDraoNozSf Kw+blA7utz4wz6PoFQQESOQlad+30d8uCx4lIcN7uZoMKj5x71VxYwFf6mRppoljcybk jp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UTd4K8NMSmHqLiu3APpRjbrRTLQNXNzUsMsthT6IhIo=; b=sq3Lw2bgC6zhifuXxXFr/PVLsPm6m72l1rlxnerz1B0Ni8ka77d7D/n+5PC1eGtlkq jG7x8+WAyXH1CZW99ea4pFcp5GXatfOsUv2hk2EI9741ddt0LKz7+MUyWJmwtdcTwcNm ow3zJQiJuc+mpcoT+JWSTnCHIWldrWP5fooCQtiaB4sP8BsZN2Y2N+mOD8qU+gbwLtki /I5fZBc8pWNPAvSRuXUaq8lSEYX2On0RX59Xt3ikmMe1VIlKldeAzUjnIRe9qKUQ21yp QGMGW+j0jXbbwPHYpg+RcQde42oCc552peDOvvNuj9KIWShpUQQL0LFg4Ojmt6cyI2f7 CuTQ== X-Gm-Message-State: ACrzQf0s4pt4bO4k4jXtmBKzeMlUg1L0MDbuayHNF4BgTNxKWN8YXy7b Sp1a2DUbQfGxYjvHVG+Vb71mZwAHxAGaXA== X-Google-Smtp-Source: AMsMyM6oaKPt0NWibHDxmDNi4VyOpuzNmkm6dKkRmSVctnEXBCmAoqAXc7ISOD/wQ6QUkVwVj/SWzA== X-Received: by 2002:a5d:6101:0:b0:236:6542:c65b with SMTP id v1-20020a5d6101000000b002366542c65bmr40146049wrt.438.1668011077119; Wed, 09 Nov 2022 08:24:37 -0800 (PST) Received: from [192.168.1.101] (dsl-multi-static-81-140-129-201.in-addr.broadbandscope.com. [81.140.129.201]) by smtp.gmail.com with ESMTPSA id r7-20020a05600c458700b003c7087f6c9asm2271574wmo.32.2022.11.09.08.24.36 for <59104@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Nov 2022 08:24:36 -0800 (PST) Message-ID: <6bee3bae-864a-e00c-cf13-4d98215688a9@gmail.com> Date: Wed, 9 Nov 2022 16:24:35 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: 28.2; Uninitialized field command_modes in Lisp_Module_Function From: Richard Copley To: 59104@debbugs.gnu.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 59104 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > The command_modes field seems to be uninitialized. This might print a > random integer, print a randomly selected lisp object from memory, or > segfault. I can confirm that changing the 'field' argument from "interactive_form" to "command_modes", in the invocation of ALLOCATE_PSEUDOVECTOR in allocate_module_function (), fixes the problem. See "emacs-module.c", line 564. From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 10 05:56:47 2022 Received: (at 59104-done) by debbugs.gnu.org; 10 Nov 2022 10:56:47 +0000 Received: from localhost ([127.0.0.1]:42099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot5Ek-0000Ce-VQ for submit@debbugs.gnu.org; Thu, 10 Nov 2022 05:56:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot5Ei-0000CS-Vp for 59104-done@debbugs.gnu.org; Thu, 10 Nov 2022 05:56:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot5Ed-0002n2-JT; Thu, 10 Nov 2022 05:56:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Q3/y3bj8/cpULSTn2rKKFqEj2wrYDQ/RojXHdcqApjA=; b=SAOVAQozU5eh t6Kt6x+X0NG4+22GlyVfWjYPGKRZL85FDLfwuU9q+4SqXyaI2V2B36drflKgj1tZS/uT9TyZx9opX 2tlJSRJGkV+eoC6i0vJJN2rF/And6IK8VRXfYCs9Nw7DTWfFXMhUfVhAKCUAPBaY0x+uMXz0/Wu7I 2jdSjbpqkAYIDR2pnXUMsPlpftEX4ZX9UgCA2Dj/tY3cAiLwF1orWlEW2JxcXaTTJ0fur6d3ppkad bTwSxhF5FVr+H9f6mi0TXWFljnQ0oJuH0kOI1260gSZg3h4SE0EggNpU/00hxDHXNjc/ebQQ6oa8r G5DVY2mpCVaCR4YAN5kqwA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot5EV-0005pB-EP; Thu, 10 Nov 2022 05:56:38 -0500 Date: Thu, 10 Nov 2022 12:56:30 +0200 Message-Id: <8335arrsbl.fsf@gnu.org> From: Eli Zaretskii To: Richard Copley In-Reply-To: <6bee3bae-864a-e00c-cf13-4d98215688a9@gmail.com> (message from Richard Copley on Wed, 9 Nov 2022 16:24:35 +0000) Subject: Re: bug#59104: 28.2; Uninitialized field command_modes in Lisp_Module_Function References: <6bee3bae-864a-e00c-cf13-4d98215688a9@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59104-done Cc: 59104-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 9 Nov 2022 16:24:35 +0000 > From: Richard Copley > > > The command_modes field seems to be uninitialized. This might print a > > random integer, print a randomly selected lisp object from memory, or > > segfault. > > I can confirm that changing the 'field' argument from "interactive_form" > to "command_modes", in the invocation of ALLOCATE_PSEUDOVECTOR in > allocate_module_function (), fixes the problem. See "emacs-module.c", > line 564. Thanks, I think this is the right fix, so I've now installed this on the master branch, and I'm closing the bug. From unknown Sat Sep 13 19:18:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 08 Dec 2022 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator