Skip to content
Snippets Groups Projects
Forked from drm / kernel
Source project has a limited visibility.
  • Yafang Shao's avatar
    d4ee4ac3
    security: replace memcpy() with get_task_comm() · d4ee4ac3
    Yafang Shao authored
    Quoted from Linus [0]:
    
      selinux never wanted a lock, and never wanted any kind of *consistent*
      result, it just wanted a *stable* result.
    
    Using get_task_comm() to read the task comm ensures that the name is
    always NUL-terminated, regardless of the source string. This approach also
    facilitates future extensions to the task comm.
    
    Link: https://lkml.kernel.org/r/20241007144911.27693-4-laoar.shao@gmail.com
    
    
    Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
    Link: https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npJooP8chLPEfaFV0oNYTTBA@mail.gmail.com/
    
     [0]
    Acked-by: default avatarPaul Moore <paul@paul-moore.com>
    Cc: James Morris <jmorris@namei.org>
    Cc: "Serge E. Hallyn" <serge@hallyn.com>
    Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
    Cc: Ondrej Mosnacek <omosnace@redhat.com>
    Cc: Alejandro Colomar <alx@kernel.org>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
    Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Cc: David Airlie <airlied@gmail.com>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Eric Paris <eparis@redhat.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Justin Stitt <justinstitt@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Matus Jokay <matus.jokay@stuba.sk>
    Cc: Maxime Ripard <mripard@kernel.org>
    Cc: Quentin Monnet <qmo@kernel.org>
    Cc: Simon Horman <horms@kernel.org>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Thomas Zimmermann <tzimmermann@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    d4ee4ac3
    History
    security: replace memcpy() with get_task_comm()
    Yafang Shao authored
    Quoted from Linus [0]:
    
      selinux never wanted a lock, and never wanted any kind of *consistent*
      result, it just wanted a *stable* result.
    
    Using get_task_comm() to read the task comm ensures that the name is
    always NUL-terminated, regardless of the source string. This approach also
    facilitates future extensions to the task comm.
    
    Link: https://lkml.kernel.org/r/20241007144911.27693-4-laoar.shao@gmail.com
    
    
    Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
    Link: https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npJooP8chLPEfaFV0oNYTTBA@mail.gmail.com/
    
     [0]
    Acked-by: default avatarPaul Moore <paul@paul-moore.com>
    Cc: James Morris <jmorris@namei.org>
    Cc: "Serge E. Hallyn" <serge@hallyn.com>
    Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
    Cc: Ondrej Mosnacek <omosnace@redhat.com>
    Cc: Alejandro Colomar <alx@kernel.org>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
    Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Cc: David Airlie <airlied@gmail.com>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Eric Paris <eparis@redhat.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Justin Stitt <justinstitt@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Matus Jokay <matus.jokay@stuba.sk>
    Cc: Maxime Ripard <mripard@kernel.org>
    Cc: Quentin Monnet <qmo@kernel.org>
    Cc: Simon Horman <horms@kernel.org>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Thomas Zimmermann <tzimmermann@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>