Re: [PATCH 0/5] kallsyms: make kallsym APIs more safe with scnprintf

From
Kees Cook <hidden>
Date
2022-05-23 19:43:20
Also in
linux-fsdevel, linux-s390, linux-scsi, linuxppc-dev, lkml
Reply to
Christoph Hellwig, 2022-05-22
On Sat, May 21, 2022 at 11:07:52PM -0700, Christoph Hellwig wrote:
On Fri, May 20, 2022 at 02:06:56PM +0530, Maninder Singh wrote:
quoted
kallsyms functionality depends on KSYM_NAME_LEN directly.
but if user passed array length lesser than it, sprintf
can cause issues of buffer overflow attack.

So changing *sprint* and *lookup* APIs in this patch set
to have buffer size as an argument and replacing sprintf with
scnprintf.
This is still a pretty horrible API.  Passing something like
a struct seq_buf seems like the much better API here.  Also with
the amount of arguments and by reference passing it might be worth
to pass them as a structure while you're at it.
Yeah, I agree. It really seems like seq_buf would be nicer.

-- 
Kees Cook
Thread (11 messages) 11 messages, 6 authors, last reply 2022-06-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help