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]
Message-ID: <20210222190806.GA41637@24bbad8f3778>
Date:   Mon, 22 Feb 2021 12:08:06 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     Gabriel Somlo <somlo@....edu>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        Kees Cook <keescook@...omium.org>, qemu-devel@...gnu.org,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute

On Mon, Feb 22, 2021 at 11:02:34AM -0800, Nick Desaulniers wrote:
> Did this happen to get picked up already? EOM

I have not gotten an email saying it has been picked up nor does it
appear to be in -next.

Cheers,
Nathan

> On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@...nel.org> wrote:
> >
> > fw_cfg_showrev() is called by an indirect call in kobj_attr_show(),
> > which violates clang's CFI checking because fw_cfg_showrev()'s second
> > parameter is 'struct attribute', whereas the ->show() member of 'struct
> > kobj_structure' expects the second parameter to be of type 'struct
> > kobj_attribute'.
> >
> > $ cat /sys/firmware/qemu_fw_cfg/rev
> > 3
> >
> > $ dmesg | grep "CFI failure"
> > [   26.016832] CFI failure (target: fw_cfg_showrev+0x0/0x8):
> >
> > Fix this by converting fw_cfg_rev_attr to 'struct kobj_attribute' where
> > this would have been caught automatically by the incompatible pointer
> > types compiler warning. Update fw_cfg_showrev() accordingly.
> >
> > Fixes: 75f3e8e47f38 ("firmware: introduce sysfs driver for QEMU's fw_cfg device")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1299
> > Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> > ---
> >  drivers/firmware/qemu_fw_cfg.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
> > index 0078260fbabe..172c751a4f6c 100644
> > --- a/drivers/firmware/qemu_fw_cfg.c
> > +++ b/drivers/firmware/qemu_fw_cfg.c
> > @@ -299,15 +299,13 @@ static int fw_cfg_do_platform_probe(struct platform_device *pdev)
> >         return 0;
> >  }
> >
> > -static ssize_t fw_cfg_showrev(struct kobject *k, struct attribute *a, char *buf)
> > +static ssize_t fw_cfg_showrev(struct kobject *k, struct kobj_attribute *a,
> > +                             char *buf)
> >  {
> >         return sprintf(buf, "%u\n", fw_cfg_rev);
> >  }
> >
> > -static const struct {
> > -       struct attribute attr;
> > -       ssize_t (*show)(struct kobject *k, struct attribute *a, char *buf);
> > -} fw_cfg_rev_attr = {
> > +static const struct kobj_attribute fw_cfg_rev_attr = {
> >         .attr = { .name = "rev", .mode = S_IRUSR },
> >         .show = fw_cfg_showrev,
> >  };
> >
> > base-commit: 92bf22614b21a2706f4993b278017e437f7785b3
> > --
> > 2.30.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ