add stressors for recursive mounts

Bug #1542010 reported by Seth Arnold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stress-ng
Fix Released
Medium
Colin Ian King
stress-ng (Ubuntu)
Fix Released
Medium
Colin Ian King

Bug Description

I saw an interesting exchange on LKML the other day about user namespaces then allowing users to perform mounts, leading to unbounded kernel memory use:

http://marc.info/?l=linux-kernel&m=145349682207690&w=2

"what you are doing is essentially mount --rbind / / in infinite
loop in luserns. Which ends up eating all memory."

http://marc.info/?l=linux-kernel&m=145349772807910&w=2

This might be a useful direction to take stress-ng if it doesn't already perform unprivileged user mounts.

Thanks

Changed in stress-ng (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
Changed in stress-ng:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
summary: - recursive mounts
+ add stressors for recursive mounts
Revision history for this message
Colin Ian King (colin-king) wrote :

I got the reproducer down to the following minimal code:

#define _GNU_SOURCE
#include <unistd.h>
#include <sched.h>
#include <sys/wait.h>
#include <sys/mount.h>

int loop(void *arg)
{
        for (;;)
            mount("/", "/", "", MS_BIND | MS_REC, 0);
        return 0;
}

int main()
{
        int pid, status;
        char stack[65536];

        pid = clone(loop, &stack[sizeof(stack)-8], CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWPID, 0, 0);
        while (waitpid(pid, &status, __WALL) != pid);
        return 0;
}

Revision history for this message
Colin Ian King (colin-king) wrote :
Changed in stress-ng (Ubuntu):
status: In Progress → Fix Committed
Changed in stress-ng:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package stress-ng - 0.05.14-1

---------------
stress-ng (0.05.14-1) unstable; urgency=medium

  * Makefile: bump version
  * Fix make dist - typo in test-libpthread.c
  * stress-fiemap: initialise counter at start of loop
  * stress-fiemap: ensure counter is being updated
  * adt: exclude bind mount from list of stressors
  * Don't emit warning on --pathological if number of stressors is zero
  * ignite-cpu: add null entry at end of list, don't scan by array size
  * Only include <sys/mount.h> for linux for the bind mount stressor
  * stress-bind-mount: build stressor if STRESS_BIND_MOUNT defined
  * stress-bind-mount: stop cppcheck whining about uninitialised pid
  * stress-numa: don't fatally fail on -EIO with MPOL_MF_STRICT (LP: #1542741)
  * Enabled IGNITE_CPU with the --aggressive option
  * Add bind-mount stressor (LP: #1542010)
  * Add --ignite-cpu option to maximize CPU frequency
  * Make float decimal auto detect set -DHAVE_FLOAT_DECIMAL
  * Minor re-org of Makefile, and add more files to dist rule
  * Update README - increase number of stressors
  * adt tests: remove membarrier, it fails on older kernels in Debian
  * Add some more comments
  * stress-affinity: handle EINVAL when CPU(s) are offline
  * Set number of instances to on-line CPUs if N is -ve (LP: #1513546)
  * Remove opt_long, replace with get_int32 or get_uint64
  * Add libpthread build time checks
  * Add librt build time checks
  * Remove commented out old link line
  * Add libcrypt check
  * Makefile: remove test-libz correctly
  * stress-cpu: make source 80 column friendly
  * Add FORCE_DO_NOTHING macro do force compiler to stop opimizing out loops
  * Add zlib stressor
  * stress-stream: cater for systems without L3 cache
  * stress-stream: only emit cache size info on instance 0
  * Add libbsd-dev to README

 -- Colin King <email address hidden> Mon, 8 Feb 2016 18:29:11 +0000

Changed in stress-ng (Ubuntu):
status: Fix Committed → Fix Released
Changed in stress-ng:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.