linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	mm-commits@vger.kernel.org, masahiroy@kernel.org,
	gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH -mm] -funsigned-char, x86: make struct p4_event_bind::cntr signed array
Date: Thu, 20 Oct 2022 13:17:33 -0700	[thread overview]
Message-ID: <CAHk-=wjvp=ys2adnWwc1PNt3OrZ_0EkFaUcvjiVuOoVNjX_+AA@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wgdXRZy0-3v+vLZdDfRFKFXZLehgmR2QUKSemBA99sfmg@mail.gmail.com>

On Thu, Oct 20, 2022 at 12:39 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> So getting rid of that kind of pointless noise is just about all the
> effort here.

Current status: of 22.5k object files, 971 have differences.

In many cases, the differences are small and trivial. Example:

 - fscrypt_show_test_dummy_encryption() does that same "print a char with %c"

        seq_printf(seq, "%ctest_dummy_encryption=v%d", sep, vers);

which is entirely harmless and exactly the same as that  (but I most
certainly haven't figured out how to automatically script away that
"oh, %c is fine).

And in other cases, there's no actual difference at all, just
different register usage, so the diff looks fairly big, but doesn't
seem to be real.  In one case I looked at, it started with a 'movzbl',
but it was that in both cases, because the type was actually 'unsigned
char' to begin with. But for some reason it just used different
registers. Example:

 - handle_control_request() in drivers/usb/gadget/udc/dummy_hcd.c

   The reason here *seems* to be that

                        char *buf;
                        buf = (char *)urb->transfer_buffer;

   where it really probably should be 'u8 *buf', since it actually
does a cast to 'u8' in one place, but there isn't even any read of
that 'buf' pointer. So the difference seems to be entirely just some
"different type in assignment" cast internal to gcc that then
incidentally generated a random other choice in register allocation.

And in some cases the differences are enormous:

 - drivers/net/wireless/ralink/rt2x00/rt2800lib.c generates a 220kB diff

which seems to be due to entirely different inlining decisions or
something, and the differences are so enormous that I didn't even
start looking at the cause.

There's a fair number of things in between, like fs/ext4/super.c that
generates a lot of differences, some of them obvious, some of them
very much not obvious that may br similar to the
handle_control_request() ones.

*Presumably* the ext4 super.c code is fine (since it has been used on
architectures that already had unsigned char), but it actually
generates a bigger diff than the p4 events driver does...

And that arch/x86/events/intel/p4.c thing that Alexey found sadly does
not stand out at all in that "somewhere in the middle" bunch.

So I think my "hey, we can automate the comparison" is pretty much a
dud, but I'm not giving up quite yet. It's annoying how *most* of the
kernel files show no differences at all, but then I can't even figure
our why other files do show differences with no obvious reason for
them at all.

                Linus

  reply	other threads:[~2022-10-20 20:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221020000356.177CDC433C1@smtp.kernel.org>
2022-10-20  9:43 ` + kbuild-treat-char-as-always-unsigned.patch added to mm-nonmm-unstable branch Alexey Dobriyan
2022-10-20  9:49 ` [PATCH -mm] -funsigned-char, x86: make struct p4_event_bind::cntr signed array Alexey Dobriyan
2022-10-20  9:56   ` [PATCH -mm] -funsigned-char, namei: delete cast in lookup_one_common() Alexey Dobriyan
2022-10-20 16:28   ` [PATCH -mm] -funsigned-char, x86: make struct p4_event_bind::cntr signed array Jason A. Donenfeld
2022-10-20 17:14     ` Linus Torvalds
2022-10-20 17:33       ` Jason A. Donenfeld
2022-10-20 17:42         ` Linus Torvalds
2022-10-20 18:57           ` Kees Cook
2022-10-20 19:39             ` Linus Torvalds
2022-10-20 20:17               ` Linus Torvalds [this message]
2022-10-20 21:34                 ` Andy Shevchenko
2022-10-20 22:46                   ` Jason A. Donenfeld
2022-10-21  6:48                 ` Greg KH
2022-10-21  7:24                   ` Jason A. Donenfeld
2022-10-21  7:36                     ` Greg KH
2022-10-26  1:50             ` Jason A. Donenfeld
2022-10-26 12:58               ` Jason A. Donenfeld
2022-10-26 13:17                 ` Andy Shevchenko
2022-11-02 17:17                 ` [cocci] " Julia Lawall
2022-11-03  0:08                   ` Jason A. Donenfeld
2022-11-03  6:31                     ` Julia Lawall
2022-11-03 12:45                     ` Julia Lawall
2022-11-03 12:47                       ` Jason A. Donenfeld
2022-11-03 12:57                         ` Julia Lawall
2022-11-03 14:07                           ` Jason A. Donenfeld
2022-10-24 15:44         ` Jason A. Donenfeld
2022-10-21  5:59       ` Alexey Dobriyan
2022-10-21 17:11         ` Linus Torvalds
2022-10-21 17:23           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHk-=wjvp=ys2adnWwc1PNt3OrZ_0EkFaUcvjiVuOoVNjX_+AA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=Jason@zx2c4.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).