From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
devel@driverdev.osuosl.org,
Marcelo Diop-Gonzalez <marcgonzalez@google.com>,
linux-kernel@vger.kernel.org,
Nachammai Karuppiah <nachukannan@gmail.com>,
bcm-kernel-feedback-list@broadcom.com,
linux-rpi-kernel@lists.infradead.org,
Jamal Shareef <jamal.k.shareef@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] staging: vchiq: fix __user annotations
Date: Wed, 23 Sep 2020 07:44:40 +0200 [thread overview]
Message-ID: <20200923054440.GA2619878@kroah.com> (raw)
In-Reply-To: <20200922202208.1861595-1-arnd@arndb.de>
On Tue, Sep 22, 2020 at 10:21:43PM +0200, Arnd Bergmann wrote:
> My earlier patches caused some new sparse warnings, but it turns out
> that a number of those are actual bugs, or at least suspicous code.
>
> Adding __user annotations to the data structures that are defined in
> uapi headers helps avoid the new warnings, but that causes a different
> set of warnings to show up, as some of these structures are used both
> inside of the kernel and at the user interface but storing pointers to
> different things there.
>
> Duplicating the vchiq_service_params and vchiq_completion_data structures
> in turn takes care of most of those, and then it turns out that there
> is a 'data' pointer that can be any of a __user address, a dmd_addr_t
> and a kernel pointer in vmalloc space at times.
>
> I'm trying to annotate these as best I can without changing behavior,
> but there still seems to be a serious bug when user space passes
> a valid vmalloc space address instead of a user pointer. Adding
> comments in the code there, and leaving the warnings in place that
> seem to correspond to actual bugs.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> .../include/linux/raspberrypi/vchiq.h | 11 ++-
> .../interface/vchiq_arm/vchiq_2835_arm.c | 2 +-
> .../interface/vchiq_arm/vchiq_arm.c | 95 ++++++++++++-------
> .../interface/vchiq_arm/vchiq_core.c | 19 ++--
> .../interface/vchiq_arm/vchiq_core.h | 10 +-
> .../interface/vchiq_arm/vchiq_ioctl.h | 29 ++++--
> 6 files changed, 106 insertions(+), 60 deletions(-)
This patch series breaks the build for me:
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c: In function ‘vc_vchi_audio_init’:
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c:125:9: error: variable ‘param
’ has initializer but incomplete type
125 | struct vchiq_service_params params = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c:126:4: error: ‘struct vchiq_service_params’ has no member named ‘version’
126 | .version = VC_AUDIOSERV_VER,
| ^~~~~~~
In file included from drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c:8:
drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h:8:26: warning: excess elements in struct initializer
8 | #define VC_AUDIOSERV_VER 2
| ^
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c:126:15: note: in expansion of macro ‘VC_AUDIOSERV_VER’
126 | .version = VC_AUDIOSERV_VER,
| ^~~~~~~~~~~~~~~~
and so on...
Care to try a v2?
thanks,
greg k-h
next prev parent reply other threads:[~2020-09-23 5:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 20:21 [PATCH 1/2] staging: vchiq: fix __user annotations Arnd Bergmann
2020-09-22 20:21 ` [PATCH 2/2] staging: vchiq: avoid mixing kernel and user pointers Arnd Bergmann
2020-09-23 5:44 ` Greg Kroah-Hartman [this message]
2020-09-25 11:42 ` [PATCH 1/2] staging: vchiq: fix __user annotations Arnd Bergmann
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=20200923054440.GA2619878@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devel@driverdev.osuosl.org \
--cc=jamal.k.shareef@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=marcgonzalez@google.com \
--cc=nachukannan@gmail.com \
--cc=nsaenzjulienne@suse.de \
/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