From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 36279@debbugs.gnu.org, xuchunyang <mail@xuchunyang.me>,
npostavs@gmail.com
Subject: bug#36279: 26.2.90; (process-attributes nonexistent-pid) segmentation fault
Date: Tue, 18 Jun 2019 19:53:06 +0200 [thread overview]
Message-ID: <m2wohilr0d.fsf@gmail.com> (raw)
In-Reply-To: <83lfxyss8m.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 18 Jun 2019 20:44:41 +0300")
>>>>> On Tue, 18 Jun 2019 20:44:41 +0300, Eli Zaretskii <eliz@gnu.org> said:
>> Date: Wed, 19 Jun 2019 00:23:20 +0800
>> From: xuchunyang <mail@xuchunyang.me>
>> Cc: 36279@debbugs.gnu.org, Noam Postavsky <npostavs@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
next prev parent reply other threads:[~2019-06-18 17:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 13:25 bug#36279: 26.2.90; (process-attributes nonexistent-pid) segmentation fault Xu Chunyang
2019-06-18 13:31 ` Noam Postavsky
2019-06-18 14:05 ` xuchunyang
2019-06-18 15:23 ` Robert Pluim
2019-06-18 16:23 ` xuchunyang
2019-06-18 17:44 ` Eli Zaretskii
2019-06-18 17:53 ` Robert Pluim [this message]
2019-06-18 18:06 ` Eli Zaretskii
2019-06-18 18:14 ` Robert Pluim
2019-06-19 7:06 ` Robert Pluim
2019-06-19 8:01 ` Andreas Schwab
2019-06-19 10:21 ` Robert Pluim
2019-06-19 10:29 ` Andreas Schwab
2019-06-19 13:40 ` Robert Pluim
2019-06-19 15:15 ` Eli Zaretskii
2019-06-20 8:46 ` Robert Pluim
2019-06-18 16:10 ` Eli Zaretskii
2019-06-18 16:07 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2wohilr0d.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=36279@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=mail@xuchunyang.me \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).