Skip to content

Commit

Permalink
mm: increase the default mlock limit from 32k to 64k
Browse files Browse the repository at this point in the history
By default, non-privileged tasks can only mlock() a small amount of
memory to avoid a DoS attack by ordinary users.  The Linux kernel
defaulted to 32k (on a 4k page size system) to accommodate the needs of
gpg.

However, newer gpg2 needs 64k in various circumstances and otherwise
fails miserably, see bnc#329675.

Change the default to 64k, and make it more agnostic to PAGE_SIZE.

Signed-off-by: Kurt Garloff <garloff@suse.de>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Kurt Garloff authored and Linus Torvalds committed Oct 30, 2008
1 parent e946217 commit 0833422
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ struct rlimit {
#define _STK_LIM (8*1024*1024)

/*
* GPG wants 32kB of mlocked memory, to make sure pass phrases
* GPG2 wants 64kB of mlocked memory, to make sure pass phrases
* and other sensitive information are never written to disk.
*/
#define MLOCK_LIMIT (8 * PAGE_SIZE)
#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)

/*
* Due to binary compatibility, the actual resource numbers
Expand Down

0 comments on commit 0833422

Please sign in to comment.