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]
Message-ID: <0ecb87dcc4cf42328f1f5a7d6abd08ed@AcuMS.aculab.com>
Date:   Mon, 14 Feb 2022 09:26:20 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     David Laight <David.Laight@...LAB.COM>,
        'Helge Deller' <deller@....de>,
        OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     "linux-parisc@...r.kernel.org" <linux-parisc@...r.kernel.org>
Subject: RE: [PATCH] fat: Use pointer to d_name[0] in put_user() for compat
 case

From: David Laight
> Sent: 14 February 2022 09:12
> 
> From: Helge Deller
> > Sent: 13 February 2022 22:10
> >
> > The put_user(val,ptr) macro wants a pointer in the second parameter, but in
> > fat_ioctl_filldir() the d_name field references a whole "array of chars".
> > Usually the compiler automatically converts it and uses a pointer to that
> > array, but it's more clean to explicitly give the real pointer to where someting
> > is put, which is in this case the first character of the d_name[] array.
> 
> That just isn't true.
> 
> In C both x->char_array and &x->char_array[0] have the same type
> 'char *'.
> 
> The 'bug' is caused by put_user() trying to do:
> 	__typeof__(ptr) __ptr = ptr;
> where __typeof__ is returning char[n] not char *.
> 
> I've tried a few things but can't get __typeof__ to
> generate a suitable type for both a simple type and array.

Actually the issue is that put_user() writes a single variable
and needs a pointer to one.
So changing to:
	put_user(0, &array[0]);
is probably fine.
But the description is all wrong.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ