@@ -99,7 +99,6 @@ struct xol_area {
99
99
atomic_t slot_count ; /* number of in-use slots */
100
100
unsigned long * bitmap ; /* 0 = free slot */
101
101
102
- struct vm_special_mapping xol_mapping ;
103
102
struct page * pages [2 ];
104
103
/*
105
104
* We keep the vma's vm_start rather than a pointer to the vma
@@ -1433,6 +1432,21 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
1433
1432
set_bit (MMF_RECALC_UPROBES , & vma -> vm_mm -> flags );
1434
1433
}
1435
1434
1435
+ static vm_fault_t xol_fault (const struct vm_special_mapping * sm ,
1436
+ struct vm_area_struct * vma , struct vm_fault * vmf )
1437
+ {
1438
+ struct xol_area * area = vma -> vm_mm -> uprobes_state .xol_area ;
1439
+
1440
+ vmf -> page = area -> pages [0 ];
1441
+ get_page (vmf -> page );
1442
+ return 0 ;
1443
+ }
1444
+
1445
+ static const struct vm_special_mapping xol_mapping = {
1446
+ .name = "[uprobes]" ,
1447
+ .fault = xol_fault ,
1448
+ };
1449
+
1436
1450
/* Slot allocation for XOL */
1437
1451
static int xol_add_vma (struct mm_struct * mm , struct xol_area * area )
1438
1452
{
@@ -1459,7 +1473,7 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area)
1459
1473
1460
1474
vma = _install_special_mapping (mm , area -> vaddr , PAGE_SIZE ,
1461
1475
VM_EXEC |VM_MAYEXEC |VM_DONTCOPY |VM_IO ,
1462
- & area -> xol_mapping );
1476
+ & xol_mapping );
1463
1477
if (IS_ERR (vma )) {
1464
1478
ret = PTR_ERR (vma );
1465
1479
goto fail ;
@@ -1498,9 +1512,6 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
1498
1512
if (!area -> bitmap )
1499
1513
goto free_area ;
1500
1514
1501
- area -> xol_mapping .name = "[uprobes]" ;
1502
- area -> xol_mapping .fault = NULL ;
1503
- area -> xol_mapping .pages = area -> pages ;
1504
1515
area -> pages [0 ] = alloc_page (GFP_HIGHUSER );
1505
1516
if (!area -> pages [0 ])
1506
1517
goto free_bitmap ;
0 commit comments