From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s Date: Sat, 6 Mar 2021 09:44:18 +0000 Message-ID: References: <20210305170955.27732.27579@vcs0.savannah.gnu.org> <20210305170957.AF99920E1B@vcs0.savannah.gnu.org> <83sg58wu0v.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40853"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 06 10:46:43 2021 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 1lITWF-000AWm-3I for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Mar 2021 10:46:43 +0100 Original-Received: from localhost ([::1]:41294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lITWE-00018R-68 for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Mar 2021 04:46:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lITUc-0000WC-0J for emacs-devel@gnu.org; Sat, 06 Mar 2021 04:45:02 -0500 Original-Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]:33675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lITUX-0006Hi-8B; Sat, 06 Mar 2021 04:45:01 -0500 Original-Received: by mail-oi1-x234.google.com with SMTP id a13so5480356oid.0; Sat, 06 Mar 2021 01:44:56 -0800 (PST) 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=RxRuiIWYGme+QQ9OeIE9U53oXkvksGXsSXRvhQbvOqo=; b=RtWzSL8n/Xxj+WPWVOOhNo9eWUCi0zXjNdA0s4VtaJsALG1nOtasXrDnbeccTDOcoT CIlVFhWXin7TfDKuT/VPFVgQnWBie294w0ZjPUSOsQPQaOrBPIqtVMP3NoZK1s5IPKIA PyWp9TaTMM6V5SDtu1jWoUEc5lOjuFTIwR4KQolyD/zWQu0SDOw0HxbI03PSUTSV5Dgt Qz6b813i9WKJo8KrtYeOfhRRNDfXOvLAU7+OrOlq2it4e2v8zi6rQYDcLMqxl/WaKZtc EHjseqlKu3gOJtBQ6/VIMOZUWbKFylIVhQgOIjih4bacEFEpJUDQitwHZ9hm1Yc7juch 1l2g== 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=RxRuiIWYGme+QQ9OeIE9U53oXkvksGXsSXRvhQbvOqo=; b=DRLvUhovzYHEDx13nm0BSdRp9t3clNJvozpDqPIGS30WqWEOP0j8w16tKNM5Aza2o2 7jA/zl0jR1U1pG96MAPmsyw3anBjFroVh6pbmO/dtRbbdb6MxPZUwFxiG5B1YUXM++o5 CI1nXBv1a/r9CEX2DQqf6Nzoe5pN9gmDOtsugzEYAk0zwhPZJItmKP2HQidY3eSLznGG KCYSDA4aQRg9AHouudrVLQYeV2zL7RrclxcL47Of2m73A8gIuu2SH1RRNwkKxodqeesk vWqu1Eaj7N/ei3zaHzdCQBl9SZ8TKLKyIx6m1SWV6Bt1igfWU64TPxf20FxpbTTr/4Xj chPQ== X-Gm-Message-State: AOAM533iUl42+Df8fpjatM6Zf9I94gp92EkXSnUVXFWcgDZB0aZLm/OL xsrWUcgiNduDGj+ta6t/U/LWnKjjPk7EgCKB52bCBkphf/+M3Q== X-Google-Smtp-Source: ABdhPJxvOoKpBL2n/iSRQRuBFmGtFdpWYqKhg5Er5iYkT1qjZ71DH8WfUV+fVOhQiE+iy8KOtsGWKhWddtDypEKukho= X-Received: by 2002:aca:d905:: with SMTP id q5mr9995429oig.30.1615023895650; Sat, 06 Mar 2021 01:44:55 -0800 (PST) In-Reply-To: <83sg58wu0v.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=pipcet@gmail.com; helo=mail-oi1-x234.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-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:266062 Archived-At: On Sat, Mar 6, 2021 at 8:45 AM Eli Zaretskii wrote: > > From: Pip Cet > > Date: Sat, 6 Mar 2021 07:42:20 +0000 > > Cc: emacs-devel@gnu.org > > > > * src/buffer.c (Fgenerate_new_buffer_name): Call intern ("random"). > > Previously, Fgenerate_new_buffer_name couldn't cause GC, but with this > change it can, because the modified code calls funcall. For the same > reason, it could now QUIT, where it previously couldn't. Thanks! You're quite right. > So this > change would need to be accompanied by auditing the C callers of > Fgenerate_new_buffer_name, to make sure they don't use any code that > doesn't expect any of these 2 events to happen (such as 'char *' > pointers lying around, which might become invalid after GC). I thought this code in code_conversion_save was safe: Lisp_Object name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil); workbuf = Fget_buffer_create (name, Qt); but I had misread the second argument to Fget_buffer_create: it's inhibit-hooks, not run-hooks. So I'm not sure whether code_conversion_save is allowed to call Lisp. It would really help to document the "doesn't call Lisp" and "doesn't quit" restrictions somewhere (but I'm not volunteering...) As an alternative, we could simply use get_random() % 1000000 and accept that the first 737418-ish buffer names are microscopically more likely to be used on 32-bit narrow-int systems. Pip