vma.c (cc8cb3697a8d8eabe1fb9acb8768b11c1ab607d8) | vma.c (01c373e9a5ce2273812eaf83036c5357829fb3f7) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2 3#include <stdbool.h> 4#include <stdio.h> 5#include <stdlib.h> 6 7#include "maple-shared.h" 8#include "vma_internal.h" --- 373 unchanged lines hidden (view full) --- 382 .anon_vma = &dummy_anon_vma, 383 }; 384 struct anon_vma_chain dummy_anon_vma_chain_c = { 385 .anon_vma = &dummy_anon_vma, 386 }; 387 struct anon_vma_chain dummy_anon_vma_chain_d = { 388 .anon_vma = &dummy_anon_vma, 389 }; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2 3#include <stdbool.h> 4#include <stdio.h> 5#include <stdlib.h> 6 7#include "maple-shared.h" 8#include "vma_internal.h" --- 373 unchanged lines hidden (view full) --- 382 .anon_vma = &dummy_anon_vma, 383 }; 384 struct anon_vma_chain dummy_anon_vma_chain_c = { 385 .anon_vma = &dummy_anon_vma, 386 }; 387 struct anon_vma_chain dummy_anon_vma_chain_d = { 388 .anon_vma = &dummy_anon_vma, 389 }; |
390 const struct vm_operations_struct vm_ops = { 391 .close = dummy_close, 392 }; |
|
390 int count; 391 struct vm_area_struct *vma, *vma_a, *vma_b, *vma_c, *vma_d; 392 bool merged; 393 394 /* 395 * 0123456789abc 396 * AA B CC 397 */ --- 27 unchanged lines hidden (view full) --- 425 ASSERT_EQ(mm.map_count, 4); 426 427 /* 428 * Merge BOTH sides. 429 * 430 * 0123456789abc 431 * AA*B DD CC 432 */ | 393 int count; 394 struct vm_area_struct *vma, *vma_a, *vma_b, *vma_c, *vma_d; 395 bool merged; 396 397 /* 398 * 0123456789abc 399 * AA B CC 400 */ --- 27 unchanged lines hidden (view full) --- 428 ASSERT_EQ(mm.map_count, 4); 429 430 /* 431 * Merge BOTH sides. 432 * 433 * 0123456789abc 434 * AA*B DD CC 435 */ |
436 vma_a->vm_ops = &vm_ops; /* This should have no impact. */ |
|
433 vma_b->anon_vma = &dummy_anon_vma; 434 vma = try_merge_new_vma(&mm, &vmg, 0x2000, 0x3000, 2, flags, &merged); 435 ASSERT_EQ(vma, vma_a); 436 /* Merge with A, delete B. */ 437 ASSERT_TRUE(merged); 438 ASSERT_EQ(vma->vm_start, 0); 439 ASSERT_EQ(vma->vm_end, 0x4000); 440 ASSERT_EQ(vma->vm_pgoff, 0); --- 20 unchanged lines hidden (view full) --- 461 462 /* 463 * Merge to NEXT VMA. 464 * 465 * 0123456789abc 466 * AAAAA *DD CC 467 */ 468 vma_d->anon_vma = &dummy_anon_vma; | 437 vma_b->anon_vma = &dummy_anon_vma; 438 vma = try_merge_new_vma(&mm, &vmg, 0x2000, 0x3000, 2, flags, &merged); 439 ASSERT_EQ(vma, vma_a); 440 /* Merge with A, delete B. */ 441 ASSERT_TRUE(merged); 442 ASSERT_EQ(vma->vm_start, 0); 443 ASSERT_EQ(vma->vm_end, 0x4000); 444 ASSERT_EQ(vma->vm_pgoff, 0); --- 20 unchanged lines hidden (view full) --- 465 466 /* 467 * Merge to NEXT VMA. 468 * 469 * 0123456789abc 470 * AAAAA *DD CC 471 */ 472 vma_d->anon_vma = &dummy_anon_vma; |
473 vma_d->vm_ops = &vm_ops; /* This should have no impact. */ |
|
469 vma = try_merge_new_vma(&mm, &vmg, 0x6000, 0x7000, 6, flags, &merged); 470 ASSERT_EQ(vma, vma_d); 471 /* Prepend. */ 472 ASSERT_TRUE(merged); 473 ASSERT_EQ(vma->vm_start, 0x6000); 474 ASSERT_EQ(vma->vm_end, 0x9000); 475 ASSERT_EQ(vma->vm_pgoff, 6); 476 ASSERT_EQ(vma->anon_vma, &dummy_anon_vma); 477 ASSERT_TRUE(vma_write_started(vma)); 478 ASSERT_EQ(mm.map_count, 3); 479 480 /* 481 * Merge BOTH sides. 482 * 483 * 0123456789abc 484 * AAAAA*DDD CC 485 */ | 474 vma = try_merge_new_vma(&mm, &vmg, 0x6000, 0x7000, 6, flags, &merged); 475 ASSERT_EQ(vma, vma_d); 476 /* Prepend. */ 477 ASSERT_TRUE(merged); 478 ASSERT_EQ(vma->vm_start, 0x6000); 479 ASSERT_EQ(vma->vm_end, 0x9000); 480 ASSERT_EQ(vma->vm_pgoff, 6); 481 ASSERT_EQ(vma->anon_vma, &dummy_anon_vma); 482 ASSERT_TRUE(vma_write_started(vma)); 483 ASSERT_EQ(mm.map_count, 3); 484 485 /* 486 * Merge BOTH sides. 487 * 488 * 0123456789abc 489 * AAAAA*DDD CC 490 */ |
491 vma_d->vm_ops = NULL; /* This would otherwise degrade the merge. */ |
|
486 vma = try_merge_new_vma(&mm, &vmg, 0x5000, 0x6000, 5, flags, &merged); 487 ASSERT_EQ(vma, vma_a); 488 /* Merge with A, delete D. */ 489 ASSERT_TRUE(merged); 490 ASSERT_EQ(vma->vm_start, 0); 491 ASSERT_EQ(vma->vm_end, 0x9000); 492 ASSERT_EQ(vma->vm_pgoff, 0); 493 ASSERT_EQ(vma->anon_vma, &dummy_anon_vma); --- 141 unchanged lines hidden (view full) --- 635 VMA_ITERATOR(vmi, &mm, 0); 636 struct vma_merge_struct vmg = { 637 .mm = &mm, 638 .vmi = &vmi, 639 }; 640 const struct vm_operations_struct vm_ops = { 641 .close = dummy_close, 642 }; | 492 vma = try_merge_new_vma(&mm, &vmg, 0x5000, 0x6000, 5, flags, &merged); 493 ASSERT_EQ(vma, vma_a); 494 /* Merge with A, delete D. */ 495 ASSERT_TRUE(merged); 496 ASSERT_EQ(vma->vm_start, 0); 497 ASSERT_EQ(vma->vm_end, 0x9000); 498 ASSERT_EQ(vma->vm_pgoff, 0); 499 ASSERT_EQ(vma->anon_vma, &dummy_anon_vma); --- 141 unchanged lines hidden (view full) --- 641 VMA_ITERATOR(vmi, &mm, 0); 642 struct vma_merge_struct vmg = { 643 .mm = &mm, 644 .vmi = &vmi, 645 }; 646 const struct vm_operations_struct vm_ops = { 647 .close = dummy_close, 648 }; |
643 struct vm_area_struct *vma_next = 644 alloc_and_link_vma(&mm, 0x2000, 0x3000, 2, flags); 645 struct vm_area_struct *vma; | 649 struct vm_area_struct *vma_prev, *vma_next, *vma; |
646 647 /* | 650 651 /* |
648 * When we merge VMAs we sometimes have to delete others as part of the 649 * operation. | 652 * When merging VMAs we are not permitted to remove any VMA that has a 653 * vm_ops->close() hook. |
650 * 651 * Considering the two possible adjacent VMAs to which a VMA can be 652 * merged: 653 * 654 * [ prev ][ vma ][ next ] 655 * 656 * In no case will we need to delete prev. If the operation is 657 * mergeable, then prev will be extended with one or both of vma and --- 34 unchanged lines hidden (view full) --- 692 * - !NULL NULL 693 * [ prev ][ vma ][ next ] 694 * 695 * Cannot occur, because vma->vm_ops being the same implies the same 696 * vma->vm_file, and therefore this would mean that next->vm_ops->close 697 * would be set too, and thus scenario A would pick this up. 698 */ 699 | 654 * 655 * Considering the two possible adjacent VMAs to which a VMA can be 656 * merged: 657 * 658 * [ prev ][ vma ][ next ] 659 * 660 * In no case will we need to delete prev. If the operation is 661 * mergeable, then prev will be extended with one or both of vma and --- 34 unchanged lines hidden (view full) --- 696 * - !NULL NULL 697 * [ prev ][ vma ][ next ] 698 * 699 * Cannot occur, because vma->vm_ops being the same implies the same 700 * vma->vm_file, and therefore this would mean that next->vm_ops->close 701 * would be set too, and thus scenario A would pick this up. 702 */ 703 |
700 ASSERT_NE(vma_next, NULL); 701 | |
702 /* | 704 /* |
703 * SCENARIO A | 705 * The only case of a new VMA merge that results in a VMA being deleted 706 * is one where both the previous and next VMAs are merged - in this 707 * instance the next VMA is deleted, and the previous VMA is extended. |
704 * | 708 * |
705 * 0123 706 * *N | 709 * If we are unable to do so, we reduce the operation to simply 710 * extending the prev VMA and not merging next. 711 * 712 * 0123456789 713 * PPP**NNNN 714 * -> 715 * 0123456789 716 * PPPPPPNNN |
707 */ 708 | 717 */ 718 |
709 /* Make the next VMA have a close() callback. */ | 719 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); 720 vma_next = alloc_and_link_vma(&mm, 0x5000, 0x9000, 5, flags); |
710 vma_next->vm_ops = &vm_ops; 711 | 721 vma_next->vm_ops = &vm_ops; 722 |
712 /* Our proposed VMA has characteristics that would otherwise be merged. */ 713 vmg_set_range(&vmg, 0x1000, 0x2000, 1, flags); | 723 vmg_set_range(&vmg, 0x3000, 0x5000, 3, flags); 724 ASSERT_EQ(merge_new(&vmg), vma_prev); 725 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 726 ASSERT_EQ(vma_prev->vm_start, 0); 727 ASSERT_EQ(vma_prev->vm_end, 0x5000); 728 ASSERT_EQ(vma_prev->vm_pgoff, 0); |
714 | 729 |
715 /* The next VMA having a close() operator should cause the merge to fail.*/ 716 ASSERT_EQ(merge_new(&vmg), NULL); 717 ASSERT_EQ(vmg.state, VMA_MERGE_NOMERGE); | 730 ASSERT_EQ(cleanup_mm(&mm, &vmi), 2); |
718 | 731 |
719 /* Now create the VMA so we can merge via modified flags */ 720 vmg_set_range(&vmg, 0x1000, 0x2000, 1, flags); 721 vma = alloc_and_link_vma(&mm, 0x1000, 0x2000, 1, flags); | 732 /* 733 * When modifying an existing VMA there are further cases where we 734 * delete VMAs. 735 * 736 * <> 737 * 0123456789 738 * PPPVV 739 * 740 * In this instance, if vma has a close hook, the merge simply cannot 741 * proceed. 742 */ 743 744 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); 745 vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, flags); 746 vma->vm_ops = &vm_ops; 747 748 vmg_set_range(&vmg, 0x3000, 0x5000, 3, flags); 749 vmg.prev = vma_prev; |
722 vmg.vma = vma; 723 724 /* 725 * The VMA being modified in a way that would otherwise merge should 726 * also fail. 727 */ 728 ASSERT_EQ(merge_existing(&vmg), NULL); 729 ASSERT_EQ(vmg.state, VMA_MERGE_NOMERGE); 730 | 750 vmg.vma = vma; 751 752 /* 753 * The VMA being modified in a way that would otherwise merge should 754 * also fail. 755 */ 756 ASSERT_EQ(merge_existing(&vmg), NULL); 757 ASSERT_EQ(vmg.state, VMA_MERGE_NOMERGE); 758 |
731 /* SCENARIO B | 759 ASSERT_EQ(cleanup_mm(&mm, &vmi), 2); 760 761 /* 762 * This case is mirrored if merging with next. |
732 * | 763 * |
733 * 0123 734 * P* | 764 * <> 765 * 0123456789 766 * VVNNNN |
735 * | 767 * |
736 * In order for this scenario to trigger, the VMA currently being 737 * modified must also have a .close(). | 768 * In this instance, if vma has a close hook, the merge simply cannot 769 * proceed. |
738 */ 739 | 770 */ 771 |
740 /* Reset VMG state. */ 741 vmg_set_range(&vmg, 0x1000, 0x2000, 1, flags); 742 /* 743 * Make next unmergeable, and don't let the scenario A check pick this 744 * up, we want to reproduce scenario B only. 745 */ 746 vma_next->vm_ops = NULL; 747 vma_next->__vm_flags &= ~VM_MAYWRITE; 748 /* Allocate prev. */ 749 vmg.prev = alloc_and_link_vma(&mm, 0, 0x1000, 0, flags); 750 /* Assign a vm_ops->close() function to VMA explicitly. */ | 772 vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, flags); 773 vma_next = alloc_and_link_vma(&mm, 0x5000, 0x9000, 5, flags); |
751 vma->vm_ops = &vm_ops; | 774 vma->vm_ops = &vm_ops; |
775 776 vmg_set_range(&vmg, 0x3000, 0x5000, 3, flags); |
|
752 vmg.vma = vma; | 777 vmg.vma = vma; |
753 /* Make sure merge does not occur. */ | |
754 ASSERT_EQ(merge_existing(&vmg), NULL); 755 /* 756 * Initially this is misapprehended as an out of memory report, as the 757 * close() check is handled in the same way as anon_vma duplication 758 * failures, however a subsequent patch resolves this. 759 */ | 778 ASSERT_EQ(merge_existing(&vmg), NULL); 779 /* 780 * Initially this is misapprehended as an out of memory report, as the 781 * close() check is handled in the same way as anon_vma duplication 782 * failures, however a subsequent patch resolves this. 783 */ |
760 ASSERT_EQ(vmg.state, VMA_MERGE_ERROR_NOMEM); | 784 ASSERT_EQ(vmg.state, VMA_MERGE_NOMERGE); |
761 | 785 |
762 cleanup_mm(&mm, &vmi); | 786 ASSERT_EQ(cleanup_mm(&mm, &vmi), 2); 787 788 /* 789 * Finally, we consider two variants of the case where we modify a VMA 790 * to merge with both the previous and next VMAs. 791 * 792 * The first variant is where vma has a close hook. In this instance, no 793 * merge can proceed. 794 * 795 * <> 796 * 0123456789 797 * PPPVVNNNN 798 */ 799 800 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); 801 vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, flags); 802 vma_next = alloc_and_link_vma(&mm, 0x5000, 0x9000, 5, flags); 803 vma->vm_ops = &vm_ops; 804 805 vmg_set_range(&vmg, 0x3000, 0x5000, 3, flags); 806 vmg.prev = vma_prev; 807 vmg.vma = vma; 808 809 ASSERT_EQ(merge_existing(&vmg), NULL); 810 ASSERT_EQ(vmg.state, VMA_MERGE_NOMERGE); 811 812 ASSERT_EQ(cleanup_mm(&mm, &vmi), 3); 813 814 /* 815 * The second variant is where next has a close hook. In this instance, 816 * we reduce the operation to a merge between prev and vma. 817 * 818 * <> 819 * 0123456789 820 * PPPVVNNNN 821 * -> 822 * 0123456789 823 * PPPPPNNNN 824 */ 825 826 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); 827 vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, flags); 828 vma_next = alloc_and_link_vma(&mm, 0x5000, 0x9000, 5, flags); 829 vma_next->vm_ops = &vm_ops; 830 831 vmg_set_range(&vmg, 0x3000, 0x5000, 3, flags); 832 vmg.prev = vma_prev; 833 vmg.vma = vma; 834 835 ASSERT_EQ(merge_existing(&vmg), vma_prev); 836 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 837 ASSERT_EQ(vma_prev->vm_start, 0); 838 ASSERT_EQ(vma_prev->vm_end, 0x5000); 839 ASSERT_EQ(vma_prev->vm_pgoff, 0); 840 841 ASSERT_EQ(cleanup_mm(&mm, &vmi), 2); 842 |
763 return true; 764} 765 766static bool test_vma_merge_new_with_close(void) 767{ 768 unsigned long flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; 769 struct mm_struct mm = {}; 770 VMA_ITERATOR(vmi, &mm, 0); --- 52 unchanged lines hidden (view full) --- 823 unsigned long flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; 824 struct mm_struct mm = {}; 825 VMA_ITERATOR(vmi, &mm, 0); 826 struct vm_area_struct *vma, *vma_prev, *vma_next; 827 struct vma_merge_struct vmg = { 828 .mm = &mm, 829 .vmi = &vmi, 830 }; | 843 return true; 844} 845 846static bool test_vma_merge_new_with_close(void) 847{ 848 unsigned long flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; 849 struct mm_struct mm = {}; 850 VMA_ITERATOR(vmi, &mm, 0); --- 52 unchanged lines hidden (view full) --- 903 unsigned long flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; 904 struct mm_struct mm = {}; 905 VMA_ITERATOR(vmi, &mm, 0); 906 struct vm_area_struct *vma, *vma_prev, *vma_next; 907 struct vma_merge_struct vmg = { 908 .mm = &mm, 909 .vmi = &vmi, 910 }; |
911 const struct vm_operations_struct vm_ops = { 912 .close = dummy_close, 913 }; |
|
831 832 /* 833 * Merge right case - partial span. 834 * 835 * <-> 836 * 0123456789 837 * VVVVNNN 838 * -> 839 * 0123456789 840 * VNNNNNN 841 */ 842 vma = alloc_and_link_vma(&mm, 0x2000, 0x6000, 2, flags); | 914 915 /* 916 * Merge right case - partial span. 917 * 918 * <-> 919 * 0123456789 920 * VVVVNNN 921 * -> 922 * 0123456789 923 * VNNNNNN 924 */ 925 vma = alloc_and_link_vma(&mm, 0x2000, 0x6000, 2, flags); |
926 vma->vm_ops = &vm_ops; /* This should have no impact. */ |
|
843 vma_next = alloc_and_link_vma(&mm, 0x6000, 0x9000, 6, flags); | 927 vma_next = alloc_and_link_vma(&mm, 0x6000, 0x9000, 6, flags); |
928 vma_next->vm_ops = &vm_ops; /* This should have no impact. */ |
|
844 vmg_set_range(&vmg, 0x3000, 0x6000, 3, flags); 845 vmg.vma = vma; 846 vmg.prev = vma; 847 vma->anon_vma = &dummy_anon_vma; 848 ASSERT_EQ(merge_existing(&vmg), vma_next); 849 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 850 ASSERT_EQ(vma_next->vm_start, 0x3000); 851 ASSERT_EQ(vma_next->vm_end, 0x9000); --- 16 unchanged lines hidden (view full) --- 868 * 0123456789 869 * VVVVNNN 870 * -> 871 * 0123456789 872 * NNNNNNN 873 */ 874 vma = alloc_and_link_vma(&mm, 0x2000, 0x6000, 2, flags); 875 vma_next = alloc_and_link_vma(&mm, 0x6000, 0x9000, 6, flags); | 929 vmg_set_range(&vmg, 0x3000, 0x6000, 3, flags); 930 vmg.vma = vma; 931 vmg.prev = vma; 932 vma->anon_vma = &dummy_anon_vma; 933 ASSERT_EQ(merge_existing(&vmg), vma_next); 934 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 935 ASSERT_EQ(vma_next->vm_start, 0x3000); 936 ASSERT_EQ(vma_next->vm_end, 0x9000); --- 16 unchanged lines hidden (view full) --- 953 * 0123456789 954 * VVVVNNN 955 * -> 956 * 0123456789 957 * NNNNNNN 958 */ 959 vma = alloc_and_link_vma(&mm, 0x2000, 0x6000, 2, flags); 960 vma_next = alloc_and_link_vma(&mm, 0x6000, 0x9000, 6, flags); |
961 vma_next->vm_ops = &vm_ops; /* This should have no impact. */ |
|
876 vmg_set_range(&vmg, 0x2000, 0x6000, 2, flags); 877 vmg.vma = vma; 878 vma->anon_vma = &dummy_anon_vma; 879 ASSERT_EQ(merge_existing(&vmg), vma_next); 880 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 881 ASSERT_EQ(vma_next->vm_start, 0x2000); 882 ASSERT_EQ(vma_next->vm_end, 0x9000); 883 ASSERT_EQ(vma_next->vm_pgoff, 2); --- 10 unchanged lines hidden (view full) --- 894 * <-> 895 * 0123456789 896 * PPPVVVV 897 * -> 898 * 0123456789 899 * PPPPPPV 900 */ 901 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); | 962 vmg_set_range(&vmg, 0x2000, 0x6000, 2, flags); 963 vmg.vma = vma; 964 vma->anon_vma = &dummy_anon_vma; 965 ASSERT_EQ(merge_existing(&vmg), vma_next); 966 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 967 ASSERT_EQ(vma_next->vm_start, 0x2000); 968 ASSERT_EQ(vma_next->vm_end, 0x9000); 969 ASSERT_EQ(vma_next->vm_pgoff, 2); --- 10 unchanged lines hidden (view full) --- 980 * <-> 981 * 0123456789 982 * PPPVVVV 983 * -> 984 * 0123456789 985 * PPPPPPV 986 */ 987 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); |
988 vma_prev->vm_ops = &vm_ops; /* This should have no impact. */ |
|
902 vma = alloc_and_link_vma(&mm, 0x3000, 0x7000, 3, flags); | 989 vma = alloc_and_link_vma(&mm, 0x3000, 0x7000, 3, flags); |
990 vma->vm_ops = &vm_ops; /* This should have no impact. */ |
|
903 vmg_set_range(&vmg, 0x3000, 0x6000, 3, flags); 904 vmg.prev = vma_prev; 905 vmg.vma = vma; 906 vma->anon_vma = &dummy_anon_vma; 907 908 ASSERT_EQ(merge_existing(&vmg), vma_prev); 909 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 910 ASSERT_EQ(vma_prev->vm_start, 0); --- 16 unchanged lines hidden (view full) --- 927 * <--> 928 * 0123456789 929 * PPPVVVV 930 * -> 931 * 0123456789 932 * PPPPPPP 933 */ 934 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); | 991 vmg_set_range(&vmg, 0x3000, 0x6000, 3, flags); 992 vmg.prev = vma_prev; 993 vmg.vma = vma; 994 vma->anon_vma = &dummy_anon_vma; 995 996 ASSERT_EQ(merge_existing(&vmg), vma_prev); 997 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 998 ASSERT_EQ(vma_prev->vm_start, 0); --- 16 unchanged lines hidden (view full) --- 1015 * <--> 1016 * 0123456789 1017 * PPPVVVV 1018 * -> 1019 * 0123456789 1020 * PPPPPPP 1021 */ 1022 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); |
1023 vma_prev->vm_ops = &vm_ops; /* This should have no impact. */ |
|
935 vma = alloc_and_link_vma(&mm, 0x3000, 0x7000, 3, flags); 936 vmg_set_range(&vmg, 0x3000, 0x7000, 3, flags); 937 vmg.prev = vma_prev; 938 vmg.vma = vma; 939 vma->anon_vma = &dummy_anon_vma; 940 ASSERT_EQ(merge_existing(&vmg), vma_prev); 941 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 942 ASSERT_EQ(vma_prev->vm_start, 0); --- 12 unchanged lines hidden (view full) --- 955 * <--> 956 * 0123456789 957 * PPPVVVVNNN 958 * -> 959 * 0123456789 960 * PPPPPPPPPP 961 */ 962 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); | 1024 vma = alloc_and_link_vma(&mm, 0x3000, 0x7000, 3, flags); 1025 vmg_set_range(&vmg, 0x3000, 0x7000, 3, flags); 1026 vmg.prev = vma_prev; 1027 vmg.vma = vma; 1028 vma->anon_vma = &dummy_anon_vma; 1029 ASSERT_EQ(merge_existing(&vmg), vma_prev); 1030 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); 1031 ASSERT_EQ(vma_prev->vm_start, 0); --- 12 unchanged lines hidden (view full) --- 1044 * <--> 1045 * 0123456789 1046 * PPPVVVVNNN 1047 * -> 1048 * 0123456789 1049 * PPPPPPPPPP 1050 */ 1051 vma_prev = alloc_and_link_vma(&mm, 0, 0x3000, 0, flags); |
1052 vma_prev->vm_ops = &vm_ops; /* This should have no impact. */ |
|
963 vma = alloc_and_link_vma(&mm, 0x3000, 0x7000, 3, flags); 964 vma_next = alloc_and_link_vma(&mm, 0x7000, 0x9000, 7, flags); 965 vmg_set_range(&vmg, 0x3000, 0x7000, 3, flags); 966 vmg.prev = vma_prev; 967 vmg.vma = vma; 968 vma->anon_vma = &dummy_anon_vma; 969 ASSERT_EQ(merge_existing(&vmg), vma_prev); 970 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); --- 503 unchanged lines hidden --- | 1053 vma = alloc_and_link_vma(&mm, 0x3000, 0x7000, 3, flags); 1054 vma_next = alloc_and_link_vma(&mm, 0x7000, 0x9000, 7, flags); 1055 vmg_set_range(&vmg, 0x3000, 0x7000, 3, flags); 1056 vmg.prev = vma_prev; 1057 vmg.vma = vma; 1058 vma->anon_vma = &dummy_anon_vma; 1059 ASSERT_EQ(merge_existing(&vmg), vma_prev); 1060 ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); --- 503 unchanged lines hidden --- |