Hello, thanks for this report; note that with proper quoting this can be
pasted into a bash shell without any trouble:

$ echo 
'[{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0},{"a":{"a":0,"b":"0","c":"0"},"d":0,"e":0}]'
 > /tmp/foo
$ ps ux | grep [b]ash
sarnold   1029  0.1  0.3  27092  3820 pts/0    Ss   12:24   0:00 -bash

There's an almost endless number of fun ways to consume all system
resources from a shell prompt; the shortest example I know is :(){ :|:&
};:   --- this little shell function calls itself in a beautiful little
forkbomb that brings most machines to their knees in seconds.

It's possible to protect against resource consumption problems like this
but it often times limits too drastically what the computer can actually
be used for. (Say, you may choose to limit the amount of memory that a
user can consume by limiting how much memory their processes can use,
and then how many processes they can start, and the limit is the product
of the two -- but that means they can't run one really big scientific
simulation or work with a single large movie file. Or if you allow a lot
of memory but only a few processes, it'll prevent them from running a
highly multi-threaded program.)

There's multiple mechanisms available to provide resource controls: see
the setrlimit(2) manpage, the 'ulimit' entries in the bash(1) manpage,
the limits.conf(5) manpage, and the cgroups documentation, including
https://www.kernel.org/doc/Documentation/cgroup-v1/pids.txt and
https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt . (No, it
isn't easy, which is why the defaults are very trusting...)

Thanks

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1607468

Title:
  bash/system crashes when entering json as a command and executing it

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/1607468/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to