Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Reviewed-by: Jiri Slaby (For tty)
Reviewed-by: Lyude Paul (For nouveau)
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Reviewed-by: Paul Moore
Acked-by: Kees Cook
Cc: James Morris
Cc: "
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Johannes Berg
---
net/wireless/wext-core.c | 4 +---
1 file changed
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Vineet Gupta
Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: Borislav Petkov
//lore.kernel.org/all/20241213054610.55843-1-laoar.s...@gmail.com/
Yafang Shao (5):
kernel: Remove get_task_comm() and print task comm directly
arch: Remove get_task_comm() and print task comm directly
net: Remove get_task_comm() and print task comm directly
security: Remove get_task_comm() and pri
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Serge Hallyn
Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: Peter Zijlstra
On Fri, Dec 13, 2024 at 4:05 PM Petr Mladek wrote:
>
> On Fri 2024-12-13 13:46:04, Yafang Shao wrote:
> > Since the task->comm is guaranteed to be NUL-ternimated, we can print it
> > directly. Add a new vsnprintf format specifier "%pTN" to print task comm,
&g
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Mark Fasheh
Cc: Joel Becker
Cc: Joseph Qi
---
fs/ocfs2/clus
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Ofir Bitton
Cc: Oded Gabbay
Cc: Jani Nikula
Cc: Rodrigo Vivi
Cc: Joo
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Kees Cook
Cc: Paul Moore
Cc: James Morris
Cc: "Serge E
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Johannes Berg
---
net/wireless/wext-core.c | 6 ++
1 file changed
a subsequent patch.
Suggested-by: Linus Torvalds
Link:
https://lore.kernel.org/bpf/CAHk-=wgqrwFXK-CO8-V4fwUh5ymnUZ=wjnfyufv1dm9rc1t...@mail.gmail.com
Yafang Shao (7):
vsprintf: Add %pTN to print task name
kernel: Replace get_task_comm() with %pTN
arch: Replace get_task_comm() with %pTN
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copy it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Vineet Gupta
Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: Borislav Petkov
Since task->comm is guaranteed to be NUL-terminated, we can print it
directly without the need to copye it into a separate buffer. This
simplifies the code and avoids unnecessary operations.
Signed-off-by: Yafang Shao
Cc: Serge Hallyn
Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: Peter Zijlstra
ion, the user no longer needs to care about
retrieving task name.
checkpatch.pl is updated accordingly.
Link:
https://lore.kernel.org/bpf/CAHk-=wgqrwFXK-CO8-V4fwUh5ymnUZ=wjnfyufv1dm9rc1t...@mail.gmail.com
Suggested-by: Linus Torvalds
Signed-off-by: Yafang Shao
Cc: Andrew Morton
Cc: Petr Mladek
To prevent errors from occurring when the src string is longer than the
dst string in strcpy(), we should use strscpy() instead. This
approach also facilitates future extensions to the task comm.
Suggested-by: Justin Stitt
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Reviewed-by: Justin
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
Cc: Alejandro Colomar
---
mm/util.c
the memcpy. It
is worth noting that memcpy() is not atomic, so the new string can be
shorter when memcpy() already copied past the new NUL.
Signed-off-by: Yafang Shao
Cc: Andrew Morton
Cc: Alejandro Colomar
Cc: Andy Shevchenko
---
mm/util.c | 9 -
1 file changed, 8 insertions(+), 1 delet
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
Using strscpy() 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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Reviewed-by: Justin Stitt
Cc: Eric Paris
---
kernel
:
https://lore.kernel.org/all/CAHk-=whwtuc-ajmgjveaetkomemfstwkwu99v7+b6ayhmma...@mail.gmail.com/
Signed-off-by: Yafang Shao
Cc: Alexander Viro
Cc: Christian Brauner
Cc: Jan Kara
Cc: Eric Biederman
Cc: Kees Cook
Cc: Alexei Starovoitov
Cc: Matus Jokay
Cc: Alejandro Colomar
Cc: "Serge E. H
opping task_lock (Catalin)
v1->v2: https://lore.kernel.org/bpf/20240613023044.45873-1-laoar.s...@gmail.com/
- Add comment for dropping task_lock() in __get_task_comm() (Alexei)
- Drop changes in trace event (Steven)
- Fix comment on task comm (Matus)
v1: https://lore.kernel.org/all/20240602023754.254
On Fri, Sep 27, 2024 at 1:35 AM Andy Shevchenko
wrote:
>
> On Thu, Sep 26, 2024 at 7:44 PM Yafang Shao wrote:
> >
> > In kstrdup(), it is critical to ensure that the dest string is always
> > NUL-terminated. However, potential race condidtion can occur between a
>
>
On Fri, Sep 13, 2024 at 5:28 AM Justin Stitt wrote:
>
> Hi,
>
> On Wed, Aug 28, 2024 at 11:03:21AM GMT, Yafang Shao wrote:
> > To prevent erros from occurring when the src string is longer than the
> > dst string in strcpy(), we should use strscpy() instead. This
>
On Fri, Sep 13, 2024 at 5:14 AM Justin Stitt wrote:
>
> Hi,
>
> On Wed, Aug 28, 2024 at 11:03:17AM GMT, Yafang Shao wrote:
> > Let's explicitly ensure the destination string is NUL-terminated. This way,
> > it won't be affected by changes to the source string.
On Wed, Aug 28, 2024 at 10:04 PM Kees Cook wrote:
>
>
>
> On August 27, 2024 8:03:14 PM PDT, Yafang Shao wrote:
> >We want to eliminate the use of __get_task_comm() for the following
> >reasons:
> >
> >- The task_lock() is unnecessary
> > Quoted f
On Wed, Aug 28, 2024 at 8:58 PM Alejandro Colomar wrote:
>
> On Wed, Aug 28, 2024 at 12:15:40PM GMT, Alejandro Colomar wrote:
> > Hi Yafang,
> >
> > On Wed, Aug 28, 2024 at 11:03:14AM GMT, Yafang Shao wrote:
> > > We want to eliminate the use of __get_task_comm(
On Wed, Aug 28, 2024 at 6:33 PM Alejandro Colomar wrote:
>
> On Wed, Aug 28, 2024 at 12:32:53PM GMT, Alejandro Colomar wrote:
> > On Wed, Aug 28, 2024 at 11:03:19AM GMT, Yafang Shao wrote:
> > > These three functions follow the same pattern. To deduplicate the code,
> >
On Wed, Aug 28, 2024 at 6:15 PM Alejandro Colomar wrote:
>
> Hi Yafang,
>
> On Wed, Aug 28, 2024 at 11:03:14AM GMT, Yafang Shao wrote:
> > We want to eliminate the use of __get_task_comm() for the following
> > reasons:
> >
> > - The task_lock() is un
To prevent erros from occurring when the src string is longer than the
dst string in strcpy(), we should use strscpy() instead. This
approach also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Cc: Maarten Lankhorst
Cc: Maxime Ripard
Cc
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use strscpy() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Cc: "David S. Miller"
Cc: David Ahern
Cc: Eric Dumazet
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
Cc: Alejandro Colomar
---
mm/util.c
`s`
might be updated by the writer to a new value of task->comm.
If the new task->comm is larger than the old one, the `buf` might not be
NUL-terminated. This can lead to undefined behavior and potential
security vulnerabilities.
Let's fix it by explicitly adding a NUL terminator.
Signed-
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
Using strscpy() 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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Cc: Eric Paris
---
kernel/auditsc.c | 6 +++---
1 file
g/all/2jxak5v6dfxlpbxhpm3ey7oup4g2lnr3ueurfbosf5wdo65dk4@srb3hsk72zwq
Signed-off-by: Yafang Shao
Cc: Alexander Viro
Cc: Christian Brauner
Cc: Jan Kara
Cc: Eric Biederman
Cc: Kees Cook
Cc: Alexei Starovoitov
Cc: Matus Jokay
Cc: Alejandro Colomar
Cc: "Serge E. Hallyn"
---
fs/exec.c | 10 --
fs/proc/arr
@gmail.com/
- Add comment for dropping task_lock() in __get_task_comm() (Alexei)
- Drop changes in trace event (Steven)
- Fix comment on task comm (Matus)
v1: https://lore.kernel.org/all/20240602023754.25443-1-laoar.s...@gmail.com/
Yafang Shao (8):
Get rid of __get_task_comm()
auditsc: Replace m
On Mon, Aug 26, 2024 at 5:25 PM Alejandro Colomar wrote:
>
> Hi Yafang,
>
> On Sat, Aug 17, 2024 at 10:58:02AM GMT, Alejandro Colomar wrote:
> > Hi Yafang,
> >
> > On Sat, Aug 17, 2024 at 10:56:22AM GMT, Yafang Shao wrote:
> > > These three functions foll
On Sat, Aug 17, 2024 at 10:56 AM Yafang Shao wrote:
>
> Using {memcpy,strncpy,strcpy,kstrdup} to copy the task comm relies on the
> length of task comm. Changes in the task comm could result in a destination
> string that is overflow. Therefore, we should explicitly ensure the
&
On Sat, Aug 17, 2024 at 4:39 PM Alejandro Colomar wrote:
>
> Hi Yafang,
>
> On Sat, Aug 17, 2024 at 10:56:20AM GMT, Yafang Shao wrote:
> > Let's explicitly ensure the destination string is NUL-terminated. This way,
> > it won't be affected by changes to the so
To prevent erros from occurring when the src string is longer than the
dst string in strcpy(), we should use strscpy() instead. This
approach also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Cc: Maarten Lankhorst
Cc: Maxime Ripard
Cc
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use strscpy() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Cc: "David S. Miller"
Cc: David Ahern
Cc: Eric Dumazet
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
---
mm/util.c | 67 +
`s`
might be updated by the writer to a new value of task->comm.
If the new task->comm is larger than the old one, the `buf` might not be
NUL-terminated. This can lead to undefined behavior and potential
security vulnerabilities.
Let's fix it by explicitly adding a NUL-terminator.
Signed-
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
Using strscpy() 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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Cc: Eric Paris
---
kernel/auditsc.c | 6 +++---
1 file
g/all/2jxak5v6dfxlpbxhpm3ey7oup4g2lnr3ueurfbosf5wdo65dk4@srb3hsk72zwq
Signed-off-by: Yafang Shao
Cc: Alexander Viro
Cc: Christian Brauner
Cc: Jan Kara
Cc: Eric Biederman
Cc: Kees Cook
Cc: Alexei Starovoitov
Cc: Matus Jokay
Cc: Alejandro Colomar
Cc: "Serge E. Hallyn"
---
fs/exec.c | 10 --
fs/proc/arr
kstrdup (Andrew)
- Add commit log for dropping task_lock (Catalin)
v1->v2: https://lore.kernel.org/bpf/20240613023044.45873-1-laoar.s...@gmail.com/
- Add comment for dropping task_lock() in __get_task_comm() (Alexei)
- Drop changes in trace event (Steven)
- Fix comment on task comm (Matus)
v1
On Wed, Aug 14, 2024 at 6:31 AM Justin Stitt wrote:
>
> On Tue, Aug 13, 2024 at 3:19 PM Justin Stitt wrote:
> >
> > Hi,
> >
> > On Mon, Aug 12, 2024 at 10:29:31AM GMT, Yafang Shao wrote:
> > > Using strscpy() to read the task comm ensures that the name is
On Mon, Aug 12, 2024 at 4:05 PM Alejandro Colomar wrote:
>
> Hi Yafang,
>
> On Mon, Aug 12, 2024 at 10:29:25AM GMT, Yafang Shao wrote:
> > We want to eliminate the use of __get_task_comm() for the following
> > reasons:
> >
> > - The task_lock() is un
To prevent erros from occurring when the src string is longer than the
dst string in strcpy(), we should use strscpy() instead. This
approach also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Cc: Maarten Lankhorst
Cc: Maxime Ripard
Cc
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use strscpy() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Cc: "David S. Miller"
Cc: David Ahern
Cc: Eric Dumazet
Using strscpy() 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.
Signed-off-by: Yafang Shao
Acked-by: Masami Hiramatsu (Google)
Cc: Steven Rostedt
Cc: Mathieu Desnoyers
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
---
mm/util.c | 67 +
`s`
might be updated by the writer to a new value of task->comm.
If the new task->comm is larger than the old one, the `buf` might not be
NUL-terminated. This can lead to undefined behavior and potential
security vulnerabilities.
Let's fix it by explicitly adding a NUL-terminator.
Signed-
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
Using strscpy() 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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Cc: Eric Paris
---
kernel/auditsc.c | 6 +++---
1 file
g/all/2jxak5v6dfxlpbxhpm3ey7oup4g2lnr3ueurfbosf5wdo65dk4@srb3hsk72zwq
Signed-off-by: Yafang Shao
Cc: Alexander Viro
Cc: Christian Brauner
Cc: Jan Kara
Cc: Eric Biederman
Cc: Kees Cook
Cc: Alexei Starovoitov
Cc: Matus Jokay
Cc: Alejandro Colomar
Cc: "Serge E. Hallyn"
---
fs/exec.c | 10 --
fs/proc/arr
(Andrew)
- Add commit log for dropping task_lock (Catalin)
v1->v2: https://lore.kernel.org/bpf/20240613023044.45873-1-laoar.s...@gmail.com/
- Add comment for dropping task_lock() in __get_task_comm() (Alexei)
- Drop changes in trace event (Steven)
- Fix comment on task comm (Matus)
Yafang Shao (9):
On Wed, Aug 7, 2024 at 1:28 AM Alejandro Colomar wrote:
>
> Hi Linus,
>
> Serge let me know about this thread earlier today.
>
> On 2024-08-05, Linus Torvalds wrote:
> > On Mon, 5 Aug 2024 at 20:01, Yafang Shao wrote:
> > >
> > > One concern about
On Tue, Aug 6, 2024 at 11:10 AM Linus Torvalds
wrote:
>
> On Mon, 5 Aug 2024 at 20:01, Yafang Shao wrote:
> >
> > One concern about removing the BUILD_BUG_ON() is that if we extend
> > TASK_COMM_LEN to a larger size, such as 24, the caller with a
> > hardcoded 16-by
On Tue, Aug 6, 2024 at 5:28 AM Linus Torvalds
wrote:
>
> On Sun, 4 Aug 2024 at 00:56, Yafang Shao wrote:
> >
> > There is a BUILD_BUG_ON() inside get_task_comm(), so when you use
> > get_task_comm(), it implies that the BUILD_BUG_ON() is necessary.
>
> Let's
To prevent erros from occurring when the src string is longer than the
dst string in strcpy(), we should use __get_task_comm() instead. This
approach also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Cc: Maarten Lankhorst
Cc: Maxime Ripard
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use __get_task_comm() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Cc: "David S. Miller"
Cc: David Ahern
Cc: Eric D
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.
Signed-off-by: Yafang Shao
Acked-by: Masami Hiramatsu (Google)
Cc: Steven Rostedt
Cc: Mathieu
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
---
mm/util.c | 67 +
`s`
might be updated by the writer to a new value of task->comm.
If the new task->comm is larger than the old one, the `buf` might not be
NUL-terminated. This can lead to undefined behavior and potential
security vulnerabilities.
Let's fix it by explicitly adding a NUL-terminator.
Signed-
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Cc: Eric Paris
---
kernel/auditsc.c | 6 +++---
1
could have
long-term mixed results
Suggested-by: Linus Torvalds
Link:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com
[0]
Signed-off-by: Yafang Shao
Cc: Alexander Viro
Cc: Christian Brauner
Cc: Jan Kara
Cc: Eric Biederman
Cc: Kees Cook
Cc
ound kstrdup (Andrew)
- Add commit log for dropping task_lock (Catalin)
v1->v2: https://lore.kernel.org/bpf/20240613023044.45873-1-laoar.s...@gmail.com/
- Add comment for dropping task_lock() in __get_task_comm() (Alexei)
- Drop changes in trace event (Steven)
- Fix comment on task comm (Matus)
v1: https
On Wed, Jul 31, 2024 at 8:59 AM Andrew Morton wrote:
>
> On Mon, 29 Jul 2024 10:37:08 +0800 Yafang Shao wrote:
>
> > Is it appropriate for you to apply this to the mm tree?
>
> There are a couple of minor conflicts against current 6.11-rc1 which
> you'd best check.
On Mon, Jul 29, 2024 at 5:29 PM Jani Nikula wrote:
>
> On Mon, 29 Jul 2024, Yafang Shao wrote:
> > Hello Andrew,
> >
> > Is it appropriate for you to apply this to the mm tree?
> >
> > Using {memcpy,strncpy,strcpy,kstrdup} to copy the task comm relies on the
To prevent erros from occurring when the src string is longer than the
dst string in strcpy(), we should use __get_task_comm() instead. This
approach also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Cc: Maarten Lankhorst
Cc: Maxime Ripard
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use __get_task_comm() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Cc: "David S. Miller"
Cc: David Ahern
Cc: Eric D
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.
Signed-off-by: Yafang Shao
Acked-by: Masami Hiramatsu (Google)
Cc: Steven Rostedt
Cc: Mathieu
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.
Signed-off-by: Yafang Shao
---
kernel/tsacct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion
ff-by: Yafang Shao
Acked-by: Catalin Marinas
Cc: Andrew Morton
---
mm/kmemleak.c | 8 +---
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index d5b6fba44fc9..ef29aaab88a0 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -663,13 +663,7 @@ static s
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
---
mm/util.c | 67 +
`s`
might be updated by the writer to a new value of task->comm.
If the new task->comm is larger than the old one, the `buf` might not be
NUL-terminated. This can lead to undefined behavior and potential
security vulnerabilities.
Let's fix it by explicitly adding a NUL-terminator.
Signed-
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Cc: Eric Paris
---
kernel/auditsc.c | 6 +++---
1
could have
long-term mixed results
Suggested-by: Linus Torvalds
Link:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com
[0]
Signed-off-by: Yafang Shao
Cc: Alexander Viro
Cc: Christian Brauner
Cc: Jan Kara
Cc: Eric Biederman
Cc: Kees Cook
Cc
: https://lore.kernel.org/all/20240602023754.25443-1-laoar.s...@gmail.com/
Yafang Shao (11):
fs/exec: Drop task_lock() inside __get_task_comm()
auditsc: Replace memcpy() with __get_task_comm()
security: Replace memcpy() with __get_task_comm()
bpftool: Ensure task comm is always NUL
To prevent erros from occurring when the src string is longer than the
dst string in strcpy(), we should use __get_task_comm() instead. This
approach also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Acked-by: Daniel Vetter
Cc: Maarten Lankhorst
Cc: Maxime Ripard
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use __get_task_comm() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
Cc: "David S. Miller"
Cc: David Ahern
Cc: Eric D
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.
Signed-off-by: Yafang Shao
Acked-by: Masami Hiramatsu (Google)
Cc: Steven Rostedt
Cc: Mathieu
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.
Signed-off-by: Yafang Shao
---
kernel/tsacct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion
ff-by: Yafang Shao
Acked-by: Catalin Marinas
Cc: Andrew Morton
---
mm/kmemleak.c | 8 +---
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index d5b6fba44fc9..ef29aaab88a0 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -663,13 +663,7 @@ static s
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common helper __kmemdup_nul().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
Cc: Simon Horman
Cc: Matthew Wilcox
---
mm/util.c | 67 +
`s`
might be updated by the writer to a new value of task->comm.
If the new task->comm is larger than the old one, the `buf` might not be
NUL-terminated. This can lead to undefined behavior and potential
security vulnerabilities.
Let's fix it by explicitly adding a NUL-terminator.
Signed-
Let's explicitly ensure the destination string is NUL-terminated. This way,
it won't be affected by changes to the source string.
Signed-off-by: Yafang Shao
Reviewed-by: Quentin Monnet
---
tools/bpf/bpftool/pids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftoo
facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao
LINK:
https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npjoop8chlpefafv0onyt...@mail.gmail.com/
[0]
Acked-by: Paul Moore
Cc: James Morris
Cc: "Serge E. Hallyn"
Cc: Stephen Smalley
Cc: Ondrej Mosnacek
---
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.
Signed-off-by: Yafang Shao
Acked-by: Paul Moore
Cc: Eric Paris
---
kernel/auditsc.c | 6 +++---
1
1 - 100 of 132 matches
Mail list logo