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: <20170802234431.GH84665@google.com>
Date:   Wed, 2 Aug 2017 16:44:31 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     zijun_hu <zijun_hu@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will.deacon@....com>,
        Mark Rutland <mark.rutland@....com>,
        Laura Abbott <labbott@...hat.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        Doug Anderson <dianders@...omium.org>,
        Greg Hackmann <ghackmann@...gle.com>
Subject: Re: [PATCH 2/2] arm64: Define PAGE_OFFSET using GENMASK_ULL

El Wed, Aug 02, 2017 at 04:19:11PM -0700 Nick Desaulniers ha dit:

> hmm, seems including the definition of GENMASK_ULL causes tons of issues
> see definition of UL() macro
> defines _AC
> token pastes UL on literal when not assembly
> so looks like GENMASK_ULL is not ready to be used from assembly

sorry, it seems I only did a partial build when testing this :/

> On Wed, Aug 2, 2017 at 4:13 PM, Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> > don't forget to include linux/bitops.h now in memory.h
> >
> > /usr/local/google/home/ndesaulniers/android/kernel-wahoo/private/msm-google/arch/arm64/kernel/head.S:47:8:
> > error:
> >       function-like macro 'GENMASK_ULL' is not defined
> > #elif (PAGE_OFFSET & 0x1fffff) != 0
> >        ^
> > /usr/local/google/home/ndesaulniers/android/kernel-wahoo/private/msm-google/arch/arm64/include/asm/memory.h:52:22:
> > note:
> >
> >       expanded from macro 'PAGE_OFFSET'
> > #define PAGE_OFFSET             GENMASK_ULL(BITS_PER_LONG_LONG - 1, VA_BITS - 1)
> >                                 ^
> > 1 error generated.
> >
> > On Wed, Aug 2, 2017 at 3:51 PM, Matthias Kaehlcke <mka@...omium.org> wrote:
> >> As is the definition causes an integer overflow, which is expected,
> >> however clang raises the following warning:
> >>
> >> arch/arm64/kernel/head.S:47:8: warning:
> >>       integer overflow in preprocessor expression
> >>   #elif (PAGE_OFFSET & 0x1fffff) != 0
> >>          ^~~~~~~~~~~
> >> arch/arm64/include/asm/memory.h:52:46: note:
> >>       expanded from macro 'PAGE_OFFSET'
> >>   #define PAGE_OFFSET             (UL(0xffffffffffffffff) << (VA_BITS - 1))
> >>                                       ~~~~~~~~~~~~~~~~~~  ^  ~~~~~~~~~~~~~
> >>
> >> Use GENMASK_ULL() instead of shifting explicitly, the macro takes care
> >> of avoiding the overflow.
> >>
> >> Reported-by: Nick Desaulniers <ndesaulniers@...gle.com>
> >> Signed-off-by: Matthias Kaehlcke <mka@...omium.org>
> >> ---
> >>  arch/arm64/include/asm/memory.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> >> index 32f82723338a..732d4eed8edd 100644
> >> --- a/arch/arm64/include/asm/memory.h
> >> +++ b/arch/arm64/include/asm/memory.h
> >> @@ -65,7 +65,7 @@
> >>   */
> >>  #define VA_BITS                        (CONFIG_ARM64_VA_BITS)
> >>  #define VA_START               (UL(0xffffffffffffffff) << VA_BITS)
> >> -#define PAGE_OFFSET            (UL(0xffffffffffffffff) << (VA_BITS - 1))
> >> +#define PAGE_OFFSET            GENMASK_ULL(BITS_PER_LONG_LONG - 1, VA_BITS - 1)
> >>  #define KIMAGE_VADDR           (MODULES_END)
> >>  #define MODULES_END            (MODULES_VADDR + MODULES_VSIZE)
> >>  #define MODULES_VADDR          (VA_START + KASAN_SHADOW_SIZE)
> >>
> >
> >
> >
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ