From: Dan Carpenter <error27@gmail.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
nvdimm@lists.linux.dev, linux-acpi@vger.kernel.org,
kernel-janitors@vger.kernel.org,
cip-dev <cip-dev@lists.cip-project.org>,
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Subject: Re: [PATCH v2] ACPI: NFIT: prevent underflow in acpi_nfit_ctl()
Date: Tue, 28 Mar 2023 17:57:54 +0300 [thread overview]
Message-ID: <ad63258f-cc13-4f6c-a2a7-aea783f60931@kili.mountain> (raw)
In-Reply-To: <8a425108-3480-4a58-ba4f-727146a0cef7@kili.mountain>
On Tue, Mar 28, 2023 at 05:55:40PM +0300, Dan Carpenter wrote:
> On Fri, Jan 20, 2023 at 08:22:06AM +0300, Dan Carpenter wrote:
> > On Thu, Jan 19, 2023 at 11:21:22AM -0500, Jeff Moyer wrote:
> > > Dan Carpenter <error27@gmail.com> writes:
> > >
> > > > The concern here would be that "family" is negative and we pass a
> > > > negative value to test_bit() resulting in an out of bounds read
> > > > and potentially a crash.
> > >
> > > I don't see how this can happen. Do you have a particular scenario in
> > > mind?
> > >
> >
> > This is from static analysis. My main thinking was:
> >
> > 1) The static checker says that this comes from the user.
> > 2) Every upper bounds check should have a lower bounds check.
> > 3) family is passed to array_index_nospec() so we must not trust it.
> >
> > But looking closer today here is what the checker is concerned about:
> >
> > func = cmd_to_func(nfit_mem, cmd, call_pkg, &family);
> >
> > Assume "nfit_mem" is NULL but "call_pkg" is non NULL (user input from
> > __nd_ioctl() or ars_get_status(). In that case family is unchecked user
> > input.
> >
> > But probably, it's not possible for nfit_mem to be NULL in those caller
> > functions?
>
> Did we ever figure out if it's possible for nfit_mem to be NULL?
Another idea is I could send this patch as a static checker fix instead
of a security vulnerability. That way we would be safe going forward
regardless.
regards,
dan carpenter
prev parent reply other threads:[~2023-03-28 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 15:09 [PATCH v2] ACPI: NFIT: prevent underflow in acpi_nfit_ctl() Dan Carpenter
2023-01-19 16:21 ` Jeff Moyer
2023-01-20 5:22 ` Dan Carpenter
2023-03-28 14:55 ` Dan Carpenter
2023-03-28 14:57 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad63258f-cc13-4f6c-a2a7-aea783f60931@kili.mountain \
--to=error27@gmail.com \
--cc=cip-dev@lists.cip-project.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=ira.weiny@intel.com \
--cc=jmoyer@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=rafael@kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox