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 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
@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
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
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
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
---
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
`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-
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
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
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
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
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 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 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
: 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
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
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
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
---
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
`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-
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 +
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
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
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
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
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
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
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.
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
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
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
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
---
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
`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-
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 +
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
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
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
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
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 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
(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):
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
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
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
---
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
`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-
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 +
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
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
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
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
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
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
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
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
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
---
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
`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-
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 +
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
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
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
On Fri, Jun 14, 2024 at 6:57 PM Catalin Marinas wrote:
>
> On Thu, Jun 13, 2024 at 08:10:17PM +0800, Yafang Shao wrote:
> > On Thu, Jun 13, 2024 at 4:37 PM Catalin Marinas
> > wrote:
> > > On Thu, Jun 13, 2024 at 10:30:40AM +0800, Yafang Shao wrote:
> > > &
- Fix comment on task comm (Matus)
v1: 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 c
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
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
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
---
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
`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-
These three functions follow the same pattern. To deduplicate the code,
let's introduce a common help __kstrndup().
Suggested-by: Andrew Morton
Signed-off-by: Yafang Shao
---
mm/internal.h | 24
mm/util.c | 27 ---
2 files change
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
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
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
Cc: Steven Rostedt
Cc: Masami Hiramatsu
Cc: Mathieu Desnoyers
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
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
Cc: Maarten Lankhorst
Cc: Maxime Ripard
Cc: Thomas Zimmermann
On Fri, Jun 21, 2024 at 9:51 PM Simon Horman wrote:
>
> On Fri, Jun 21, 2024 at 10:29:54AM +0800, Yafang Shao wrote:
> > These three functions follow the same pattern. To deduplicate the code,
> > let's introduce a common help __kstrndup().
> >
> > Suggested-b
On Fri, Jun 21, 2024 at 9:57 PM Matthew Wilcox wrote:
>
> On Fri, Jun 21, 2024 at 10:29:54AM +0800, Yafang Shao wrote:
> > +++ b/mm/internal.h
>
> Why are you putting __kstrndup in a header file when it's only used
> in util.c?
I want to make it always inlined. However
On Sun, Jun 23, 2024 at 11:11 AM Matthew Wilcox wrote:
>
> On Sun, Jun 23, 2024 at 10:29:30AM +0800, Yafang Shao wrote:
> > On Fri, Jun 21, 2024 at 9:57 PM Matthew Wilcox wrote:
> > >
> > > On Fri, Jun 21, 2024 at 10:29:54AM +0800, Yafang Shao wrote:
> > >
n)
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.25443-1-laoar.s...@gmail.c
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
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
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
---
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
`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-
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 +
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
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
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
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
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
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 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
>
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
Cc: Maarten Lankhorst
Cc: Maxime Ripard
Cc: Thomas Zimmermann
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
Cc: Catalin Marinas
Cc: Andrew Morton
---
mm/kmemleak.c | 8 +---
1
- 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 (10):
fs/exec: Drop task_lock() inside __get_task_comm()
auditsc:
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
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
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
1 - 100 of 132 matches
Mail list logo