linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Toshiki Fukasawa <t-fukasawa@vx.jp.nec.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mhocko@kernel.org" <mhocko@kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"hch@lst.de" <hch@lst.de>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Junichi Nomura <j-nomura@ce.jp.nec.com>
Subject: Re: [PATCH 1/2] /proc/kpageflags: prevent an integer overflow in stable_page_flags()
Date: Thu, 25 Jul 2019 09:45:59 +0300	[thread overview]
Message-ID: <20190725064559.GA14323@avx2> (raw)
In-Reply-To: <20190725023100.31141-2-t-fukasawa@vx.jp.nec.com>

On Thu, Jul 25, 2019 at 02:31:16AM +0000, Toshiki Fukasawa wrote:
> stable_page_flags() returns kpageflags info in u64, but it uses
> "1 << KPF_*" internally which is considered as int. This type mismatch
> causes no visible problem now, but it will if you set bit 32 or more as
> done in a subsequent patch. So use BIT_ULL in order to avoid future
> overflow issues.

> -		return 1 << KPF_NOPAGE;
> +		return BIT_ULL(KPF_NOPAGE);

This won't happen until bit 31 is used and all the flags are within int
currently and stable(!), so the problem doesn't exist for them.

Overflow implies some page flags are 64-bit only, which hopefully won't
happen.


  reply	other threads:[~2019-07-25  6:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25  2:31 [PATCH 0/2] fix kernel panic due to use uninitialized struct pages Toshiki Fukasawa
2019-07-25  2:31 ` [PATCH 1/2] /proc/kpageflags: prevent an integer overflow in stable_page_flags() Toshiki Fukasawa
2019-07-25  6:45   ` Alexey Dobriyan [this message]
2019-07-25  2:31 ` [PATCH 2/2] /proc/kpageflags: do not use uninitialized struct pages Toshiki Fukasawa
2019-07-25  9:03   ` Michal Hocko
2019-07-26  6:25     ` Toshiki Fukasawa
2019-07-26  7:06       ` Michal Hocko
2019-08-05  5:12         ` Toshiki Fukasawa
2019-08-06  3:27           ` Dan Williams
2019-08-06  6:46             ` Michal Hocko
2019-08-06 16:15               ` Dan Williams
2019-08-07 13:17                 ` Michal Hocko
2019-08-06  3:34   ` Dan Williams

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=20190725064559.GA14323@avx2 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=t-fukasawa@vx.jp.nec.com \
    /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