1. 06 Jan, 2022 2 commits
    • Tejun Heo's avatar
      cgroup: Allocate cgroup_file_ctx for kernfs_open_file->priv · 0d2b5955
      Tejun Heo authored
      of->priv is currently used by each interface file implementation to store
      private information. This patch collects the current two private data usages
      into struct cgroup_file_ctx which is allocated and freed by the common path.
      This allows generic private data which applies to multiple files, which will
      be used to in the following patch.
      
      Note that cgroup_procs iterator is now embedded as procs.iter in the new
      cgroup_file_ctx so that it doesn't need to be allocated and freed
      separately.
      
      v2: union dropped from cgroup_file_ctx and the procs iterator is embedded in
          cgroup_file_ctx as suggested by Linus.
      
      v3: Michal pointed out that cgroup1's procs pidlist uses of->priv too.
          Converted. Didn't change to embedded allocation as cgroup1 pidlists get
          stored for caching.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Reviewed-by: default avatarMichal Koutný <mkoutny@suse.com>
      0d2b5955
    • Tejun Heo's avatar
      cgroup: Use open-time credentials for process migraton perm checks · 1756d799
      Tejun Heo authored
      cgroup process migration permission checks are performed at write time as
      whether a given operation is allowed or not is dependent on the content of
      the write - the PID. This currently uses current's credentials which is a
      potential security weakness as it may allow scenarios where a less
      privileged process tricks a more privileged one into writing into a fd that
      it created.
      
      This patch makes both cgroup2 and cgroup1 process migration interfaces to
      use the credentials saved at the time of open (file->f_cred) instead of
      current's.
      Reported-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linuxfoundation.org>
      Fixes: 187fe840 ("cgroup: require write perm on common ancestor when moving processes on the default hierarchy")
      Reviewed-by: default avatarMichal Koutný <mkoutny@suse.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      1756d799
  2. 05 Jan, 2022 7 commits
  3. 04 Jan, 2022 17 commits
  4. 03 Jan, 2022 4 commits
  5. 02 Jan, 2022 10 commits