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

xen-devel

[Top] [All Lists]

[Xen-devel] [PATCH] linux: validate type and value of the dtor argument

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux: validate type and value of the dtor argument of SetPageForeign()
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: 2008年3月13日 16:10:10 +0000
Delivery-date: 2008年3月13日 09:09:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 once, also check the destructor supplied is not NULL.
As usual, written and tested on 2.6.25-rc5 and made apply to the 2.6.18
tree without further testing.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Index: head-2008年03月06日/include/linux/page-flags.h
===================================================================
--- head-2008年03月06日.orig/include/linux/page-flags.h 2008年03月07日 
10:08:24.000000000 +0100
+++ head-2008年03月06日/include/linux/page-flags.h 2008年03月07日 10:12:47.000000000 
+0100
@@ -305,16 +305,17 @@ static inline void __ClearPageTail(struc
 #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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux: validate type and value of the dtor argument of SetPageForeign(), Jan Beulich <=
Previous by Date: [Xen-devel] [PATCH] linux/x86-64: make original definition of VGCF_IN_SYSCALL usable in assembly , Jan Beulich
Next by Date: [Xen-devel] [PATCH] linux/x86: put trap initialization code/data into cpuinit space , Jan Beulich
Previous by Thread: [Xen-devel] [PATCH] linux/x86-64: make original definition of VGCF_IN_SYSCALL usable in assembly , Jan Beulich
Next by Thread: [Xen-devel] [PATCH] linux/x86: put trap initialization code/data into cpuinit space , Jan Beulich
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /