Skip to contentSkip to conversation

Invalid VA => ptr conversion with xc_dom_* API after XSA-55 fox

DISCUSSION Jan Beulich 3 participants 3 messages Nov 20, 2013 – Nov 28, 2013 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Jean-Yves Migeon (NetBSD)

Jeff and FastIce pointed out a regression between Xen 4.1.2 and 4.1.6 when starting NetBSD domU; the kernel syms table gets slightly corrupted [1].

Quoted 8 lines

After dwelling into libxc code, FastIce noticed that changing back the return value to "ptr + offset" (instead of just "ptr") for xc_dom_vaddr_to_ptr() makes it work again.

According to [2] while fixing XSA-55, Ian changed the "ptr + offset" return value to just "ptr". Is there a reason for this? IMHO the VA => ptr conversion should also take into account non-page aligned addresses, hence the offset (except for NULL value of course).

I agree, but let's see what Ian (being the author of the whole patch set) says.

Jan

#2 lore raw

Jan Beulich writes ("Re: [Xen-devel] Invalid VA => ptr conversion with xc_dom_* API after XSA-55 fox"):

Quoted 9 lines · Jean-Yves Migeon (NetBSD)
Quoted 8 lines

Jeff and FastIce pointed out a regression between Xen 4.1.2 and 4.1.6 when starting NetBSD domU; the kernel syms table gets slightly corrupted [1].

After dwelling into libxc code, FastIce noticed that changing back the return value to "ptr + offset" (instead of just "ptr") for xc_dom_vaddr_to_ptr() makes it work again.

Quoted 7 lines
Quoted 4 lines

According to [2] while fixing XSA-55, Ian changed the "ptr + offset" return value to just "ptr". Is there a reason for this? IMHO the VA => ptr conversion should also take into account non-page aligned addresses, hence the offset (except for NULL value of course).

I agree, but let's see what Ian (being the author of the whole patch set) says.

It looks like I changed this in b5a86920. Having stared at the code and the commit message I think that I did in fact break this, by inadvertantly removing the "+ offset". Sorry to cause a regression.

I've examined the surrounding code and reread the relevant bits of xc_dom_pfn_to_ptr_retcount and I think that simpy returning "ptr + offset" is the correct fix. The calculation of *safe_region_out is already correct.

Will someone write this up as a patch submission ?

In any case, the fix ought to be backported.

Thanks,
Ian.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Le 25/11/2013 12:44, Ian Jackson a écrit :

Quoted 29 lines

Jan Beulich writes ("Re: [Xen-devel] Invalid VA => ptr conversion with xc_dom_* API after XSA-55 fox"):

Quoted 14 lines · Jean-Yves Migeon (NetBSD)
Quoted 1 line

Jeff and FastIce pointed out a regression between Xen 4.1.2 and

4.1.6

Quoted 1 line

when starting NetBSD domU; the kernel syms table gets slightly

corrupted

Quoted 3 lines

[1].

After dwelling into libxc code, FastIce noticed that changing back

the

Quoted 4 lines

return value to "ptr + offset" (instead of just "ptr") for xc_dom_vaddr_to_ptr() makes it work again.

According to [2] while fixing XSA-55, Ian changed the "ptr +

offset"

Quoted 8 lines
Quoted 1 line

return value to just "ptr". Is there a reason for this? IMHO the

VA =>

Quoted 1 line

ptr conversion should also take into account non-page aligned

addresses,

Quoted 1 line

hence the offset (except for NULL value of course).

I agree, but let's see what Ian (being the author of the whole patch set) says.

It looks like I changed this in b5a86920. Having stared at the code and the commit message I think that I did in fact break this, by inadvertantly removing the "+ offset". Sorry to cause a regression.

Quoted 6 lines

I've examined the surrounding code and reread the relevant bits of xc_dom_pfn_to_ptr_retcount and I think that simpy returning "ptr + offset" is the correct fix. The calculation of *safe_region_out is already correct.

Will someone write this up as a patch submission ?

Will do (tonight).

Quoted 3 lines

In any case, the fix ought to be backported.

Thanks,

Thanks for your review!

Cheers,

Signature · 7 lines
Jean-Yves Migeon
jym@

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel