[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202205231238.FAF6D28@keescook>
Date: Mon, 23 May 2022 12:39:12 -0700
From: Kees Cook <keescook@...omium.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Maninder Singh <maninder1.s@...sung.com>, pmladek@...e.com,
bcain@...cinc.com, mpe@...erman.id.au, benh@...nel.crashing.org,
paulus@...ba.org, hca@...ux.ibm.com, gor@...ux.ibm.com,
agordeev@...ux.ibm.com, borntraeger@...ux.ibm.com,
svens@...ux.ibm.com, satishkh@...co.com, sebaddel@...co.com,
kartilak@...co.com, jejb@...ux.ibm.com, martin.petersen@...cle.com,
mcgrof@...nel.org, jason.wessel@...driver.com,
daniel.thompson@...aro.org, dianders@...omium.org,
naveen.n.rao@...ux.ibm.com, anil.s.keshavamurthy@...el.com,
davem@...emloft.net, mhiramat@...nel.org, peterz@...radead.org,
mingo@...hat.com, will@...nel.org, longman@...hat.com,
boqun.feng@...il.com, rostedt@...dmis.org,
senozhatsky@...omium.org, andriy.shevchenko@...ux.intel.com,
linux@...musvillemoes.dk, akpm@...ux-foundation.org, arnd@...db.de,
linux-hexagon@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
linux-scsi@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-modules@...r.kernel.org,
kgdb-bugreport@...ts.sourceforge.net, v.narang@...sung.com,
onkarnath.1@...sung.com
Subject: Re: [PATCH 0/5] kallsyms: make kallsym APIs more safe with scnprintf
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:
> > 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
Powered by blists - more mailing lists