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:   Wed, 14 Apr 2021 20:47:48 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16]

On Wed, Apr 14, 2021 at 07:33:38PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 14, 2021 at 08:12:46PM +0300, Alexander Shishkin wrote:
> > From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > 
> > It appears that uuid_t use in STM code abuses UUID API.
> 
> How is it being abused?

We are using it against the buffer that is u8, and neither uuid_t nor guid_t.

> Moreover,
> > this type is only useful when we parse user input. Due to above
> > replace uuid_t with u8 uuid[16] and use uuid_t only when parse
> > user input.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> > ---
> >  drivers/hwtracing/stm/p_sys-t.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/hwtracing/stm/p_sys-t.c b/drivers/hwtracing/stm/p_sys-t.c
> > index 360b5c03df95..04d13b3785d3 100644
> > --- a/drivers/hwtracing/stm/p_sys-t.c
> > +++ b/drivers/hwtracing/stm/p_sys-t.c
> > @@ -76,7 +76,7 @@ enum sys_t_message_string_subtype {
> >  				 MIPI_SYST_SEVERITY(MAX))
> >  
> >  struct sys_t_policy_node {
> > -	uuid_t		uuid;
> > +	u8		uuid[UUID_SIZE];
> 
> This feels wrong, what is wrong with the uuid_t type usage here?

Nothing, just will require additional export_uuid() / import_uuid() call.

> >  	bool		do_len;
> >  	unsigned long	ts_interval;
> >  	unsigned long	clocksync_interval;
> > @@ -92,7 +92,7 @@ static void sys_t_policy_node_init(void *priv)
> >  {
> >  	struct sys_t_policy_node *pn = priv;
> >  
> > -	generate_random_uuid(pn->uuid.b);
> 
> Ok, that's not good, but that looks to be a flaw in the
> generate_random_uuid() api, not this driver implementation.
> 
> I don't understand why this change is needed?

Using raw buffer APIs against uuid_t / guid_t.

We can import_uuid() first and call uuid_gen() against it. Will it work for
you?

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ