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: <CAK8P3a27sNTiKV--smXd1wUzkGY70uUhS1rif6tgUobE+YYcbw@mail.gmail.com>
Date:   Sun, 4 Nov 2018 23:32:03 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Qu Wenruo <wqu@...e.de>
Cc:     Chris Mason <clm@...com>, David Sterba <DSterba@...e.com>,
        Josef Bacik <josef@...icpanda.com>,
        Gu Jinxiang <gujx@...fujitsu.com>,
        Changbin Du <changbin.du@...il.com>,
        Misono Tomohiro <misono.tomohiro@...fujitsu.com>,
        Anand Jain <anand.jain@...cle.com>,
        Nikolay Borisov <nborisov@...e.com>,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: avoid link error with CONFIG_NO_AUTO_INLINE

On 11/4/18, Qu Wenruo <wqu@...e.de> wrote:
>
>
> On 2018/11/3 下午11:39, Arnd Bergmann wrote:
>> On 32-bit ARM with gcc-8, I see a link error with the addition of the
>> CONFIG_NO_AUTO_INLINE option:
>>
>> fs/btrfs/super.o: In function `btrfs_statfs':
>> super.c:(.text+0x67b8): undefined reference to `__aeabi_uldivmod'
>> super.c:(.text+0x67fc): undefined reference to `__aeabi_uldivmod'
>> super.c:(.text+0x6858): undefined reference to `__aeabi_uldivmod'
>> super.c:(.text+0x6920): undefined reference to `__aeabi_uldivmod'
>> super.c:(.text+0x693c): undefined reference to `__aeabi_uldivmod'
>> fs/btrfs/super.o:super.c:(.text+0x6958): more undefined references to
>> `__aeabi_uldivmod' follow
>>
>> So far this is the only file that shows the behavior, so I'd propose
>> to just work around it by marking the functions as 'static inline'
>> that normally get inlined here.
>
> As a workaround it looks OK, but it's definitely not the root cause.
>
>>
>> The reference to __aeabi_uldivmod comes from a div_u64() which has an
>> optimization for a constant division that uses a straight '/' operator
>> when the result should be known to the compiler. My interpretation is
>> that as we turn off inlining, gcc still expects the result to be constant
>> but fails to use that constant value.
>
> It looks more like a bug in div_u64() optimization.
>
> Despite this file in btrfs, did you hit the same problem for any other
> file?

Not this time. I've done a creduce on the file and got to this code

struct kstatfs {
  u64 f_bfree;
};
btrfs_calc_avail_data_space(p1) {}
btrfs_statfs(struct kstatfs *p1) {
  u64 d = 0;
  unsigned e = 1;
  for (; a;)
    e = btrfs_bg_type_to_factor();
  p1->f_bfree = div_u64(0, e) >> c;
  __asm__("");
  div_u64(d, e);
  b = btrfs_calc_avail_data_space(&d);
}

Looking at the assembler code produced by this, it seems to be
the same thing that we dealt with in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785

>> Cc: Changbin Du <changbin.du@...il.com>
>> Fixes: 943b8435c3bd ("kernel hacking: add a config option to disable
>> compiler auto-inlining")
>
> I can't find it in the mainline kernel, is the commit hash correct?
> If not merged, we should still has a chance to further polish that patch.

It's in linux-next.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ