Bug 227104 - sysutils/p5-BSD-Process list method causes segmentation fault
Summary: sysutils/p5-BSD-Process list method causes segmentation fault
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Steve Wills
URL:
Keywords:
: 227335 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-03-30 09:02 UTC by Barrie
Modified: 2018-04-07 02:05 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (swills)


Attachments
patch to fix bug (1.42 KB, patch)
2018-04-07 01:30 UTC, Steve Wills
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Barrie 2018-03-30 09:02:43 UTC
The list method of BMD::Process causes a segmentation fault.

$ perl -MBSD::Process -e 'print $BSD::Process::VERSION';
0.07
$ freebsd-version
11.1-RELEASE-p8
$ perl -e 'use BSD::Process; my @pid = BSD::Process::list;'
Segmentation fault (core dumped)

The perl version is v5.24.3

This also happens if you use the following command which is taken from the CPAN page (http://search.cpan.org/~dland/BSD-Process-0.07/Process.pm)

$ perl -e 'use BSD::Process; my @pid = BSD::Process::list; for my $p (@pid) {my $proc =  BSD::Process::info($p); print "$p $proc->{ppid}\n"; }'
Segmentation fault (core dumped)

Extra information:
This error appears to occur because the XS code does not handle multiple returned values properly and corrupts the stack, specifically the mPUSHi macro at line 504 of Process.xs does not appear to extend the stack. If the loop there is preceded by an EXTEND(SP,nr) the test works. (Diagnosis by others)
Comment 1 Steve Wills freebsd_committer freebsd_triage 2018-04-07 01:30:37 UTC
Created attachment 192300 [details]
patch to fix bug

Try this patch, I think it's what you described and it seems to fix it for me.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-04-07 02:02:40 UTC
A commit references this bug:

Author: swills
Date: Sat Apr  7 02:02:07 UTC 2018
New revision: 466704
URL: https://svnweb.freebsd.org/changeset/ports/466704

Log:
  sysutils/p5-BSD-Process: fix seg fault on 11.1 and newer

  PR:		227104
  Reported by:	Barrie <freebsdbugs@myarcher.net>

Changes:
  head/sysutils/p5-BSD-Process/Makefile
  head/sysutils/p5-BSD-Process/files/patch-Process.xs
Comment 3 Steve Wills freebsd_committer freebsd_triage 2018-04-07 02:05:04 UTC
Patch fixed it in my testing, let me know if you still run into issues.
Comment 4 Steve Wills freebsd_committer freebsd_triage 2018-04-07 02:05:49 UTC
*** Bug 227335 has been marked as a duplicate of this bug. ***