]> xenbits.xensource.com Git - xen.git/commitdiff
trace: share t_info pages only in read-only mode
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 29 Jun 2010 17:18:42 +0000 (18:18 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 29 Jun 2010 17:18:42 +0000 (18:18 +0100)
There's no need to share writably the t_info pages (Dom0 only wants
[and needs] to read it)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
tools/xenmon/xenbaked.c
tools/xentrace/xentrace.c
xen/common/trace.c

index f44a3e8c44bfac391ac62c200b2ead3b5004b988..478fac2bcb9a61eee09784eb2bd8393c574042be 100644 (file)
@@ -84,7 +84,7 @@ typedef struct settings_st {
 } settings_t;
 
 struct t_struct {
-    struct t_info *t_info;  /* Structure with information about individual buffers */
+    const struct t_info *t_info; /* Structure with information about individual buffers */
     struct t_buf **meta;    /* Pointers to trace buffer metadata */
     unsigned char **data;   /* Pointers to trace buffer data areas */
 };
@@ -376,9 +376,8 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
     }
 
     /* Map t_info metadata structure */
-    tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
-                                        tinfo_size, PROT_READ | PROT_WRITE,
-                                        tbufs_mfn);
+    tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+                                        PROT_READ, tbufs_mfn);
 
     if ( tbufs.t_info == 0 ) 
     {
@@ -404,7 +403,8 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
     for(i=0; i<num; i++)
     {
         
-        uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
+        const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
+                                   + tbufs.t_info->mfn_offset[i];
         int j;
         xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
 
index 6291cde033387f2de6a999a142c0049491ec5ed8..8812bfdf3b4632ddc005347d7ea70f4edd7e1f26 100644 (file)
@@ -63,7 +63,7 @@ typedef struct settings_st {
 } settings_t;
 
 struct t_struct {
-    struct t_info *t_info;  /* Structure with information about individual buffers */
+    const struct t_info *t_info; /* Structure with information about individual buffers */
     struct t_buf **meta;    /* Pointers to trace buffer metadata */
     unsigned char **data;   /* Pointers to trace buffer data areas */
 };
@@ -475,9 +475,8 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
     int i;
 
     /* Map t_info metadata structure */
-    tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
-                                        tinfo_size, PROT_READ | PROT_WRITE,
-                                        tbufs_mfn);
+    tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+                                        PROT_READ, tbufs_mfn);
 
     if ( tbufs.t_info == 0 ) 
     {
@@ -503,7 +502,8 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
     for(i=0; i<num; i++)
     {
         
-        uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
+        const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
+                                   + tbufs.t_info->mfn_offset[i];
         int j;
         xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
 
index 9884f6ad6ed8e36690c0ead81cac7a51b4c039ec..17819d0d6956d61c4f7e5be4638e67ce711d96de 100644 (file)
@@ -309,7 +309,7 @@ void __init init_trace_bufs(void)
 
     for(i=0; i<T_INFO_PAGES; i++)
         share_xen_page_with_privileged_guests(
-            virt_to_page(t_info) + i, XENSHARE_writable);
+            virt_to_page(t_info) + i, XENSHARE_readonly);
 
     if ( opt_tbuf_size == 0 )
     {