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: <CAK8P3a2_Rkz3y662mxKTva_rrzHpOQ9fQ+pedenWCZCehxgxPw@mail.gmail.com>
Date:   Tue, 23 Apr 2019 10:05:50 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     Martin Schwidefsky <schwidefsky@...ibm.com>,
        Heiko Carstens <heiko.carstens@...ibm.com>,
        clang-built-linux@...glegroups.com,
        Nathan Chancellor <natechancellor@...il.com>,
        linux-s390 <linux-s390@...r.kernel.org>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Janosch Frank <frankja@...ux.ibm.com>,
        Collin Walling <walling@...ux.ibm.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/4] s390: fix clang -Wpointer-sign warnigns in boot code

On Mon, Apr 22, 2019 at 7:52 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@...glegroups.com> wrote:

> > @@ -20,7 +20,7 @@ extern __u8 _ebc_tolower[256]; /* EBCDIC -> lowercase */
> >  extern __u8 _ebc_toupper[256]; /* EBCDIC -> uppercase */
> >
> >  static inline void
> > -codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
> > +codepage_convert(const __u8 *codepage, volatile char* addr, unsigned long nr)
> >  {
> >         if (nr-- <= 0)
> >                 return;
>
> There are many call sites of ASCEBC which is defined in terms of this
> function. Do they all use `char*`?  grep shows an explicit cast to
> `unsigned char*` in drivers/s390/char/tape_std.c for example.

Generally speaking, the kernel is full of Wpointer-sign warnings, that's why
this warning is disabled in the top-level Makefile by default. My patch fixes
the ones in the s390 boot code that is not built with those default flags, but
I made no attempt to fix the rest of the kernel.

Fun fact: on most architectures, 'char' is signed, but on s390 and 32-bit
arm it is unsigned. The compiler treats 'char', 'unsigned char' and
'signed char'
as three distinct types here for that reason.

> > diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
> > index cc0947e08b6f..f3a637afd485 100644
> > --- a/arch/s390/include/asm/lowcore.h
> > +++ b/arch/s390/include/asm/lowcore.h
> > @@ -128,7 +128,7 @@ struct lowcore {
> >         /* SMP info area */
> >         __u32   cpu_nr;                         /* 0x0398 */
> >         __u32   softirq_pending;                /* 0x039c */
> > -       __u32   preempt_count;                  /* 0x03a0 */
> > +       __s32   preempt_count;                  /* 0x03a0 */
>
> This change is less obvious. Do you still have the warning for that
> this hunk fixes?

I can't find it now, but there are multiple users that would cause
this, like:

static inline void preempt_count_set(int pc)
{
        int old, new;

        do {
                old = READ_ONCE(S390_lowcore.preempt_count);
                new = (old & PREEMPT_NEED_RESCHED) |
                        (pc & ~PREEMPT_NEED_RESCHED);
        } while (__atomic_cmpxchg(&S390_lowcore.preempt_count,
                                  old, new) != old);
}


      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ