All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-11 19:42 ` Nathan Chancellor
  0 siblings, 0 replies; 24+ messages in thread
From: Nathan Chancellor @ 2021-02-11 19:42 UTC (permalink / raw)
  To: Gabriel Somlo, Michael S. Tsirkin
  Cc: Nick Desaulniers, Sami Tolvanen, Kees Cook, qemu-devel,
	linux-kernel, clang-built-linux, Nathan Chancellor

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@kernel.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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-11 19:42 ` Nathan Chancellor
  0 siblings, 0 replies; 24+ messages in thread
From: Nathan Chancellor @ 2021-02-11 19:42 UTC (permalink / raw)
  To: Gabriel Somlo, Michael S. Tsirkin
  Cc: Kees Cook, Nick Desaulniers, linux-kernel, qemu-devel,
	Nathan Chancellor, clang-built-linux, Sami Tolvanen

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@kernel.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



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-11 19:42 ` Nathan Chancellor
@ 2021-02-11 20:41   ` Sami Tolvanen
  -1 siblings, 0 replies; 24+ messages in thread
From: Sami Tolvanen @ 2021-02-11 20:41 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Gabriel Somlo, Michael S. Tsirkin, Nick Desaulniers, Kees Cook,
	qemu-devel, LKML, clang-built-linux

Hi Nathan,

On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@kernel.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@kernel.org>

Looks good to me. Thank you for sending the patch!

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-11 20:41   ` Sami Tolvanen
  0 siblings, 0 replies; 24+ messages in thread
From: Sami Tolvanen @ 2021-02-11 20:41 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Gabriel Somlo, Michael S. Tsirkin, Nick Desaulniers, Kees Cook,
	qemu-devel, LKML, clang-built-linux

Hi Nathan,

On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@kernel.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@kernel.org>

Looks good to me. Thank you for sending the patch!

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-11 19:42 ` Nathan Chancellor
@ 2021-02-22 19:02   ` Nick Desaulniers
  -1 siblings, 0 replies; 24+ messages in thread
From: Nick Desaulniers @ 2021-02-22 19:02 UTC (permalink / raw)
  To: Gabriel Somlo, Michael S. Tsirkin
  Cc: Sami Tolvanen, Kees Cook, qemu-devel, LKML, clang-built-linux,
	Nathan Chancellor

Did this happen to get picked up already? EOM

On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@kernel.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@kernel.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
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210211194258.4137998-1-nathan%40kernel.org.



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-22 19:02   ` Nick Desaulniers
  0 siblings, 0 replies; 24+ messages in thread
From: Nick Desaulniers @ 2021-02-22 19:02 UTC (permalink / raw)
  To: Gabriel Somlo, Michael S. Tsirkin
  Cc: Sami Tolvanen, Kees Cook, qemu-devel, LKML, clang-built-linux,
	Nathan Chancellor

Did this happen to get picked up already? EOM

On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@kernel.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@kernel.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
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210211194258.4137998-1-nathan%40kernel.org.



-- 
Thanks,
~Nick Desaulniers


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-22 19:02   ` Nick Desaulniers
@ 2021-02-22 19:08     ` Nathan Chancellor
  -1 siblings, 0 replies; 24+ messages in thread
From: Nathan Chancellor @ 2021-02-22 19:08 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gabriel Somlo, Michael S. Tsirkin, Sami Tolvanen, Kees Cook,
	qemu-devel, LKML, clang-built-linux

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@kernel.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@kernel.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
> >

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-22 19:08     ` Nathan Chancellor
  0 siblings, 0 replies; 24+ messages in thread
From: Nathan Chancellor @ 2021-02-22 19:08 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Kees Cook, Michael S. Tsirkin, Gabriel Somlo, qemu-devel, LKML,
	clang-built-linux, Sami Tolvanen

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@kernel.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@kernel.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
> >


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-11 20:41   ` Sami Tolvanen
@ 2021-02-24 18:08     ` Sedat Dilek
  -1 siblings, 0 replies; 24+ messages in thread
From: Sedat Dilek @ 2021-02-24 18:08 UTC (permalink / raw)
  To: Sami Tolvanen
  Cc: Nathan Chancellor, Gabriel Somlo, Michael S. Tsirkin,
	Nick Desaulniers, Kees Cook, qemu-devel, LKML, clang-built-linux

On Thu, Feb 11, 2021 at 9:41 PM 'Sami Tolvanen' via Clang Built Linux
<clang-built-linux@googlegroups.com> wrote:
>
> Hi Nathan,
>
> On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@kernel.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@kernel.org>
>
> Looks good to me. Thank you for sending the patch!
>
> Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
>

Environment: Linux v5.11-10201-gc03c21ba6f4e plus Clang-CFI as of
24-Feb-2021 on top built with LLVM v13-git.

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

- Sedat -

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-24 18:08     ` Sedat Dilek
  0 siblings, 0 replies; 24+ messages in thread
From: Sedat Dilek @ 2021-02-24 18:08 UTC (permalink / raw)
  To: Sami Tolvanen
  Cc: Kees Cook, Michael S. Tsirkin, Gabriel Somlo, Nick Desaulniers,
	qemu-devel, LKML, Nathan Chancellor, clang-built-linux

On Thu, Feb 11, 2021 at 9:41 PM 'Sami Tolvanen' via Clang Built Linux
<clang-built-linux@googlegroups.com> wrote:
>
> Hi Nathan,
>
> On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor <nathan@kernel.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@kernel.org>
>
> Looks good to me. Thank you for sending the patch!
>
> Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
>

Environment: Linux v5.11-10201-gc03c21ba6f4e plus Clang-CFI as of
24-Feb-2021 on top built with LLVM v13-git.

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

- Sedat -


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-11 19:42 ` Nathan Chancellor
@ 2021-02-25  4:57   ` Kees Cook
  -1 siblings, 0 replies; 24+ messages in thread
From: Kees Cook @ 2021-02-25  4:57 UTC (permalink / raw)
  To: Nathan Chancellor, Michael S. Tsirkin
  Cc: Gabriel Somlo, Nick Desaulniers, Sami Tolvanen, qemu-devel,
	linux-kernel, clang-built-linux

On Thu, Feb 11, 2021 at 12:42:58PM -0700, Nathan Chancellor 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@kernel.org>

Ah, nice, yes.

Reviewed-by: Kees Cook <keescook@chromium.org>

Michael, are you able to take this? I can snag it if needed.

-Kees

> ---
>  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
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-25  4:57   ` Kees Cook
  0 siblings, 0 replies; 24+ messages in thread
From: Kees Cook @ 2021-02-25  4:57 UTC (permalink / raw)
  To: Nathan Chancellor, Michael S. Tsirkin
  Cc: Gabriel Somlo, Nick Desaulniers, qemu-devel, linux-kernel,
	clang-built-linux, Sami Tolvanen

On Thu, Feb 11, 2021 at 12:42:58PM -0700, Nathan Chancellor 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@kernel.org>

Ah, nice, yes.

Reviewed-by: Kees Cook <keescook@chromium.org>

Michael, are you able to take this? I can snag it if needed.

-Kees

> ---
>  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
> 

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-11 19:42 ` Nathan Chancellor
@ 2021-02-25 10:41   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-25 10:41 UTC (permalink / raw)
  To: Nathan Chancellor, Gabriel Somlo, Michael S. Tsirkin
  Cc: Kees Cook, Nick Desaulniers, linux-kernel, qemu-devel,
	clang-built-linux, Sami Tolvanen

On 2/11/21 8:42 PM, Nathan Chancellor 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@kernel.org>
> ---
>  drivers/firmware/qemu_fw_cfg.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-25 10:41   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-25 10:41 UTC (permalink / raw)
  To: Nathan Chancellor, Gabriel Somlo, Michael S. Tsirkin
  Cc: Kees Cook, Nick Desaulniers, qemu-devel, linux-kernel,
	clang-built-linux, Sami Tolvanen

On 2/11/21 8:42 PM, Nathan Chancellor 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@kernel.org>
> ---
>  drivers/firmware/qemu_fw_cfg.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-11 19:42 ` Nathan Chancellor
@ 2021-02-25 21:25   ` Kees Cook
  -1 siblings, 0 replies; 24+ messages in thread
From: Kees Cook @ 2021-02-25 21:25 UTC (permalink / raw)
  To: Gabriel Somlo, Nathan Chancellor, Michael S. Tsirkin
  Cc: Kees Cook, linux-kernel, Nick Desaulniers, qemu-devel,
	clang-built-linux, Sami Tolvanen

On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> 
> [...]

Applied to kspp/cfi/cleanups, thanks!

[1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
      https://git.kernel.org/kees/c/f5c4679d6c49

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-02-25 21:25   ` Kees Cook
  0 siblings, 0 replies; 24+ messages in thread
From: Kees Cook @ 2021-02-25 21:25 UTC (permalink / raw)
  To: Gabriel Somlo, Nathan Chancellor, Michael S. Tsirkin
  Cc: Kees Cook, Nick Desaulniers, qemu-devel, linux-kernel,
	clang-built-linux, Sami Tolvanen

On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> 
> [...]

Applied to kspp/cfi/cleanups, thanks!

[1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
      https://git.kernel.org/kees/c/f5c4679d6c49

-- 
Kees Cook



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-02-25 21:25   ` Kees Cook
@ 2021-04-02  6:42     ` Sedat Dilek
  -1 siblings, 0 replies; 24+ messages in thread
From: Sedat Dilek @ 2021-04-02  6:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Gabriel Somlo, Nathan Chancellor, Michael S. Tsirkin,
	linux-kernel, Nick Desaulniers, qemu-devel, Clang-Built-Linux ML,
	Sami Tolvanen

On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> >
> > [...]
>
> Applied to kspp/cfi/cleanups, thanks!
>
> [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
>       https://git.kernel.org/kees/c/f5c4679d6c49
>

I have queued this up in my custom patchset
(for-5.12/kspp-cfi-cleanups-20210225).

What is the plan to get this upstream?

Feel free to add my:

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

- Sedat -

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-04-02  6:42     ` Sedat Dilek
  0 siblings, 0 replies; 24+ messages in thread
From: Sedat Dilek @ 2021-04-02  6:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Michael S. Tsirkin, Gabriel Somlo, Nick Desaulniers, qemu-devel,
	linux-kernel, Nathan Chancellor, Clang-Built-Linux ML,
	Sami Tolvanen

On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> >
> > [...]
>
> Applied to kspp/cfi/cleanups, thanks!
>
> [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
>       https://git.kernel.org/kees/c/f5c4679d6c49
>

I have queued this up in my custom patchset
(for-5.12/kspp-cfi-cleanups-20210225).

What is the plan to get this upstream?

Feel free to add my:

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

- Sedat -


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-04-02  6:42     ` Sedat Dilek
@ 2021-04-02 18:25       ` Kees Cook
  -1 siblings, 0 replies; 24+ messages in thread
From: Kees Cook @ 2021-04-02 18:25 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Gabriel Somlo, Nathan Chancellor, Michael S. Tsirkin,
	linux-kernel, Nick Desaulniers, qemu-devel, Clang-Built-Linux ML,
	Sami Tolvanen

On Fri, Apr 02, 2021 at 08:42:07AM +0200, Sedat Dilek wrote:
> On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> > >
> > > [...]
> >
> > Applied to kspp/cfi/cleanups, thanks!
> >
> > [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
> >       https://git.kernel.org/kees/c/f5c4679d6c49
> >
> 
> I have queued this up in my custom patchset
> (for-5.12/kspp-cfi-cleanups-20210225).
> 
> What is the plan to get this upstream?

I haven't sent it to Linus yet -- I was expecting to batch more of these
and send them for v5.13. (But if the kvm folks snag it, that's good
too.)

-Kees

> 
> Feel free to add my:
> 
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> 
> - Sedat -

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-04-02 18:25       ` Kees Cook
  0 siblings, 0 replies; 24+ messages in thread
From: Kees Cook @ 2021-04-02 18:25 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Michael S. Tsirkin, Gabriel Somlo, Nick Desaulniers, qemu-devel,
	linux-kernel, Nathan Chancellor, Clang-Built-Linux ML,
	Sami Tolvanen

On Fri, Apr 02, 2021 at 08:42:07AM +0200, Sedat Dilek wrote:
> On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> > >
> > > [...]
> >
> > Applied to kspp/cfi/cleanups, thanks!
> >
> > [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
> >       https://git.kernel.org/kees/c/f5c4679d6c49
> >
> 
> I have queued this up in my custom patchset
> (for-5.12/kspp-cfi-cleanups-20210225).
> 
> What is the plan to get this upstream?

I haven't sent it to Linus yet -- I was expecting to batch more of these
and send them for v5.13. (But if the kvm folks snag it, that's good
too.)

-Kees

> 
> Feel free to add my:
> 
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> 
> - Sedat -

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-04-02 18:25       ` Kees Cook
@ 2021-04-02 18:31         ` Nathan Chancellor
  -1 siblings, 0 replies; 24+ messages in thread
From: Nathan Chancellor @ 2021-04-02 18:31 UTC (permalink / raw)
  To: Kees Cook
  Cc: Sedat Dilek, Gabriel Somlo, Michael S. Tsirkin, linux-kernel,
	Nick Desaulniers, qemu-devel, Clang-Built-Linux ML,
	Sami Tolvanen

On Fri, Apr 02, 2021 at 11:25:42AM -0700, Kees Cook wrote:
> On Fri, Apr 02, 2021 at 08:42:07AM +0200, Sedat Dilek wrote:
> > On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
> > >
> > > On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> > > >
> > > > [...]
> > >
> > > Applied to kspp/cfi/cleanups, thanks!
> > >
> > > [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
> > >       https://git.kernel.org/kees/c/f5c4679d6c49
> > >
> > 
> > I have queued this up in my custom patchset
> > (for-5.12/kspp-cfi-cleanups-20210225).
> > 
> > What is the plan to get this upstream?
> 
> I haven't sent it to Linus yet -- I was expecting to batch more of these
> and send them for v5.13. (But if the kvm folks snag it, that's good
> too.)

I am going to be putting the CFI series through its paces on both arm64
and x86_64 over the next week or so on several different machines (in
fact, I am writing up a report right now) so I will probably have some
more of these as I find them.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-04-02 18:31         ` Nathan Chancellor
  0 siblings, 0 replies; 24+ messages in thread
From: Nathan Chancellor @ 2021-04-02 18:31 UTC (permalink / raw)
  To: Kees Cook
  Cc: Michael S. Tsirkin, Gabriel Somlo, Nick Desaulniers, qemu-devel,
	linux-kernel, Clang-Built-Linux ML, Sami Tolvanen, Sedat Dilek

On Fri, Apr 02, 2021 at 11:25:42AM -0700, Kees Cook wrote:
> On Fri, Apr 02, 2021 at 08:42:07AM +0200, Sedat Dilek wrote:
> > On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
> > >
> > > On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> > > >
> > > > [...]
> > >
> > > Applied to kspp/cfi/cleanups, thanks!
> > >
> > > [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
> > >       https://git.kernel.org/kees/c/f5c4679d6c49
> > >
> > 
> > I have queued this up in my custom patchset
> > (for-5.12/kspp-cfi-cleanups-20210225).
> > 
> > What is the plan to get this upstream?
> 
> I haven't sent it to Linus yet -- I was expecting to batch more of these
> and send them for v5.13. (But if the kvm folks snag it, that's good
> too.)

I am going to be putting the CFI series through its paces on both arm64
and x86_64 over the next week or so on several different machines (in
fact, I am writing up a report right now) so I will probably have some
more of these as I find them.

Cheers,
Nathan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  2021-04-02 18:31         ` Nathan Chancellor
@ 2021-04-02 18:44           ` Sedat Dilek
  -1 siblings, 0 replies; 24+ messages in thread
From: Sedat Dilek @ 2021-04-02 18:44 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Kees Cook, Gabriel Somlo, Michael S. Tsirkin, linux-kernel,
	Nick Desaulniers, qemu-devel, Clang-Built-Linux ML,
	Sami Tolvanen

On Fri, Apr 2, 2021 at 8:31 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Fri, Apr 02, 2021 at 11:25:42AM -0700, Kees Cook wrote:
> > On Fri, Apr 02, 2021 at 08:42:07AM +0200, Sedat Dilek wrote:
> > > On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
> > > >
> > > > On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> > > > >
> > > > > [...]
> > > >
> > > > Applied to kspp/cfi/cleanups, thanks!
> > > >
> > > > [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
> > > >       https://git.kernel.org/kees/c/f5c4679d6c49
> > > >
> > >
> > > I have queued this up in my custom patchset
> > > (for-5.12/kspp-cfi-cleanups-20210225).
> > >
> > > What is the plan to get this upstream?
> >
> > I haven't sent it to Linus yet -- I was expecting to batch more of these
> > and send them for v5.13. (But if the kvm folks snag it, that's good
> > too.)
>
> I am going to be putting the CFI series through its paces on both arm64
> and x86_64 over the next week or so on several different machines (in
> fact, I am writing up a report right now) so I will probably have some
> more of these as I find them.
>

This was just a friendly ping.

Sami has sent some patches which I reported in the early stage of
clang-cfi (x86-64) through subtree maintainers.
It's up to you Nathan or kvm folks.

Upstreamed patches means to me a RDC-ed custom patchset.

- Sedat -

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
@ 2021-04-02 18:44           ` Sedat Dilek
  0 siblings, 0 replies; 24+ messages in thread
From: Sedat Dilek @ 2021-04-02 18:44 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Kees Cook, Michael S. Tsirkin, Gabriel Somlo, Nick Desaulniers,
	qemu-devel, linux-kernel, Clang-Built-Linux ML, Sami Tolvanen

On Fri, Apr 2, 2021 at 8:31 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Fri, Apr 02, 2021 at 11:25:42AM -0700, Kees Cook wrote:
> > On Fri, Apr 02, 2021 at 08:42:07AM +0200, Sedat Dilek wrote:
> > > On Thu, Feb 25, 2021 at 10:25 PM Kees Cook <keescook@chromium.org> wrote:
> > > >
> > > > On Thu, 11 Feb 2021 12:42:58 -0700, Nathan Chancellor 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
> > > > >
> > > > > [...]
> > > >
> > > > Applied to kspp/cfi/cleanups, thanks!
> > > >
> > > > [1/1] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
> > > >       https://git.kernel.org/kees/c/f5c4679d6c49
> > > >
> > >
> > > I have queued this up in my custom patchset
> > > (for-5.12/kspp-cfi-cleanups-20210225).
> > >
> > > What is the plan to get this upstream?
> >
> > I haven't sent it to Linus yet -- I was expecting to batch more of these
> > and send them for v5.13. (But if the kvm folks snag it, that's good
> > too.)
>
> I am going to be putting the CFI series through its paces on both arm64
> and x86_64 over the next week or so on several different machines (in
> fact, I am writing up a report right now) so I will probably have some
> more of these as I find them.
>

This was just a friendly ping.

Sami has sent some patches which I reported in the early stage of
clang-cfi (x86-64) through subtree maintainers.
It's up to you Nathan or kvm folks.

Upstreamed patches means to me a RDC-ed custom patchset.

- Sedat -


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-04-02 18:48 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 19:42 [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute Nathan Chancellor
2021-02-11 19:42 ` Nathan Chancellor
2021-02-11 20:41 ` Sami Tolvanen
2021-02-11 20:41   ` Sami Tolvanen
2021-02-24 18:08   ` Sedat Dilek
2021-02-24 18:08     ` Sedat Dilek
2021-02-22 19:02 ` Nick Desaulniers
2021-02-22 19:02   ` Nick Desaulniers
2021-02-22 19:08   ` Nathan Chancellor
2021-02-22 19:08     ` Nathan Chancellor
2021-02-25  4:57 ` Kees Cook
2021-02-25  4:57   ` Kees Cook
2021-02-25 10:41 ` Philippe Mathieu-Daudé
2021-02-25 10:41   ` Philippe Mathieu-Daudé
2021-02-25 21:25 ` Kees Cook
2021-02-25 21:25   ` Kees Cook
2021-04-02  6:42   ` Sedat Dilek
2021-04-02  6:42     ` Sedat Dilek
2021-04-02 18:25     ` Kees Cook
2021-04-02 18:25       ` Kees Cook
2021-04-02 18:31       ` Nathan Chancellor
2021-04-02 18:31         ` Nathan Chancellor
2021-04-02 18:44         ` Sedat Dilek
2021-04-02 18:44           ` Sedat Dilek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.