lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Jan 2019 08:48:18 -0800
From:   Dan Williams <dan.j.williams@...el.com>
To:     Jeff Moyer <jmoyer@...hat.com>
Cc:     linux-nvdimm <linux-nvdimm@...ts.01.org>,
        stable <stable@...r.kernel.org>,
        stuart hayes <stuart.w.hayes@...il.com>,
        Sujith Pandel <sujith_pandel@...l.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 0/2] acpi/nfit: Fix command-supported detection

On Tue, Jan 15, 2019 at 6:16 AM Jeff Moyer <jmoyer@...hat.com> wrote:
>
> Dan Williams <dan.j.williams@...el.com> writes:
>
> > Changes since v1 [1]:
> > * Include another patch make sure that function-number zero can be
> >   safely used as an invalid function number (Jeff)
> > * Add a comment clarifying why zero is an invalid function number (Jeff)
> > * Pass nfit_mem to cmd_to_func() (Jeff)
> > * Collect a Tested-by from Sujith
> > [1]: https://lists.01.org/pipermail/linux-nvdimm/2019-January/019435.html
>
> For the series:
>
> Reviewed-by: Jeff Moyer <jmoyer@...hat.com>
>
> Thanks, Dan!

Thanks, although I just realized one more change. The ND_CMD_CALL case
should zero out command after the function translation, otherwise
userspace can call functions that the kernel is blocking in the
dsm_mask.

Holler if this invalidates your "Reviewed-by".

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 87e02f281e51..d7747aceb7ab 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -463,6 +463,12 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor
*nd_desc, struct nvdimm *nvdimm,
                func = cmd_to_func(nfit_mem, cmd, buf);
                if (func < 0)
                        return func;
+               /*
+                * In the ND_CMD_CALL case we're now dependent on 'func'
+                * being validated by the dimm's dsm_mask
+                */
+               if (cmd == ND_CMD_CALL)
+                       cmd = 0;
                dimm_name = nvdimm_name(nvdimm);
                cmd_name = nvdimm_cmd_name(cmd);
                cmd_mask = nvdimm_cmd_mask(nvdimm);
@@ -477,8 +483,10 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor
*nd_desc, struct nvdimm *nvdimm,
                cmd_name = nvdimm_bus_cmd_name(cmd);
                cmd_mask = nd_desc->cmd_mask;
                dsm_mask = cmd_mask;
-               if (cmd == ND_CMD_CALL)
+               if (cmd == ND_CMD_CALL) {
                        dsm_mask = nd_desc->bus_dsm_mask;
+                       cmd = 0;
+               }
                desc = nd_cmd_bus_desc(cmd);
                guid = to_nfit_uuid(NFIT_DEV_BUS);
                handle = adev->handle;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ