All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ram Kishore Vegesna <ram.vegesna@broadcom.com>
To: Kees Cook <keescook@chromium.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
	James Smart <james.smart@broadcom.com>,
	 "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	 linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>,
	 Sami Tolvanen <samitolvanen@google.com>,
	llvm@lists.linux.dev,  linux-kernel@vger.kernel.org,
	patches@lists.linux.dev
Subject: Re: [PATCH] scsi: elx: libefc: Fix second parameter type in state callbacks
Date: Thu, 3 Nov 2022 17:02:27 +0530	[thread overview]
Message-ID: <CAF7aS0re7+wza6347zNweB==02GCvFk=H7N8OiQU7HPB1SPz7A@mail.gmail.com> (raw)
In-Reply-To: <202211021208.055D396D8E@keescook>


[-- Attachment #1.1: Type: text/plain, Size: 4208 bytes --]

On Thu, Nov 3, 2022 at 12:38 AM Kees Cook <keescook@chromium.org> wrote:

> On Wed, Nov 02, 2022 at 09:19:06AM -0700, Nathan Chancellor wrote:
> > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
> > indirect call targets are validated against the expected function
> > pointer prototype to make sure the call target is valid to help mitigate
> > ROP attacks. If they are not identical, there is a failure at run time,
> > which manifests as either a kernel panic or thread getting killed. A
> > proposed warning in clang aims to catch these at compile time, which
> > reveals:
> >
> >   drivers/scsi/elx/libefc/efc_node.c:811:22: error: incompatible
> function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32,
> void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from
> 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)'
> [-Werror,-Wincompatible-function-pointer-types-strict]
> >                   ctx->current_state = state;
> >                                     ^ ~~~~~
> >   drivers/scsi/elx/libefc/efc_node.c:878:21: error: incompatible
> function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32,
> void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from
> 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)'
> [-Werror,-Wincompatible-function-pointer-types-strict]
> >           node->nodedb_state = state;
> >                             ^ ~~~~~
> >   drivers/scsi/elx/libefc/efc_node.c:905:6: error: incompatible function
> pointer types assigning to 'void (*)(struct efc_sm_ctx *, enum
> efc_sm_event, void *)' from 'void (*)(struct efc_sm_ctx *, u32, void *)'
> (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)')
> [-Werror,-Wincompatible-function-pointer-types-strict]
> >                   pf = node->nodedb_state;
> >                     ^ ~~~~~~~~~~~~~~~~~~
> >
> >   drivers/scsi/elx/libefc/efc_device.c:455:22: error: incompatible
> function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32,
> void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from
> 'void (struct efc_sm_ctx *, enum efc_sm_event, void *)'
> [-Werror,-Wincompatible-function-pointer-types-strict]
> >                   node->nodedb_state = __efc_d_init;
> >                                     ^ ~~~~~~~~~~~~
> >
> >   drivers/scsi/elx/libefc/efc_sm.c:41:22: error: incompatible function
> pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)'
> (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void
> (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)'
> [-Werror,-Wincompatible-function-pointer-types-strict]
> >                   ctx->current_state = state;
> >                                     ^ ~~~~~
> >
> > The type of the second parameter in the prototypes of ->current_state()
> > and ->nodedb_state() ('u32') does not match the implementations, which
> > have a second parameter type of 'enum efc_sm_event'. Update the
> > prototypes to have the correct second parameter type, clearing up all
> > the warnings and CFI failures.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1750
> > Reported-by: Sami Tolvanen <samitolvanen@google.com>
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
>
> --
> Kees Cook
>

Looks good.

Reviewed-by: Ram Vegesna<ram.vegesna@broadcom.com>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

[-- Attachment #1.2: Type: text/html, Size: 5438 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4214 bytes --]

  reply	other threads:[~2022-11-03 11:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 16:19 [PATCH] scsi: elx: libefc: Fix second parameter type in state callbacks Nathan Chancellor
2022-11-02 19:08 ` Kees Cook
2022-11-03 11:32   ` Ram Kishore Vegesna [this message]
2022-11-08  3:05 ` Martin K. Petersen
2022-11-17 18:29 ` Martin K. Petersen

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='CAF7aS0re7+wza6347zNweB==02GCvFk=H7N8OiQU7HPB1SPz7A@mail.gmail.com' \
    --to=ram.vegesna@broadcom.com \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.petersen@oracle.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=patches@lists.linux.dev \
    --cc=samitolvanen@google.com \
    --cc=target-devel@vger.kernel.org \
    --cc=trix@redhat.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 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.