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: <CAMuHMdUQuZ_fR4VogQ3Eo9NKGMpmAYnWraFAnYLy46uX99r1NQ@mail.gmail.com>
Date:   Sat, 18 Sep 2021 13:20:13 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Rob Landley <rob@...dley.net>
Cc:     Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        Rich Felker <dalias@...c.org>,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jacopo Mondi <jacopo+renesas@...ndi.org>,
        Daniel Palmer <daniel@...f.com>,
        Linux-sh list <linux-sh@...r.kernel.org>,
        Linux MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sh: pgtable-3level: Fix cast to pointer from integer of
 different size

Hi Rob,

On Sat, Sep 18, 2021 at 6:45 AM Rob Landley <rob@...dley.net> wrote:
> On 9/17/21 4:21 AM, Geert Uytterhoeven wrote:
> > On Fri, Sep 17, 2021 at 3:12 AM Rob Landley <rob@...dley.net> wrote:
> >> On 9/15/21 8:50 AM, Geert Uytterhoeven wrote:
> >> >     arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> >> ...
> >> > The truncation to "unsigned long" has been there since forever, so
> >> > probably it still works fine ;-)
> >>
> >> 1) Linux is LP64 so sizeof(long) and sizeof(pointer) always match, so it's not
> >> truncating.
> >>
> >> 2) The sh5 only ever shipped evaluation units, it never had a production run,
> >> and we haven't implemented j64 yet, so all superh targets are currently 32 bit.
> >> (I.E. it's complaining about _expanding_ the pointer, which shouldn't be a
> >> problem as long as endianness is respected.)
> >
> > The build error is for 32-bit.
>
> I know. I'm just saying your fix doesn't seem wrong. (Personally I would have
> just cast once to (void *) and let C not being C++ do the right thing, but eh...)

That would still give a warning, as "unsigned long long" us 64-bit, and
"void *" is 32-bit.

> Not sure I understand the point of the original code though. Under what
> conditions do you want 64 bit page tables on a 32 bit system? (Some PAE variant?)
>
> > If CONFIG_X2TLB=y, pgd_t.pgd is "unsigned long long", i.e. 64-bit, so
> > casting it to a pointer needs an intermediate cast to "unsigned long".
> > See arch/sh/include/asm/page.h:
>
> I can't find a user of it. None of the existing defconfigs select this option:
>
>   $ grep -r X2TLB arch/sh/configs

Note that these are reduced config files, so auto-selected symbols are
not present in the defconfig.

config X2TLB
        def_bool y
        depends on (CPU_SHX2 || CPU_SHX3) && MMU

and e.g.

config CPU_SUBTYPE_SH7723
        bool "Support SH7723 processor"
        select CPU_SH4A
        select CPU_SHX2

>
> And it's weird in other ways, like 8k page size. (Why...?)
>
> Google finds sh-x2 mentioned in Renesas' sh4a debugger docs, but I've never
> played with the renesas "a" variants. The stuff I'm familiar with is all
> following up on what Hitachi did, not Renesas.
>
> *shrug* You fix looks good enough to me.
>
> Acked-by: Rob Landley <rob@...dley.net>

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ