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, 29 Apr 2009 12:12:01 +0200
From:	Michal Simek <monstr@...str.eu>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	linux-kernel@...r.kernel.org, john.williams@...alogix.com
Subject: Re: [PATCH 20/30] microblaze_mmu_v1: uaccess MMU update

Andrew Morton wrote:
> On Mon, 27 Apr 2009 10:32:09 +0200 monstr@...str.eu wrote:
> 
>> +#define __clear_user(addr, n)	(memset((void *)(addr), 0, (n)), 0)
> 
> __clear_user() already takes a void* argument, so the cast is hopefully
> unneeded and undesirable.  The same applies to many other
> architectures.  If someone is passing a non-pointer type to
> __clear_user() then that's potentially a bad thing which we want to
> know about.
> 

Please look at fs/signalfd.c:72. that's the reason why I need __clear_user macro
first parameter is pointer to struct signalfd_siginfo __user.

memset function has the following parameters.
void *memset(void *v_src, int c, __kernel_size_t n)

That's why is cast there. I think that I have to add __force parameter
because without it is there address space mishmash.

Without cast
CHECK   fs/signalfd.c
fs/signalfd.c:72:8: warning: incorrect type in argument 1 (different address spaces)
fs/signalfd.c:72:8:    expected void *<noident>
fs/signalfd.c:72:8:    got struct signalfd_siginfo [noderef] <asn:1>*uinfo

With current cast (void *)
CHECK   fs/signalfd.c
fs/signalfd.c:72:8: warning: cast removes address space of expression

Here is that change which remove address space problem.

#define __clear_user(addr, n)	(memset((__force void *)(addr), 0, (n)), 0)

Am I right?

The same mishmash is for memset_fromio/memset_toio and maybe some others which I want to fix too.

Thanks,
Michal


> IOW, someone screwed up and everyone copied it :(
> 






-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ