Bug 24986

Summary: Doing scalar(`ag -s '[ \\t]' .`) in perl causes the system to freeze
Product: Mageia Reporter: Shlomi Fish <shlomif>
Component: RPM PackagesAssignee: Kernel and Drivers maintainers <kernel>
Status: NEW --- QA Contact:
Severity: critical    
Priority: Normal CC: marja11
Version: Cauldron   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: kernel-5.1.11-1.mga7.src.rpm CVE:
Status comment:

Description Shlomi Fish 2019-06-21 12:06:33 CEST
Description of problem:

I wrote some misguided perl 5 code to search for trailing space which causes the RAM consumption to balloon and the system to freeze. Tried doing 
ulimit -Hm $((3500 * 1024)) in zsh and it did not help:

The code is:

```
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 1;

# TEST
like( scalar(`ag -s '[ \\t]' .`),
    qr#\A[\r\n]*\z#, "No trailing space was found." );
```

Version-Release number of selected component (if applicable):

mga7

How reproducible:

always

Steps to Reproduce:
1. urpmi perl perl-Test-More the_silver_searcher
2. Run the code e.g in a https://github.com/shlomif/freecell-pro-0fc-deals clone.

I have 7-8 GB of ram and 64 gb of swap.
3.
Comment 1 Marja Van Waes 2019-06-23 18:48:51 CEST
Assigning to the kernel maintainers, because Shlomi assigned it to kernel-5.1.11-1.mga7.src.rpm

Assignee: bugsquad => kernel
CC: (none) => marja11

Comment 2 Shlomi Fish 2020-08-21 11:05:28 CEST
Replying to myself, I'd like to note that using "ulimit -H -d" appears to help:

```
ulimit -H -d $((1000 * 1000))
perl ~/consume-ram.pl
```

maybe "-m" is not enforced.