Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533437

Re: [RFC] ARC: mm: Restrict definition of pfn_valid() macro for CONFIG_FLATMEM

From Vineet Gupta <Vineet.Gupta1@synopsys.com>
Newsgroups linux.kernel
Subject Re: [RFC] ARC: mm: Restrict definition of pfn_valid() macro for CONFIG_FLATMEM
Date 2016-11-30 18:00 +0100
Message-ID <sJgoG-9j-7@gated-at.bofh.it> (permalink)
References <sISw2-1KH-43@gated-at.bofh.it> <sJ9dv-4cm-17@gated-at.bofh.it> <sJe3v-7fx-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/30/2016 06:21 AM, Yuriy Kolerov wrote:
>> On Tue 29-11-16 18:29:06, Yuriy Kolerov wrote:
>>> > > Despite the fact that subtraction of unsigned integers is a defined
>>> > > behaviour however such operations can lead to unexpected results. Thus
>>> > > it is better to check both left and right boundaries to avoid
>>> > > potential bugs as it done in the generic page.h.
>> > 
>> > Why and which code would use an out of range pfn? Why other arches do
>> > not need to care?
> Actually some arches do care about checking of both left and right boundaries (e.g. avr32, sparc, etc). The problem is that a value of pfn may be calculated incorrectly in some places of the kernel. E.g. not long ago I sent a patch which fixes truncation of the most significant byte in pfn/pte in some cases (in the kernel with PAE40, however it is not a FLATMEM case). So such situations can happens in the most unexpected places.
> 

So the point is - is this a preventive fix (desired thing) or it being there would
have helped find the PAE40 bug earlier / easier. Woudl it have prevented the
kernel crash. If so then this is a nobrainer fix.

BTW did you try to gauge the code gen impact - this function gets pulled all over
the place in mm code. So build kernel with and w/o change and do a
scripts/bloat-o-meter

-Vineet

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] ARC: mm: Restrict definition of pfn_valid() macro for CONFIG_FLATMEM Yuriy Kolerov <yuriy.kolerov@synopsys.com> - 2016-11-29 16:30 +0100
  Re: [RFC] ARC: mm: Restrict definition of pfn_valid() macro for  CONFIG_FLATMEM Michal Hocko <mhocko@kernel.org> - 2016-11-30 10:20 +0100
    RE: [RFC] ARC: mm: Restrict definition of pfn_valid() macro for  CONFIG_FLATMEM Yuriy Kolerov <Yuriy.Kolerov@synopsys.com> - 2016-11-30 15:30 +0100
      Re: [RFC] ARC: mm: Restrict definition of pfn_valid() macro for  CONFIG_FLATMEM Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-11-30 18:00 +0100
        RE: [RFC] ARC: mm: Restrict definition of pfn_valid() macro for  CONFIG_FLATMEM Yuriy Kolerov <Yuriy.Kolerov@synopsys.com> - 2016-12-02 15:20 +0100

csiph-web