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, 11 Nov 2020 01:09:10 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Ansuel Smith <ansuelsmth@...il.com>
Cc:     Will Deacon <will@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mark Rutland <mark.rutland@....com>,
        Pavel Tatashin <pasha.tatashin@...een.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm64: fix missing include in asm uaccess.h

On Wed, Nov 11, 2020 at 12:58:26AM +0000, Al Viro wrote:
> On Wed, Nov 11, 2020 at 01:44:38AM +0100, Ansuel Smith wrote:
> > Fix a compilation error as PF_KTHREAD is defined in linux/sched.h and
> > this is missing.
> > 
> > Fixes: df325e05a682 ("arm64: Validate tagged addresses in access_ok()
> > called from kernel threads")
> > Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
> > ---
> >  arch/arm64/include/asm/uaccess.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
> > index 991dd5f031e4..51a4f63f464a 100644
> > --- a/arch/arm64/include/asm/uaccess.h
> > +++ b/arch/arm64/include/asm/uaccess.h
> > @@ -7,6 +7,8 @@
> >  #ifndef __ASM_UACCESS_H
> >  #define __ASM_UACCESS_H
> >  
> > +#include <linux/sched.h>
> > +
> >  #include <asm/alternative.h>
> >  #include <asm/kernel-pgtable.h>
> >  #include <asm/sysreg.h>
> 
> NAK.  The real bug is in arch/arm64/include/asm/asm-prototypes.h -
> it has no business pulling asm/uaccess.h
> 
> Just include linux/uaccess.h instead.

BTW,
$ grep -n uaccess.h `find -name asm-prototypes.h`
./arch/alpha/include/asm/asm-prototypes.h:7:#include <linux/uaccess.h>
./arch/arm64/include/asm/asm-prototypes.h:18:#include <asm/uaccess.h>
./arch/ia64/include/asm/asm-prototypes.h:12:#include <linux/uaccess.h>
./arch/mips/include/asm/asm-prototypes.h:6:#include <linux/uaccess.h>
./arch/powerpc/include/asm/asm-prototypes.h:14:#include <linux/uaccess.h>
./arch/sparc/include/asm/asm-prototypes.h:9:#include <linux/uaccess.h>
./arch/x86/include/asm/asm-prototypes.h:3:#include <linux/uaccess.h>

Spot the irregularity...

While we are at it,
$ git grep -n -w '#.*include.*asm/uaccess.h'
arch/arm64/include/asm/asm-prototypes.h:18:#include <asm/uaccess.h>
arch/nds32/math-emu/fpuemu.c:5:#include <asm/uaccess.h>
arch/powerpc/kvm/book3s_xive_native.c:15:#include <asm/uaccess.h>
arch/powerpc/mm/book3s64/radix_pgtable.c:30:#include <asm/uaccess.h>
drivers/s390/net/ctcm_mpc.c:50:#include <linux/uaccess.h>       /* instead of <asm/uaccess.h> ok ? */
include/linux/uaccess.h:11:#include <asm/uaccess.h>

The last one is the only such include that should exist; drivers/s390 one
is obviously a false positive.  And IMO the right thing to do is to
replace the remaining arch/* instances with includes of linux/uaccess.h.

All of those are asking for trouble; any change moving e.g. a common
variant of some primitive into linux/uaccess.h might end up breaking
those.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ