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
  • fs
  • proc
  • array.c
Find file BlameHistoryPermalink
  • Michael Weiß's avatar
    fs/proc: apply the time namespace offset to /proc/stat btime · 3ae700ec
    Michael Weiß authored Oct 27, 2020
    
    
    '/proc/stat' provides the field 'btime' which states the time stamp of
    system boot in seconds. In case of time namespaces, the offset to the
    boot time stamp was not applied earlier.
    This confuses tasks which are in another time universe, e.g., in a
    container of a container runtime which utilize time namespaces to
    virtualize boottime.
    
    Therefore, we make procfs to virtualize also the btime field by
    subtracting the offset of the timens boottime from 'btime' before
    printing the stats.
    
    Since start_boottime of processes are seconds since boottime and the
    boottime stamp is now shifted according to the timens offset, the
    offset of the time namespace also needs to be applied before the
    process stats are given to userspace.
    
    This avoids that processes shown, e.g., by 'ps' appear as time
    travelers in the corresponding time namespace.
    
    Signed-off-by: default avatarMichael Weiß <michael.weiss@aisec.fraunhofer.de>
    Reviewed-by: default avatarAndrei Vagin <avagin@gmail.com>
    Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
    Link: https://lore.kernel.org/r/20201027204258.7869-3-michael.weiss@aisec.fraunhofer.de
    3ae700ec
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7