Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • kernel
  • sysctl.c
Find file BlameHistoryPermalink
  • Christian Brauner's avatar
    sysctl: handle overflow for file-max · 20affa60
    Christian Brauner authored Mar 07, 2019
    BugLink: https://bugs.launchpad.net/bugs/1828420
    
    [ Upstream commit 32a5ad9c ]
    
    Currently, when writing
    
      echo 18446744073709551616 > /proc/sys/fs/file-max
    
    /proc/sys/fs/file-max will overflow and be set to 0.  That quickly
    crashes the system.
    
    This commit sets the max and min value for file-max.  The max value is
    set to long int.  Any higher value cannot currently be used as the
    percpu counters are long ints and not unsigned integers.
    
    Note that the file-max value is ultimately parsed via
    __do_proc_doulongvec_minmax().  This function does not report error when
    min or max are exceeded.  Which means if a value largen that long int is
    written userspace will not receive an error instead the old value will be
    kept.  There is an argument to be made that this should be changed and
    __do_proc_doulongvec_minmax() should return an error when a dedicated min
    or max value are exceeded.  However this has the potential to break
    userspace so let's defer this to an RFC patch.
    
    Link: http://lkml.kernel.org/r/20190107222700.15954-3-christian@brauner.io
    
    
    Signed-off-by: default avatarChristian Brauner <christian@brauner.io>
    Acked-by: default avatarKees Cook <keescook@chromium.org>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Dominik Brodowski <linux@dominikbrodowski.net>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Joe Lawrence <joe.lawrence@redhat.com>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Waiman Long <longman@redhat.com>
    [christian@brauner.io: v4]
      Link: http://lkml.kernel.org/r/20190210203943.8227-3-christian@brauner.io
    
    
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
    Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
    20affa60
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7