Messages in this thread | | | Date | Fri, 10 Jul 2009 22:02:59 +0200 | From | Ingo Molnar <> | Subject | Re: [GIT PULL] core kernel fixes |
| |
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Fri, 10 Jul 2009, Ingo Molnar wrote: > > > > > > but I really migth have done soemthing wrong there. It's a > > > simple function, but somebody needs to double-check that I > > > haven't made it worse. > > > > Looks correct to me. > > Note, I didn't look at how 'end' works, and it really does matter > if 'end' is an "inclusive" or "exclusive" end pointer address. So > my replacement overlap() function was written more as a conceptual > patch - I did not check the exact semantics of the arguments > passed in. > > If 'end' is exclusive, then 'b1' should be calculated as > 'a1+size-1', because the ranges must have the same rules. And then > you should use the 'strict inequality' operators for testing the > ranges.
The ranges are inclusive in terms of non-overlap: we can have adjacent ranges with b1==a2 or b2==a1 that are still considered non-overlapping. Hence the sharp test you used (which is negated) looks correct to me.
The end-of-range symbols we use:
if (overlap(addr, len, _text, _etext) || overlap(addr, len, __start_rodata, __end_rodata))
Are all at the first byte outside of the to-be-avoided range:
.text : { _text = .; /* Text */ *(.text) *(.text.*) _etext = . ; }
...
__param : AT(ADDR(__param) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start___param) = .; \ *(__param) \ VMLINUX_SYMBOL(__stop___param) = .; \ . = ALIGN((align)); \ VMLINUX_SYMBOL(__end_rodata) = .; \ } \
...
I think ...
Ingo
| |