[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] xen: validate type and value of the dtor argument of SetPageForeign()
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1205838817 0 # Node ID 6a196954e47927cd63ee98d1d11271358fabaab9 # Parent 14818545121dc84436f8d0dd70c593e42e98e29c xen: validate type and value of the dtor argument of SetPageForeign() Linux 2.6.25 changes the protoype of pte_free() etc., resulting in those functions no longer be suitable as a PageForeign destructor. I had to find out by way of analysing a crash, but for the future it'd be much better if the build would already indicate a problem with this. At the same time, also check the destructor supplied is not NULL. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- include/linux/page-flags.h | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff -r 14818545121d -r 6a196954e479 include/linux/page-flags.h --- a/include/linux/page-flags.h Mon Mar 17 11:21:25 2008 +0000 +++ b/include/linux/page-flags.h Tue Mar 18 11:13:37 2008 +0000 @@ -250,16 +250,17 @@ #define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags) #define PageForeign(page) test_bit(PG_foreign, &(page)->flags) -#define SetPageForeign(page, dtor) do { \ - set_bit(PG_foreign, &(page)->flags); \ - (page)->index = (long)(dtor); \ +#define SetPageForeign(_page, dtor) do { \ + set_bit(PG_foreign, &(_page)->flags); \ + BUG_ON((dtor) == (void (*)(struct page *))0); \ + (_page)->index = (long)(dtor); \ } while (0) -#define ClearPageForeign(page) do { \ - clear_bit(PG_foreign, &(page)->flags); \ - (page)->index = 0; \ +#define ClearPageForeign(page) do { \ + clear_bit(PG_foreign, &(page)->flags); \ + (page)->index = 0; \ } while (0) -#define PageForeignDestructor(page) \ - ( (void (*) (struct page *)) (page)->index )(page) +#define PageForeignDestructor(_page) \ + ((void (*)(struct page *))(_page)->index)(_page) struct page; /* forward declaration */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |