From: Michael Ellerman <mpe@ellerman.id.au> To: Segher Boessenkool <segher@kernel.crashing.org> Cc: Balbir Singh <bsingharora@gmail.com>, erhard_f@mailbox.org, jack@suse.cz, linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, aneesh.kumar@linux.vnet.ibm.com Subject: Re: [PATCH] powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present() Date: Wed, 20 Feb 2019 22:18:38 +1100 [thread overview] Message-ID: <87sgwi7lo1.fsf@concordia.ellerman.id.au> (raw) In-Reply-To: <20190219201539.GT14180@gate.crashing.org> Segher Boessenkool <segher@kernel.crashing.org> writes: > On Mon, Feb 18, 2019 at 11:49:18AM +1100, Michael Ellerman wrote: >> Balbir Singh <bsingharora@gmail.com> writes: >> > Fair enough, my point was that the compiler can help out. I'll see what >> > -Wconversion finds on my local build :) >> >> I get about 43MB of warnings here :) > > Yes, -Wconversion complains about a lot of things that are idiomatic C. > There is a reason -Wconversion is not in -Wall or -Wextra. Actually a lot of those go away when I add -Wno-sign-conversion. And what's left seems mostly reasonable, they all indicate the possibility of a bug I think. In fact this works and would have caught the bug: diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index d8c8d7c9df15..3114e3f368e2 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -904,7 +904,12 @@ static inline int pud_none(pud_t pud) static inline int pud_present(pud_t pud) { + __diag_push(); + __diag_warn(GCC, 8, "-Wconversion", "ulong -> int"); + return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT)); + + __diag_pop(); } extern struct page *pud_page(pud_t pud); Obviously we're not going to instrument every function like that. But we could start instrumenting particular files. cheers
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au> To: Segher Boessenkool <segher@kernel.crashing.org> Cc: erhard_f@mailbox.org, jack@suse.cz, linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, aneesh.kumar@linux.vnet.ibm.com Subject: Re: [PATCH] powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present() Date: Wed, 20 Feb 2019 22:18:38 +1100 [thread overview] Message-ID: <87sgwi7lo1.fsf@concordia.ellerman.id.au> (raw) In-Reply-To: <20190219201539.GT14180@gate.crashing.org> Segher Boessenkool <segher@kernel.crashing.org> writes: > On Mon, Feb 18, 2019 at 11:49:18AM +1100, Michael Ellerman wrote: >> Balbir Singh <bsingharora@gmail.com> writes: >> > Fair enough, my point was that the compiler can help out. I'll see what >> > -Wconversion finds on my local build :) >> >> I get about 43MB of warnings here :) > > Yes, -Wconversion complains about a lot of things that are idiomatic C. > There is a reason -Wconversion is not in -Wall or -Wextra. Actually a lot of those go away when I add -Wno-sign-conversion. And what's left seems mostly reasonable, they all indicate the possibility of a bug I think. In fact this works and would have caught the bug: diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index d8c8d7c9df15..3114e3f368e2 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -904,7 +904,12 @@ static inline int pud_none(pud_t pud) static inline int pud_present(pud_t pud) { + __diag_push(); + __diag_warn(GCC, 8, "-Wconversion", "ulong -> int"); + return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT)); + + __diag_pop(); } extern struct page *pud_page(pud_t pud); Obviously we're not going to instrument every function like that. But we could start instrumenting particular files. cheers
next prev parent reply other threads:[~2019-02-20 11:18 UTC|newest] Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-14 6:23 [PATCH] powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present() Michael Ellerman 2019-02-14 6:23 ` Michael Ellerman 2019-02-14 16:31 ` Jan Kara 2019-02-14 16:31 ` Jan Kara 2019-02-16 10:55 ` Balbir Singh 2019-02-16 10:55 ` Balbir Singh 2019-02-16 14:22 ` Segher Boessenkool 2019-02-16 14:22 ` Segher Boessenkool 2019-02-17 6:23 ` Balbir Singh 2019-02-17 6:23 ` Balbir Singh 2019-02-17 8:34 ` Michael Ellerman 2019-02-17 21:55 ` Balbir Singh 2019-02-17 21:55 ` Balbir Singh 2019-02-18 0:49 ` Michael Ellerman 2019-02-18 0:49 ` Michael Ellerman 2019-02-19 12:01 ` Balbir Singh 2019-02-19 12:01 ` Balbir Singh 2019-02-19 20:15 ` Segher Boessenkool 2019-02-19 20:15 ` Segher Boessenkool 2019-02-20 11:18 ` Michael Ellerman [this message] 2019-02-20 11:18 ` Michael Ellerman 2019-02-20 14:51 ` Segher Boessenkool 2019-02-20 14:51 ` Segher Boessenkool 2019-02-17 8:34 ` Michael Ellerman 2019-02-16 13:15 ` Andreas Schwab 2019-02-16 13:15 ` Andreas Schwab 2019-02-16 13:15 ` Andreas Schwab 2019-02-17 8:26 ` Michael Ellerman 2019-02-17 8:26 ` Michael Ellerman 2019-02-17 8:21 ` Michael Ellerman 2019-02-17 8:21 ` Michael Ellerman
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=87sgwi7lo1.fsf@concordia.ellerman.id.au \ --to=mpe@ellerman.id.au \ --cc=aneesh.kumar@linux.vnet.ibm.com \ --cc=bsingharora@gmail.com \ --cc=erhard_f@mailbox.org \ --cc=jack@suse.cz \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linuxppc-dev@ozlabs.org \ --cc=segher@kernel.crashing.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.