GNU bug report logs - #36279
26.2.90; (process-attributes nonexistent-pid) segmentation fault

Previous Next

Package: emacs;

Reported by: Xu Chunyang <mail <at> xuchunyang.me>

Date: Tue, 18 Jun 2019 13:27:02 UTC

Severity: normal

Tags: fixed

Found in version 26.2.90

Fixed in version 26.3

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 36279 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 36279 <at> debbugs.gnu.org, xuchunyang <mail <at> xuchunyang.me>, npostavs <at> gmail.com
Subject: Re: bug#36279: 26.2.90;
 (process-attributes nonexistent-pid) segmentation fault
Date: Tue, 18 Jun 2019 19:53:06 +0200
>>>>> On Tue, 18 Jun 2019 20:44:41 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> Date: Wed, 19 Jun 2019 00:23:20 +0800
    >> From: xuchunyang <mail <at> xuchunyang.me>
    >> Cc: 36279 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
    >> 
    >> It fixes the issue for me too. (process-attributes 123456) returns nil instead of crashing Emacs.
    >> 
    >> > 
    >> > diff --git a/src/sysdep.c b/src/sysdep.c
    >> > index 1e35e06b63..518ecebcf6 100644
    >> > --- a/src/sysdep.c
    >> > +++ b/src/sysdep.c
    >> > @@ -3798,7 +3798,7 @@ system_process_attributes (Lisp_Object pid)
    >> >    CONS_TO_INTEGER (pid, int, proc_id);
    >> >    mib[3] = proc_id;
    >> >  
    >> > -  if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
    >> > +  if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0 || proclen == 0)
    >> >      return attrs;
    >> >  
    >> >    uid = proc.kp_eproc.e_ucred.cr_uid;
    >> >

    Eli> Thanks.  Robert, please push to the emacs-26 branch.

Will do.

    Eli> (I understand this problem is quite old, is that right?)

commit ef4ed84e72a323b3d29dc34df92d3f89ad4fc322
Date:   Sun Apr 24 14:33:05 2016 +0200

introduced the macOS version of system_process_attributes.

list_system_processes (on macOS and FreeBSD) and
system_process_attributes(on FreeBSD) potentially have similar issues
with sysctl. Would you like a defensive patch for those? (I donʼt have
a FreeBSD system to test on)

Robert




This bug report was last modified 5 years and 342 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.