lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 27 Mar 2020 13:36:02 -0600
From:   Mathieu Poirier <mathieu.poirier@...aro.org>
To:     Arnaud POULIQUEN <arnaud.pouliquen@...com>
Cc:     Suman Anna <s-anna@...com>, Ohad Ben-Cohen <ohad@...ery.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        linux-remoteproc <linux-remoteproc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] rpmsg: core: Add wildcard match for name service

On Fri, Mar 27, 2020 at 10:35:34AM +0100, Arnaud POULIQUEN wrote:
> Hi
> 
> On 3/26/20 11:01 PM, Mathieu Poirier wrote:
> > On Thu, 26 Mar 2020 at 14:42, Suman Anna <s-anna@...com> wrote:
> >>
> >> On 3/26/20 3:21 PM, Mathieu Poirier wrote:
> >>> On Thu, 26 Mar 2020 at 09:06, Suman Anna <s-anna@...com> wrote:
> >>>>
> >>>> Hi Mathieu,
> >>>>
> >>>> On 3/10/20 10:50 AM, Mathieu Poirier wrote:
> >>>>> Adding the capability to supplement the base definition published
> >>>>> by an rpmsg_driver with a postfix description so that it is possible
> >>>>> for several entity to use the same service.
> >>>>>
> >>>>> Signed-off-by: Mathieu Poirier <mathieu.poirier@...aro.org>
> >>>>> Acked-by: Arnaud Pouliquen <arnaud.pouliquen@...com>
> >>>>
> >>>> So, the concern I have here is that we are retrofitting this into the
> >>>> existing 32-byte name field, and the question is if it is going to be
> >>>> enough in general. That's the reason I went with the additional 32-byte
> >>>> field with the "rpmsg: add a description field" patch.
> >>>>
> >>>
> >>> That's a valid concern.
> >>>
> >>> Did you consider increasing the size of RPMSG_NAME_SIZE to 64? Have
> >>> you found cases where that wouldn't work?  I did a survey of all the
> >>> places the #define is used and all destination buffers are also using
> >>> the same #define in their definition.  It would also be backward
> >>> compatible with firmware implementations that use 32 byte.
> >>
> >> You can't directly bump the size without breaking the compatibility on
> >> the existing rpmsg_ns_msg in firmwares right? All the Linux-side drivers
> >> will be ok since they use the same macro but rpmsg_ns_msg has presence
> >> on both kernel and firmware-sides.
> > 
> > Ah yes yes... The amount of bytes coming out of the pipe won't match.
> > Let me think a little...
> 
> +1 for Suman's concern.
> 
> Anyway i would like to challenge the need of more than 32 bytes to
> differentiate service instances.
> "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", seems to me enough if we only need
> to differentiate the instances.
> 
> But perhaps the need is also to provide a short description of the service?
> 
> Suman, could you share some examples of your need?

Looking at things further it is possible to extend the name of the service to
64 byte while keeping backward compatibility by looking up the size of @len
in function rpmsg_ns_cb().  From there work with an rpmsg_ns_msg or a new
rpmsg_ns_msg64, pretty much the way you did in your patch[1].  In fact the
approach is the same except you are using 2 arrays of 32 byte and I'm using one
of 64. 

As Arnaud mentioned, is there an immediate need to support a 64-byte name?  If
not than I suggest to move forward with this patch and address the issue when we
get there - at least we know there is room for extention. Otherwise I'll spin
off another revision but it will be bigger and more complex.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/patch/11096599/

> 
> Regards
> Arnaud
>    
> > 
> >>
> >> regards
> >> Suman
> >>
> >>>
> >>> Thanks,
> >>> Mathieu
> >>>
> >>>> regards
> >>>> Suman
> >>>>
> >>>>> ---
> >>>>> Changes for V2:
> >>>>> - Added Arnaud's Acked-by.
> >>>>> - Rebased to latest rproc-next.
> >>>>>
> >>>>>  drivers/rpmsg/rpmsg_core.c | 20 +++++++++++++++++++-
> >>>>>  1 file changed, 19 insertions(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> >>>>> index e330ec4dfc33..bfd25978fa35 100644
> >>>>> --- a/drivers/rpmsg/rpmsg_core.c
> >>>>> +++ b/drivers/rpmsg/rpmsg_core.c
> >>>>> @@ -399,7 +399,25 @@ ATTRIBUTE_GROUPS(rpmsg_dev);
> >>>>>  static inline int rpmsg_id_match(const struct rpmsg_device *rpdev,
> >>>>>                                 const struct rpmsg_device_id *id)
> >>>>>  {
> >>>>> -     return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0;
> >>>>> +     size_t len = min_t(size_t, strlen(id->name), RPMSG_NAME_SIZE);
> >>>>> +
> >>>>> +     /*
> >>>>> +      * Allow for wildcard matches.  For example if rpmsg_driver::id_table
> >>>>> +      * is:
> >>>>> +      *
> >>>>> +      * static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = {
> >>>>> +      *      { .name = "rpmsg-client-sample" },
> >>>>> +      *      { },
> >>>>> +      * }
> >>>>> +      *
> >>>>> +      * Then it is possible to support "rpmsg-client-sample*", i.e:
> >>>>> +      *      rpmsg-client-sample
> >>>>> +      *      rpmsg-client-sample_instance0
> >>>>> +      *      rpmsg-client-sample_instance1
> >>>>> +      *      ...
> >>>>> +      *      rpmsg-client-sample_instanceX
> >>>>> +      */
> >>>>> +     return strncmp(id->name, rpdev->id.name, len) == 0;
> >>>>>  }
> >>>>>
> >>>>>  /* match rpmsg channel and rpmsg driver */
> >>>>>
> >>>>
> >>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ