remoteproc: error on kick missing
Subsystems (2)
PATCH 1/1 remoteproc: error on kick missing
From: Nikita Shubin <[email protected]>
.kick method not set in rproc_ops will result in:
8<--- cut here ---
Unable to handle kernel NULL pointer dereference
in rproc_virtio_notify, after firmware loading.
refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +7 -0
@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
Signature · 1 line
2.24.1
Mathieu Poirier
maintainerHi Nikita,
Quoted 9 lines · On Fri, 28 Feb 2020 at 04:07, <[email protected]> wrote:
From: Nikita Shubin <[email protected]>
.kick method not set in
rproc_opswill result in:8<--- cut here ---
Unable to handle kernel NULL pointer dereferencein
rproc_virtio_notify, after firmware loading.
There wasn't any kernel stack trace? What platform was this observed on? I'm afraid we won't be able to move forward with this patch without one, or more information on what is happening.
Quoted 14 lines
refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
Signed-off-by Nikita Shubin <[email protected]>--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/remoteproc/remoteproc_virtio.c +0
-0
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 342
Quoted 9 lines
drivers/remoteproc/remoteproc_virtio.c +6
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + }
I think it would be better to use WARN_ONCE() in rproc_virtio_notify() than prevent a virtio device from being added. But again I will need more information on this case to know for sure.
Thanks,
Mathieu
Quoted 7 lines
drivers/remoteproc/remoteproc_virtio.c +1
-1+/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) { --2.24.1
Quoted 8 lines · Mathieu Poirier
Hi Nikita,
Quoted 5 lines · On Fri, 28 Feb 2020 at 04:07, <[email protected]> wrote:
From: Nikita Shubin <[email protected]>
.kick method not set in
rproc_opswill result in:
Quoted 15 lines
Quoted 4 lines
8<--- cut here ---
Unable to handle kernel NULL pointer dereferencein
rproc_virtio_notify, after firmware loading.There wasn't any kernel stack trace? What platform was this observed on? I'm afraid we won't be able to move forward with this patch without one, or more information on what is happening.
Quoted 6 lines
refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
Signed-off-by Nikita Shubin <[email protected]>---
Nikita, please include "v2" in the subject and add here (below the ---) short summary of what changes since v1.
Quoted 11 lines
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret;
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 342
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +6
-0+if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + }I think it would be better to use
WARN_ONCE()inrproc_virtio_notify()than prevent a virtio device from being added. But again I will need more information on this case to know for sure.
I reviewed v1 and afaict there's no way rproc->ops->kick would change and that things wouldn't work without a kick.
So I requested that it should be checked during initialization instead. Please let me know if I missed some case.
Regards,
Bjorn
Quoted 10 lines
Thanks,
MathieuQuoted 7 lines
drivers/remoteproc/remoteproc_virtio.c +1
-1+/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) { --2.24.1
Quoted 53 lines · Bjorn Andersson
Quoted 8 lines · Mathieu Poirier
Hi Nikita,
Quoted 5 lines · On Fri, 28 Feb 2020 at 04:07, <[email protected]> wrote:
From: Nikita Shubin <[email protected]>
.kick method not set in
rproc_opswill result in:Quoted 15 lines
Quoted 4 lines
8<--- cut here ---
Unable to handle kernel NULL pointer dereferencein
rproc_virtio_notify, after firmware loading.There wasn't any kernel stack trace? What platform was this observed on? I'm afraid we won't be able to move forward with this patch without one, or more information on what is happening.
Quoted 6 lines
refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
Signed-off-by Nikita Shubin <[email protected]>---
Nikita, please include "v2" in the subject and add here (below the ---) short summary of what changes since v1.
Quoted 11 lines
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret;Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 342
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +6
-0+if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + }I think it would be better to use
WARN_ONCE()inrproc_virtio_notify()than prevent a virtio device from being added. But again I will need more information on this case to know for sure.
Quoted 2 lines
I reviewed v1 and afaict there's no way
rproc->ops->kickwould change and that things wouldn't work without a kick.
Yes, a "v2" tag and a little bit of history would have helped. We came to the same conclusion - I couldn't see either how things would work without a kick(), especially if an rvdev with virtio queues is used.
Quoted 17 lines
So I requested that it should be checked during initialization instead. Please let me know if I missed some case.
Regards,
BjornQuoted 10 lines
Thanks,
MathieuQuoted 7 lines
drivers/remoteproc/remoteproc_virtio.c +1
-1+/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) { --2.24.1
03.03.2020, 18:56, "Mathieu Poirier" <[email protected]>:
Quoted 53 lines · Bjorn Andersson
Quoted 52 lines · Mathieu Poirier
> Hi Nikita,
>
> On Fri, 28 Feb 2020 at 04:07, <[email protected]> wrote:
> >
> > From: Nikita Shubin <[email protected]>
> >
> > .kick method not set inrproc_opswill result in:
> >
> > 8<--- cut here ---
> > Unable to handle kernel NULL pointer dereference
> >
> > inrproc_virtio_notify, after firmware loading.
>
> There wasn't any kernel stack trace? What platform was this observed > on? I'm afraid we won't be able to move forward with this patch > without one, or more information on what is happening.
>
> >
> > refuse to register an rproc-induced virtio device if no kick method was > > defined for rproc.
> >
> > Signed-off-by: Nikita Shubin <[email protected]>
> > ---Nikita, please include "v2" in the subject and add here (below the ---) short summary of what changes since v1.
> >
drivers/remoteproc/remoteproc_virtio.c| 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --gita/drivers/remoteproc/remoteproc_virtio.cb/drivers/remoteproc/remoteproc_virtio.c> > index8c07cb2ca8ba..31a62a0b470e100644
> > ---a/drivers/remoteproc/remoteproc_virtio.c
> > +++b/drivers/remoteproc/remoteproc_virtio.c
> > @@ -334,6 +334,13 @@ intrproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)> > structrproc_mem_entry*mem;
> > int ret;
> >
> > + if (rproc->ops->kick== NULL) {
> > + ret =-EINVAL;
> > + dev_err(dev, ".kick method not defined for %s",
> > +rproc->name);
> > + goto out;
> > + }
>
> I think it would be better to useWARN_ONCE()inrproc_virtio_notify()
> than prevent a virtio device from being added. But again I will need
> more information on this case to know for sure.
>
Quoted 3 lines
Quoted 2 lines
I reviewed v1 and afaict there's no way
rproc->ops->kickwould change and that things wouldn't work without a kick.
Hi Mathieu and Bjorn.
Quoted 1 line
Yes, a "v2" tag and a little bit of history would have helped.
My bad about "v2" - the email was malformed so i pretended as it never existed.
Quoted 3 lines
We came to the same conclusion - I couldn't see either how things would work without a
kick(), especially if an rvdev with virtio queues is used.
This issue can happen with any remoteproc driver in case if:
1) .kick method wasn't defined in driver
2) resource_table exists in firmware and has "Virtio device entry" defined
Observed on imx_rproc driver on imx7d hardware, full stack strace:
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c) [ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---
Quoted 19 lines
Reviewed-by Mathieu Poirier <[email protected]>Quoted 16 lines
So I requested that it should be checked during initialization instead. Please let me know if I missed some case.
Regards,
Bjorn> Thanks,
> Mathieu
>
> > +
> > /* Try to find dedicated vdev buffer carveout */
> > mem =rproc_find_carveout_by_name(rproc, "vdev%dbuffer", rvdev->index); > > if (mem) {
> > --
> > 2.24.1
> >
Mathieu Poirier
maintainerQuoted 142 lines · On Wed, 4 Mar 2020 at 07:09, <[email protected]> wrote:
03.03.2020, 18:56, "Mathieu Poirier" <[email protected]>:
Quoted 48 lines · Bjorn Andersson
Quoted 47 lines · Mathieu Poirier
Quoted 9 lines
Hi Nikita,
Quoted 5 lines · On Fri, 28 Feb 2020 at 04:07, <[email protected]> wrote:
From: Nikita Shubin <[email protected]>
.kick method not set in
rproc_opswill result in:Quoted 15 lines
Quoted 4 lines
8<--- cut here ---
Unable to handle kernel NULL pointer dereferencein
rproc_virtio_notify, after firmware loading.There wasn't any kernel stack trace? What platform was this observed on? I'm afraid we won't be able to move forward with this patch without one, or more information on what is happening.
Quoted 6 lines
refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
Signed-off-by Nikita Shubin <[email protected]>---
Nikita, please include "v2" in the subject and add here (below the ---) short summary of what changes since v1.
Quoted 18 lines
Quoted 17 lines
drivers/remoteproc/remoteproc_virtio.c| 7 +++++++1 file changed, 7 insertions(+)drivers/remoteproc/remoteproc_virtio.c +6
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + }Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
I think it would be better to use
WARN_ONCE()inrproc_virtio_notify()than prevent a virtio device from being added. But again I will need more information on this case to know for sure.I reviewed v1 and afaict there's no way
rproc->ops->kickwould change and that things wouldn't work without a kick.Hi Mathieu and Bjorn.
Quoted 1 line
Yes, a "v2" tag and a little bit of history would have helped.
My bad about "v2" - the email was malformed so i pretended as it never existed.
Quoted 3 lines
We came to the same conclusion - I couldn't see either how things would work without a
kick(), especially if an rvdev with virtio queues is used.This issue can happen with any remoteproc driver in case if:
1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry" definedObserved on
imx_rprocdriver on imx7d hardware, full stack strace:[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c)
Quoted 8 lines
[ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---
Please send a v3 with the complete stack trace, add a Fixes tag and CC stable.
Thanks,
Mathieu
Quoted 20 lines
Quoted 20 lines
Reviewed-by Mathieu Poirier <[email protected]>Quoted 16 lines
So I requested that it should be checked during initialization instead. Please let me know if I missed some case.
Regards,
BjornQuoted 10 lines
Thanks,
MathieuQuoted 7 lines
drivers/remoteproc/remoteproc_virtio.c +1
-1+/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) { --2.24.1
v3 cover remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to [email protected]Undefined rproc_ops .kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" if:
1) .kick method wasn't defined in driver
2) resource_table exists in firmware and has "Virtio device entry" defined
Observed on imx_rproc driver on imx7d hardware, full stack strace:
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c) [ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---
PATCH v3 1/1 remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
.kick method not set in rproc_ops will result in:
8<--- cut here ---
Unable to handle kernel NULL pointer dereference
in rproc_virtio_notify, after firmware loading.
refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +7 -0
@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
Signature · 1 line
2.24.1
PATCH v4 1/1 remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Undefined rproc_ops .kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" in rproc_virtio_notify, after firmware loading if:
1) .kick method wasn't defined in driver
2) resource_table exists in firmware and has "Virtio device entry" defined
Let's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +7 -0
@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
Signature · 1 line
2.24.1
PATCH v5 1/1 remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Undefined rproc_ops .kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" in rproc_virtio_notify, after firmware loading if:
1) .kick method wasn't defined in driver
2) resource_table exists in firmware and has "Virtio device entry" defined
Let's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c) [ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---
--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +7 -0
@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
Signature · 1 line
2.24.1
Sasha Levin
maintainerRe: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation").
The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172, v4.9.215, v4.4.215.
v5.5.8: Build OK!
v5.4.24: Build OK!
v4.19.108: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
v4.14.172: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
v4.9.215: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") 2b45cef5868a ("remoteproc: Further extend the vdev life cycle") a863af5d4193 ("remoteproc: virtio: Anchor vring life cycle in vdev") aab8d8022304 ("remoteproc: Assign kref to rproc_vdev") eb30596eae94 ("remoteproc: add rproc_va_to_pa function") f5bcb35387ef ("remoteproc: Decouple vdev resources and devices")
v4.4.215: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") 2b45cef5868a ("remoteproc: Further extend the vdev life cycle")
353861660aa2 ("remoteproc: core: Trivial: Improve error checking, spelling and debug prints") 3d87fa1d47c1 ("remoteproc: core: Task sync during rproc_fw_boot()") 9c219b2337b8 ("remoteproc: core: Ensure error message is clear")
a863af5d4193 ("remoteproc: virtio: Anchor vring life cycle in vdev") aab8d8022304 ("remoteproc: Assign kref to rproc_vdev")
b35d7afc3ba9 ("remoteproc: Calculate max_notifyid during load")
d81fb32f3da6 ("remoteproc: Move vdev handling to boot/shutdown")
ddf711872c9d ("remoteproc: Introduce auto-boot flag")
eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
f5bcb35387ef ("remoteproc: Decouple vdev resources and devices")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to Nikita ShubinHi,
sorry for the late answer...
Quoted 97 lines · Nikita Shubin
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry" definedLet's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c) [ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---Signed-off-by Nikita Shubin <[email protected]>Fixes 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/remoteproc/remoteproc_virtio.c +0
-0
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 10 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +
Should the kick ops be mandatory for all the platforms? How about making it optional instead?
Regards,
Arnaud
Quoted 4 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Quoted 105 lines · Arnaud POULIQUEN
Hi,
sorry for the late answer...
Quoted 100 lines · Nikita Shubin
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry" definedLet's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c) [ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---Signed-off-by Nikita Shubin <[email protected]>Fixes 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)struct rproc_mem_entry *mem;int ret;
Quoted 8 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 7 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0+if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +Should the kick ops be mandatory for all the platforms? How about making it optional instead?
Hi, Arnaud.
It is not mandatory, currently it must be provided if specified vdev entry is in resourse table. Otherwise it looks like there is no point in creating vdev.
Quoted 8 lines
Regards,
ArnaudQuoted 4 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
RE: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Quoted 191 lines
-----Original Message-----
From: [email protected] <linux-remoteproc- [email protected]> On Behalf Of Nikita Shubin
Sent: mardi 10 mars 2020 13:09
To: Arnaud POULIQUEN <[email protected]>
Cc: [email protected]; Ohad Ben-Cohen <[email protected]>; Bjorn Andersson <[email protected]>; linux- [email protected]; [email protected]; Mathieu Poirier <[email protected]>
Subject: Re: [PATCH v5] remoteproc: Fix NULL pointer dereference inrproc_virtio_notifyQuoted 18 lines · Arnaud POULIQUEN
Hi,
sorry for the late answer...
Quoted 13 lines · Nikita Shubin
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry"
definedLet's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereferenceat virtual address 00000000
Quoted 3 lines
Quoted 3 lines
[ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMPARM
Quoted 1 line
Quoted 1 line
[ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc
virtio_rpmsg_busrpmsg_core[last unloaded:imx_rproc]Quoted 1 line
Quoted 1 line
[ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted5.5.2-00002-g707df13bbbdd #6
Quoted 7 lines
Quoted 7 lines
[ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 :
b8a29800Quoted 1 line
Quoted 1 line
[ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 :
b8a29800Quoted 1 line
Quoted 1 line
[ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISAARM Segment none
Quoted 2 lines
Quoted 2 lines
[ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit =0x(ptrval))
Quoted 2 lines
Quoted 2 lines
[ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430
b895bc807f00ae18Quoted 1 line
Quoted 1 line
[ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200
80b3ed8000004000b9393268bbf5a9a2Quoted 1 line
Quoted 1 line
[ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014
b895b680b895b800990a3ad4Quoted 1 line
Quoted 1 line
[ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 0000000000000000
7f00e00000000001 00000000Quoted 1 line
Quoted 1 line
[ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924
b898f21000000000 00000000b898f210Quoted 1 line
Quoted 1 line
[ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000
7f00e0000000000880b2169c80400114Quoted 1 line
Quoted 1 line
[ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e00080400744
b8d4600080b2163480b21634Quoted 1 line
Quoted 1 line
[ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718
7f00e00000000000b8d47d7c80400744Quoted 1 line
Quoted 1 line
[ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338
b898f254b80fe76cb8d32e38990a3ad4Quoted 1 line
Quoted 1 line
[ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254
803ffe7c80857a90b898f210Quoted 1 line
Quoted 1 line
[ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210
b898f21080b17aecb8a29c20803ff0a4Quoted 1 line
Quoted 1 line
[ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0
b898f2000000000080b17aecb898f210Quoted 1 line
Quoted 1 line
[ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200
8050fb7c80b17aecb898f210b8a29c20Quoted 1 line
Quoted 1 line
[ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0
b8a29c00b898f200b8a29a2000000007Quoted 1 line
Quoted 1 line
[ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000
b8a29a20b8a29c04b8a29820b8a299d0Quoted 1 line
Quoted 1 line
[ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8
b8d46000b8a299e0b8a29820b8a299d0Quoted 1 line
Quoted 1 line
[ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000
b8b8c440b8a299d8b8a299e0b8a299d8Quoted 1 line
Quoted 1 line
[ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820
b8b8c40000000006b8a29800b895b880Quoted 1 line
Quoted 1 line
[ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b400000006
b895b890b8b8c400008fbea0Quoted 1 line
Quoted 1 line
[ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000
b8d4600000000006b8d46000008fbea0Quoted 1 line
Quoted 1 line
[ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 0000000000000000
8021e2e40000000a8061fd0cQuoted 1 line
Quoted 1 line
[ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c4000000001
b8af0c40000000008061f910Quoted 1 line
Quoted 1 line
[ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d4600000000000
8061fd0c0000000280232d7cQuoted 1 line
Quoted 1 line
[ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad400000000 00000006
b8a62d80008fbea0Quoted 1 line
Quoted 1 line
[ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 0000000000000000
802210c0b88f290000000000Quoted 1 line
Quoted 1 line
[ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006
008fbea080221320 00000000 00000000Quoted 1 line
Quoted 1 line
[ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda000000004 80101204 00000004
Quoted 1 line
Quoted 1 line
[ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea000000001
008fbea000000006 00000000Quoted 1 line
Quoted 1 line
[ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 0000000600000006 00000000 00000000
Quoted 1 line
Quoted 1 line
[ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206
600d003000000001 00000000 00000000Quoted 1 line
Quoted 1 line
[ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from[<
803c6430>] (virtqueue_notify+0x1c/0x34)Quoted 1 line
Quoted 1 line
[ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>](
rpmsg_probe+0x280/0x380[virtio_rpmsg_bus])Quoted 1 line
Quoted 1 line
[ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus])from [<
803c62e0>] (virtio_dev_probe+0x1f8/0x2c4)Quoted 1 line
Quoted 1 line
[ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>](
really_probe+0x200/0x450)Quoted 1 line
Quoted 1 line
[ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>](
driver_probe_device+0x16c/0x1ac)Quoted 1 line
Quoted 1 line
[ 13.639873][ T415] [<80400614>] (driver_probe_device) from[<
803fe338>] (bus_for_each_drv+0x84/0xc8)Quoted 1 line
Quoted 1 line
[ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>](
__device_attach+0xd4/0x164)Quoted 1 line
Quoted 1 line
[ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>](
bus_probe_device+0x84/0x8c)Quoted 1 line
Quoted 1 line
[ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from[<
803fb8e0>] (device_add+0x444/0x768)Quoted 1 line
Quoted 1 line
[ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>](
register_virtio_device+0xa4/0xfc)Quoted 1 line
Quoted 1 line
[ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from[<
8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8)Quoted 1 line
Quoted 1 line
[ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from[<
8050e5a4>] (rproc_start+0x148/0x200)Quoted 1 line
Quoted 1 line
[ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>](
rproc_boot+0x384/0x5c0)Quoted 1 line
Quoted 1 line
[ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>](
state_store+0x3c/0xc8)Quoted 1 line
Quoted 1 line
[ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>](
kernfs_fop_write+0xfc/0x214)Quoted 1 line
Quoted 1 line
[ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>](
__vfs_write+0x30/0x1cc)Quoted 1 line
Quoted 1 line
[ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>](
vfs_write+0xac/0x17c)Quoted 1 line
Quoted 1 line
[ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>](
ksys_write+0x64/0xe4)Quoted 1 line
Quoted 1 line
[ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>](
ret_fast_syscall+0x0/0x54)Quoted 2 lines
Quoted 2 lines
[ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea000000006 00000000
Quoted 1 line
Quoted 1 line
[ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 0000000600000006 00000000 00000000
Quoted 12 lines
Quoted 12 lines
[ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---Signed-off-by Nikita Shubin <[email protected]>Fixes 7a186941626d ("remoteproc: remove the single rpmsg vdevlimitation")
Cc: [email protected]--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev*rvdev, int id)
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 10 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +Should the kick ops be mandatory for all the platforms? How about making
Quoted 6 lines
it optional instead?
Hi, Arnaud.
It is not mandatory, currently it must be provided if specified vdev entry is in resourse table. Otherwise it looks like there is no point in creating vdev.
Yes, my question was about having it optional for vdev also. A platform could implement the vdev without kick mechanism but by polling depending due to hardware capability... This could be an alternative avoiding to implement a dummy function in platform driver.
Anyway it just a proposal that makes sense from MPOV. If Bjorn is ok with your patch, nothing blocking on my side.
Regards
Arnaud
Quoted 11 lines
Quoted 8 lines
Regards,
ArnaudQuoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0/* Try to find dedicated vdev buffer carveout */ mem = rproc_find_carveout_by_name(rproc, "vdev%dbuffer",
rvdev->index);Quoted 2 lines
Quoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0if (mem) {
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Quoted 193 lines · Arnaud POULIQUEN
Quoted 193 lines
-----Original Message-----
From: [email protected] <linux-remoteproc- [email protected]> On Behalf Of Nikita Shubin
Sent: mardi 10 mars 2020 13:09
To: Arnaud POULIQUEN <[email protected]>
Cc: [email protected]; Ohad Ben-Cohen <[email protected]>; Bjorn Andersson <[email protected]>; linux- [email protected]; [email protected]; Mathieu Poirier <[email protected]>
Subject: Re: [PATCH v5] remoteproc: Fix NULL pointer dereference inrproc_virtio_notifyQuoted 18 lines · Arnaud POULIQUEN
Hi,
sorry for the late answer...
Quoted 13 lines · Nikita Shubin
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry"
definedLet's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereferenceat virtual address 00000000
Quoted 3 lines
Quoted 3 lines
[ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMPARM
Quoted 1 line
Quoted 1 line
[ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc
virtio_rpmsg_busrpmsg_core[last unloaded:imx_rproc]Quoted 1 line
Quoted 1 line
[ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted5.5.2-00002-g707df13bbbdd #6
Quoted 7 lines
Quoted 7 lines
[ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 :
b8a29800Quoted 1 line
Quoted 1 line
[ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 :
b8a29800Quoted 1 line
Quoted 1 line
[ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISAARM Segment none
Quoted 2 lines
Quoted 2 lines
[ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit =0x(ptrval))
Quoted 2 lines
Quoted 2 lines
[ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430
b895bc807f00ae18Quoted 1 line
Quoted 1 line
[ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200
80b3ed8000004000b9393268bbf5a9a2Quoted 1 line
Quoted 1 line
[ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014
b895b680b895b800990a3ad4Quoted 1 line
Quoted 1 line
[ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 0000000000000000
7f00e00000000001 00000000Quoted 1 line
Quoted 1 line
[ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924
b898f21000000000 00000000b898f210Quoted 1 line
Quoted 1 line
[ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000
7f00e0000000000880b2169c80400114Quoted 1 line
Quoted 1 line
[ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e00080400744
b8d4600080b2163480b21634Quoted 1 line
Quoted 1 line
[ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718
7f00e00000000000b8d47d7c80400744Quoted 1 line
Quoted 1 line
[ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338
b898f254b80fe76cb8d32e38990a3ad4Quoted 1 line
Quoted 1 line
[ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254
803ffe7c80857a90b898f210Quoted 1 line
Quoted 1 line
[ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210
b898f21080b17aecb8a29c20803ff0a4Quoted 1 line
Quoted 1 line
[ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0
b898f2000000000080b17aecb898f210Quoted 1 line
Quoted 1 line
[ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200
8050fb7c80b17aecb898f210b8a29c20Quoted 1 line
Quoted 1 line
[ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0
b8a29c00b898f200b8a29a2000000007Quoted 1 line
Quoted 1 line
[ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000
b8a29a20b8a29c04b8a29820b8a299d0Quoted 1 line
Quoted 1 line
[ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8
b8d46000b8a299e0b8a29820b8a299d0Quoted 1 line
Quoted 1 line
[ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000
b8b8c440b8a299d8b8a299e0b8a299d8Quoted 1 line
Quoted 1 line
[ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820
b8b8c40000000006b8a29800b895b880Quoted 1 line
Quoted 1 line
[ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b400000006
b895b890b8b8c400008fbea0Quoted 1 line
Quoted 1 line
[ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000
b8d4600000000006b8d46000008fbea0Quoted 1 line
Quoted 1 line
[ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 0000000000000000
8021e2e40000000a8061fd0cQuoted 1 line
Quoted 1 line
[ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c4000000001
b8af0c40000000008061f910Quoted 1 line
Quoted 1 line
[ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d4600000000000
8061fd0c0000000280232d7cQuoted 1 line
Quoted 1 line
[ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad400000000 00000006
b8a62d80008fbea0Quoted 1 line
Quoted 1 line
[ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 0000000000000000
802210c0b88f290000000000Quoted 1 line
Quoted 1 line
[ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006
008fbea080221320 00000000 00000000Quoted 1 line
Quoted 1 line
[ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda000000004 80101204 00000004
Quoted 1 line
Quoted 1 line
[ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea000000001
008fbea000000006 00000000Quoted 1 line
Quoted 1 line
[ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 0000000600000006 00000000 00000000
Quoted 1 line
Quoted 1 line
[ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206
600d003000000001 00000000 00000000Quoted 1 line
Quoted 1 line
[ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from[<
803c6430>] (virtqueue_notify+0x1c/0x34)Quoted 1 line
Quoted 1 line
[ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>](
rpmsg_probe+0x280/0x380[virtio_rpmsg_bus])Quoted 1 line
Quoted 1 line
[ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus])from [<
803c62e0>] (virtio_dev_probe+0x1f8/0x2c4)Quoted 1 line
Quoted 1 line
[ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>](
really_probe+0x200/0x450)Quoted 1 line
Quoted 1 line
[ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>](
driver_probe_device+0x16c/0x1ac)Quoted 1 line
Quoted 1 line
[ 13.639873][ T415] [<80400614>] (driver_probe_device) from[<
803fe338>] (bus_for_each_drv+0x84/0xc8)Quoted 1 line
Quoted 1 line
[ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>](
__device_attach+0xd4/0x164)Quoted 1 line
Quoted 1 line
[ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>](
bus_probe_device+0x84/0x8c)Quoted 1 line
Quoted 1 line
[ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from[<
803fb8e0>] (device_add+0x444/0x768)Quoted 1 line
Quoted 1 line
[ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>](
register_virtio_device+0xa4/0xfc)Quoted 1 line
Quoted 1 line
[ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from[<
8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8)Quoted 1 line
Quoted 1 line
[ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from[<
8050e5a4>] (rproc_start+0x148/0x200)Quoted 1 line
Quoted 1 line
[ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>](
rproc_boot+0x384/0x5c0)Quoted 1 line
Quoted 1 line
[ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>](
state_store+0x3c/0xc8)Quoted 1 line
Quoted 1 line
[ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>](
kernfs_fop_write+0xfc/0x214)Quoted 1 line
Quoted 1 line
[ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>](
__vfs_write+0x30/0x1cc)Quoted 1 line
Quoted 1 line
[ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>](
vfs_write+0xac/0x17c)Quoted 1 line
Quoted 1 line
[ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>](
ksys_write+0x64/0xe4)Quoted 1 line
Quoted 1 line
[ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>](
ret_fast_syscall+0x0/0x54)Quoted 2 lines
Quoted 2 lines
[ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea000000006 00000000
Quoted 1 line
Quoted 1 line
[ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 0000000600000006 00000000 00000000
Quoted 12 lines
Quoted 12 lines
[ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---Signed-off-by Nikita Shubin <[email protected]>Fixes 7a186941626d ("remoteproc: remove the single rpmsg vdevlimitation")
Cc: [email protected]--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev*rvdev, int id)
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 10 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +Should the kick ops be mandatory for all the platforms? How about making
it optional instead?
Quoted 9 lines
Quoted 4 lines
Hi, Arnaud.
It is not mandatory, currently it must be provided if specified vdev entry is in resourse table. Otherwise it looks like there is no point in creating vdev.
Yes, my question was about having it optional for vdev also. A platform could implement the vdev without kick mechanism but by polling depending due to hardware capability... This could be an alternative avoiding to implement a dummy function in platform driver.
Is this a real thing or a theoretical suggestion?
Regards,
Bjorn
Quoted 16 lines
Anyway it just a proposal that makes sense from MPOV. If Bjorn is ok with your patch, nothing blocking on my side.
Regards
ArnaudQuoted 11 lines
Quoted 8 lines
Regards,
ArnaudQuoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0/* Try to find dedicated vdev buffer carveout */ mem = rproc_find_carveout_by_name(rproc, "vdev%dbuffer",
rvdev->index);Quoted 2 lines
Quoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0if (mem) {
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Quoted 198 lines · Bjorn Andersson
Quoted 195 lines · Arnaud POULIQUEN
Quoted 195 lines
-----Original Message-----
From: [email protected] <linux-remoteproc- [email protected]> On Behalf Of Nikita Shubin
Sent: mardi 10 mars 2020 13:09
To: Arnaud POULIQUEN <[email protected]>
Cc: [email protected]; Ohad Ben-Cohen <[email protected]>; Bjorn Andersson <[email protected]>; linux- [email protected]; [email protected]; Mathieu Poirier <[email protected]>
Subject: Re: [PATCH v5] remoteproc: Fix NULL pointer dereference inrproc_virtio_notifyQuoted 18 lines · Arnaud POULIQUEN
Hi,
sorry for the late answer...
Quoted 13 lines · Nikita Shubin
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry"
definedLet's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereferenceat virtual address 00000000
Quoted 3 lines
Quoted 3 lines
[ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMPARM
Quoted 1 line
Quoted 1 line
[ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc
virtio_rpmsg_busrpmsg_core[last unloaded:imx_rproc]Quoted 1 line
Quoted 1 line
[ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted5.5.2-00002-g707df13bbbdd #6
Quoted 7 lines
Quoted 7 lines
[ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 :
b8a29800Quoted 1 line
Quoted 1 line
[ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 :
b8a29800Quoted 1 line
Quoted 1 line
[ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISAARM Segment none
Quoted 2 lines
Quoted 2 lines
[ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit =0x(ptrval))
Quoted 2 lines
Quoted 2 lines
[ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430
b895bc807f00ae18Quoted 1 line
Quoted 1 line
[ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200
80b3ed8000004000b9393268bbf5a9a2Quoted 1 line
Quoted 1 line
[ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014
b895b680b895b800990a3ad4Quoted 1 line
Quoted 1 line
[ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 0000000000000000
7f00e00000000001 00000000Quoted 1 line
Quoted 1 line
[ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924
b898f21000000000 00000000b898f210Quoted 1 line
Quoted 1 line
[ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000
7f00e0000000000880b2169c80400114Quoted 1 line
Quoted 1 line
[ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e00080400744
b8d4600080b2163480b21634Quoted 1 line
Quoted 1 line
[ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718
7f00e00000000000b8d47d7c80400744Quoted 1 line
Quoted 1 line
[ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338
b898f254b80fe76cb8d32e38990a3ad4Quoted 1 line
Quoted 1 line
[ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254
803ffe7c80857a90b898f210Quoted 1 line
Quoted 1 line
[ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210
b898f21080b17aecb8a29c20803ff0a4Quoted 1 line
Quoted 1 line
[ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0
b898f2000000000080b17aecb898f210Quoted 1 line
Quoted 1 line
[ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200
8050fb7c80b17aecb898f210b8a29c20Quoted 1 line
Quoted 1 line
[ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0
b8a29c00b898f200b8a29a2000000007Quoted 1 line
Quoted 1 line
[ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000
b8a29a20b8a29c04b8a29820b8a299d0Quoted 1 line
Quoted 1 line
[ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8
b8d46000b8a299e0b8a29820b8a299d0Quoted 1 line
Quoted 1 line
[ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000
b8b8c440b8a299d8b8a299e0b8a299d8Quoted 1 line
Quoted 1 line
[ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820
b8b8c40000000006b8a29800b895b880Quoted 1 line
Quoted 1 line
[ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b400000006
b895b890b8b8c400008fbea0Quoted 1 line
Quoted 1 line
[ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000
b8d4600000000006b8d46000008fbea0Quoted 1 line
Quoted 1 line
[ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 0000000000000000
8021e2e40000000a8061fd0cQuoted 1 line
Quoted 1 line
[ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c4000000001
b8af0c40000000008061f910Quoted 1 line
Quoted 1 line
[ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d4600000000000
8061fd0c0000000280232d7cQuoted 1 line
Quoted 1 line
[ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad400000000 00000006
b8a62d80008fbea0Quoted 1 line
Quoted 1 line
[ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 0000000000000000
802210c0b88f290000000000Quoted 1 line
Quoted 1 line
[ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006
008fbea080221320 00000000 00000000Quoted 1 line
Quoted 1 line
[ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda000000004 80101204 00000004
Quoted 1 line
Quoted 1 line
[ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea000000001
008fbea000000006 00000000Quoted 1 line
Quoted 1 line
[ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 0000000600000006 00000000 00000000
Quoted 1 line
Quoted 1 line
[ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206
600d003000000001 00000000 00000000Quoted 1 line
Quoted 1 line
[ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from[<
803c6430>] (virtqueue_notify+0x1c/0x34)Quoted 1 line
Quoted 1 line
[ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>](
rpmsg_probe+0x280/0x380[virtio_rpmsg_bus])Quoted 1 line
Quoted 1 line
[ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus])from [<
803c62e0>] (virtio_dev_probe+0x1f8/0x2c4)Quoted 1 line
Quoted 1 line
[ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>](
really_probe+0x200/0x450)Quoted 1 line
Quoted 1 line
[ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>](
driver_probe_device+0x16c/0x1ac)Quoted 1 line
Quoted 1 line
[ 13.639873][ T415] [<80400614>] (driver_probe_device) from[<
803fe338>] (bus_for_each_drv+0x84/0xc8)Quoted 1 line
Quoted 1 line
[ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>](
__device_attach+0xd4/0x164)Quoted 1 line
Quoted 1 line
[ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>](
bus_probe_device+0x84/0x8c)Quoted 1 line
Quoted 1 line
[ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from[<
803fb8e0>] (device_add+0x444/0x768)Quoted 1 line
Quoted 1 line
[ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>](
register_virtio_device+0xa4/0xfc)Quoted 1 line
Quoted 1 line
[ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from[<
8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8)Quoted 1 line
Quoted 1 line
[ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from[<
8050e5a4>] (rproc_start+0x148/0x200)Quoted 1 line
Quoted 1 line
[ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>](
rproc_boot+0x384/0x5c0)Quoted 1 line
Quoted 1 line
[ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>](
state_store+0x3c/0xc8)Quoted 1 line
Quoted 1 line
[ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>](
kernfs_fop_write+0xfc/0x214)Quoted 1 line
Quoted 1 line
[ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>](
__vfs_write+0x30/0x1cc)Quoted 1 line
Quoted 1 line
[ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>](
vfs_write+0xac/0x17c)Quoted 1 line
Quoted 1 line
[ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>](
ksys_write+0x64/0xe4)Quoted 1 line
Quoted 1 line
[ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>](
ret_fast_syscall+0x0/0x54)Quoted 2 lines
Quoted 2 lines
[ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea000000006 00000000
Quoted 1 line
Quoted 1 line
[ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 0000000600000006 00000000 00000000
Quoted 12 lines
Quoted 12 lines
[ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---Signed-off-by Nikita Shubin <[email protected]>Fixes 7a186941626d ("remoteproc: remove the single rpmsg vdevlimitation")
Cc: [email protected]--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev*rvdev, int id)
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 10 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +Should the kick ops be mandatory for all the platforms? How about making
it optional instead?
Hi, Arnaud.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
It is not mandatory, currently it must be provided if specified vdev entry is in resourse table. Otherwise it looks like there is no point in creating vdev.
Yes, my question was about having it optional for vdev also. A platform could implement the vdev without kick mechanism but by polling depending due to hardware capability... This could be an alternative avoiding to implement a dummy function in platform driver.
Arnaud has a point. It _could_ be possible to have a platform that works by polling and in such a case a dummy kick function would be required, but that would likely entail more changes to the remoteproc core. Since we haven't seen the need to support such a scenario and don't have the full picture of what it would take to do so, I suggest to move forward with Nikita's approach and revise later on if there is a need.
Quoted 22 lines
Is this a real thing or a theoretical suggestion?
Regards,
BjornQuoted 16 lines
Anyway it just a proposal that makes sense from MPOV. If Bjorn is ok with your patch, nothing blocking on my side.
Regards
ArnaudQuoted 11 lines
Quoted 8 lines
Regards,
ArnaudQuoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0/* Try to find dedicated vdev buffer carveout */ mem = rproc_find_carveout_by_name(rproc, "vdev%dbuffer",
rvdev->index);Quoted 2 lines
Quoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0if (mem) {
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to Bjorn AnderssonHi Bjorn
Quoted 33 lines · Bjorn Andersson
Quoted 31 lines · Arnaud POULIQUEN
Quoted 31 lines
-----Original Message-----
From: [email protected] <linux-remoteproc- [email protected]> On Behalf Of Nikita Shubin
Sent: mardi 10 mars 2020 13:09
To: Arnaud POULIQUEN <[email protected]>
Cc: [email protected]; Ohad Ben-Cohen <[email protected]>; Bjorn Andersson <[email protected]>; linux- [email protected]; [email protected]; Mathieu Poirier <[email protected]>
Subject: Re: [PATCH v5] remoteproc: Fix NULL pointer dereference inrproc_virtio_notifyQuoted 16 lines · Arnaud POULIQUEN
Hi,
sorry for the late answer...
Quoted 11 lines · Nikita Shubin
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry"
definedLet's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[...]
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 9 lines
Quoted 9 lines
Signed-off-by Nikita Shubin <[email protected]>Fixes 7a186941626d ("remoteproc: remove the single rpmsg vdevlimitation")
Cc: [email protected]--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev*rvdev, int id)
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 10 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +Should the kick ops be mandatory for all the platforms? How about making
it optional instead?
Hi, Arnaud.
It is not mandatory, currently it must be provided if specified vdev entry is in resourse table. Otherwise it looks like there is no point in creating vdev.
Quoted 6 lines
Quoted 4 lines
Yes, my question was about having it optional for vdev also. A platform could implement the vdev without kick mechanism but by polling depending due to hardware capability... This could be an alternative avoiding to implement a dummy function in platform driver.
Is this a real thing or a theoretical suggestion?
Only a theoretical suggestion, trigged by the IMX platform patchset which implement a "temporary" dummy kick. and based on OpenAMP lib implementation which does not request a doorbell.
Anyway no issue to keep it mandatory here.
Regards,
Arnaud
Quoted 20 lines
Regards,
BjornQuoted 16 lines
Anyway it just a proposal that makes sense from MPOV. If Bjorn is ok with your patch, nothing blocking on my side.
Regards
ArnaudQuoted 11 lines
Quoted 8 lines
Regards,
ArnaudQuoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0/* Try to find dedicated vdev buffer carveout */ mem = rproc_find_carveout_by_name(rproc, "vdev%dbuffer",
rvdev->index);Quoted 2 lines
Quoted 2 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0if (mem) {
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Quoted 4 lines · Arnaud POULIQUEN
Quoted 3 lines · Bjorn Andersson
Quoted 2 lines · Arnaud POULIQUEN
Quoted 2 lines · Arnaud POULIQUEN
Quoted 1 line · Nikita Shubin
[..]
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 18 lines
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev
Quoted 6 lines
drivers/remoteproc/remoteproc_virtio.c +0
-0@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev*rvdev, int id)
Quoted 11 lines
drivers/remoteproc/remoteproc_virtio.c int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) · line 343
Quoted 10 lines
drivers/remoteproc/remoteproc_virtio.c +7
-0struct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +Should the kick ops be mandatory for all the platforms? How about making
Quoted 6 lines
it optional instead?
Hi, Arnaud.
It is not mandatory, currently it must be provided if specified vdev entry is in resourse table. Otherwise it looks like there is no point in creating vdev.
Yes, my question was about having it optional for vdev also. A platform could implement the vdev without kick mechanism but by polling depending due to hardware capability... This could be an alternative avoiding to implement a dummy function in platform driver.
Quoted 5 lines
Quoted 1 line
Is this a real thing or a theoretical suggestion?
Only a theoretical suggestion, trigged by the IMX platform patchset which implement a "temporary" dummy kick. and based on OpenAMP lib implementation which does not request a doorbell.
Anyway no issue to keep it mandatory here.
Thanks for confirming. I've applied the patch, with Mathieu's ack, and we can loosen up this requirement when we need it in the future.
Regards,
Bjorn
Re: [PATCH v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to Nikita ShubinThis patch was applied to andersson/remoteproc.git (refs/heads/for-next).
Hello:
This patch was applied to andersson/remoteproc.git (refs/heads/for-next).
Quoted 8 lines · On Fri, 6 Mar 2020 10:24:53 +0300 you wrote:
Undefined
rproc_ops.kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" inrproc_virtio_notify, after firmware loading if:1) .kick method wasn't defined in driver
2)resource_tableexists in firmware and has "Virtio device entry" defined[...]
Here is a summary with links:
- [v5] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
https://git.kernel.org/andersson/remoteproc/c/791c13b709dd51eb37330f2a5837434e90c87c27
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/pwbot
Sasha Levin
maintainerRe: [PATCH v4] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to Nikita ShubinHi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation").
The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172, v4.9.215, v4.4.215.
v5.5.8: Build OK!
v5.4.24: Build OK!
v4.19.108: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
v4.14.172: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
v4.9.215: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") 2b45cef5868a ("remoteproc: Further extend the vdev life cycle") a863af5d4193 ("remoteproc: virtio: Anchor vring life cycle in vdev") aab8d8022304 ("remoteproc: Assign kref to rproc_vdev") eb30596eae94 ("remoteproc: add rproc_va_to_pa function") f5bcb35387ef ("remoteproc: Decouple vdev resources and devices")
v4.4.215: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") 2b45cef5868a ("remoteproc: Further extend the vdev life cycle")
353861660aa2 ("remoteproc: core: Trivial: Improve error checking, spelling and debug prints") 3d87fa1d47c1 ("remoteproc: core: Task sync during rproc_fw_boot()") 9c219b2337b8 ("remoteproc: core: Ensure error message is clear")
a863af5d4193 ("remoteproc: virtio: Anchor vring life cycle in vdev") aab8d8022304 ("remoteproc: Assign kref to rproc_vdev")
b35d7afc3ba9 ("remoteproc: Calculate max_notifyid during load")
d81fb32f3da6 ("remoteproc: Move vdev handling to boot/shutdown")
ddf711872c9d ("remoteproc: Introduce auto-boot flag")
eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
f5bcb35387ef ("remoteproc: Decouple vdev resources and devices")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha
Sasha Levin
maintainerRe: [PATCH v3 1/1] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to Nikita ShubinHi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation").
The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172, v4.9.215, v4.4.215.
v5.5.8: Build OK!
v5.4.24: Build OK!
v4.19.108: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
v4.14.172: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
v4.9.215: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") 2b45cef5868a ("remoteproc: Further extend the vdev life cycle") a863af5d4193 ("remoteproc: virtio: Anchor vring life cycle in vdev") aab8d8022304 ("remoteproc: Assign kref to rproc_vdev") eb30596eae94 ("remoteproc: add rproc_va_to_pa function") f5bcb35387ef ("remoteproc: Decouple vdev resources and devices")
v4.4.215: Failed to apply! Possible dependencies:
086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") 2b45cef5868a ("remoteproc: Further extend the vdev life cycle")
353861660aa2 ("remoteproc: core: Trivial: Improve error checking, spelling and debug prints") 3d87fa1d47c1 ("remoteproc: core: Task sync during rproc_fw_boot()") 9c219b2337b8 ("remoteproc: core: Ensure error message is clear")
a863af5d4193 ("remoteproc: virtio: Anchor vring life cycle in vdev") aab8d8022304 ("remoteproc: Assign kref to rproc_vdev")
b35d7afc3ba9 ("remoteproc: Calculate max_notifyid during load")
d81fb32f3da6 ("remoteproc: Move vdev handling to boot/shutdown")
ddf711872c9d ("remoteproc: Introduce auto-boot flag")
eb30596eae94 ("remoteproc: add rproc_va_to_pa function")
f5bcb35387ef ("remoteproc: Decouple vdev resources and devices")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha
This patch was applied to andersson/remoteproc.git (refs/heads/for-next).
Hello:
This patch was applied to andersson/remoteproc.git (refs/heads/for-next).
Quoted 8 lines · On Fri, 28 Feb 2020 14:08:04 +0300 you wrote:
From: Nikita Shubin <[email protected]>
.kick method not set in
rproc_opswill result in:8<--- cut here ---
Unable to handle kernel NULL pointer dereference[...]
Here is a summary with links:
- remoteproc: error on kick missing
https://git.kernel.org/andersson/remoteproc/c/791c13b709dd51eb37330f2a5837434e90c87c27
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/pwbot