WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] xen: validate type and value of the d

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] xen: validate type and value of the dtor argument of SetPageForeign()
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 05:41:22 -0700
Delivery-date: Thu, 20 Mar 2008 05:46:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] xen: validate type and value of the dtor argument of SetPageForeign(), Xen patchbot-linux-2.6.18-xen <=