mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: cuigaosheng <cuigaosheng1@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
	<tony.luck@intel.com>, <pawan.kumar.gupta@linux.intel.com>,
	<pbonzini@redhat.com>, <chenyi.qiang@intel.com>,
	<jithu.joseph@intel.com>, <alexs@kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/cpu: fix undefined behavior in bit shift for intel_detect_tlb
Date: Tue, 1 Nov 2022 19:48:07 +0800	[thread overview]
Message-ID: <bdb64d3b-bfe2-6505-c24a-770675b697bb@huawei.com> (raw)
In-Reply-To: <Y1/AaJOcgIc/INtv@hirez.programming.kicks-ass.net>

We don't need to add UBSAN calltrace, so I have merged the patch with another
patch("x86/cpu: replacing the open-coded shift with BIT(x)"), please ignore
this patch,thanks for review this patch!

On 2022/10/31 20:32, Peter Zijlstra wrote:
> On Mon, Oct 31, 2022 at 01:30:57PM +0100, Peter Zijlstra wrote:
>> On Mon, Oct 31, 2022 at 07:43:40PM +0800, Gaosheng Cui wrote:
>>> Shifting signed 32-bit value by 31 bits is undefined, so changing
>>> significant bit to unsigned. The UBSAN warning calltrace like below:
>>>
>>> UBSAN: shift-out-of-bounds in arch/x86/kernel/cpu/intel.c:948:21
>>> left shift of 1 by 31 places cannot be represented in type 'int'
>> Is it really? Shouldn't -fstrict-overflow define this case?
> -fno-strict-overflow that is, which implies -fwrapv which ensures 2s
> complement, at which point shifting signed numbers is fully defined.
>
> .

      reply	other threads:[~2022-11-01 11:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 11:43 Gaosheng Cui
2022-10-31 12:04 ` Alex Shi
2022-10-31 12:30 ` Peter Zijlstra
2022-10-31 12:32   ` Peter Zijlstra
2022-11-01 11:48     ` cuigaosheng [this message]

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=bdb64d3b-bfe2-6505-c24a-770675b697bb@huawei.com \
    --to=cuigaosheng1@huawei.com \
    --cc=alexs@kernel.org \
    --cc=bp@alien8.de \
    --cc=chenyi.qiang@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jithu.joseph@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.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: 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

all inboxes | Powered by JetHome®