Skip to content

Commit a31e9c4

Browse files
jmberg-intelrichardweinberger
authored andcommitted
Revert "um: support some of ARCH_HAS_SET_MEMORY"
This reverts commit 963285b ("um: support some of ARCH_HAS_SET_MEMORY"), as it turns out that it's not only not working (due to um never using the protection bits in the page tables) but also corrupts the page tables if used on a non-vmalloc page, since um never allocates proper page tables for the 'physmem' in the first place. Fixing all this will take more effort, so for now revert it. Reported-by: Benjamin Berg <[email protected]> Fixes: 963285b ("um: support some of ARCH_HAS_SET_MEMORY") Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 2fcb409 commit a31e9c4

File tree

4 files changed

+0
-59
lines changed

4 files changed

+0
-59
lines changed

arch/um/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ config UML
1515
select HAVE_DEBUG_KMEMLEAK
1616
select HAVE_DEBUG_BUGVERBOSE
1717
select NO_DMA
18-
select ARCH_HAS_SET_MEMORY
1918
select GENERIC_IRQ_SHOW
2019
select GENERIC_CPU_DEVICES
2120
select HAVE_GCC_PLUGINS

arch/um/include/asm/pgtable.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,12 @@ extern unsigned long end_iomem;
5555
#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
5656
#define __PAGE_KERNEL_EXEC \
5757
(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
58-
#define __PAGE_KERNEL_RO \
59-
(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED)
6058
#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
6159
#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)
6260
#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
6361
#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
6462
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
6563
#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
66-
#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
6764

6865
/*
6966
* The i386 can't do page protection for execute, and considers that the same

arch/um/include/asm/set_memory.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

arch/um/kernel/tlb.c

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -608,57 +608,3 @@ void force_flush_all(void)
608608
vma = vma->vm_next;
609609
}
610610
}
611-
612-
struct page_change_data {
613-
unsigned int set_mask, clear_mask;
614-
};
615-
616-
static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
617-
{
618-
struct page_change_data *cdata = data;
619-
pte_t pte = READ_ONCE(*ptep);
620-
621-
pte_clear_bits(pte, cdata->clear_mask);
622-
pte_set_bits(pte, cdata->set_mask);
623-
624-
set_pte(ptep, pte);
625-
return 0;
626-
}
627-
628-
static int change_memory(unsigned long start, unsigned long pages,
629-
unsigned int set_mask, unsigned int clear_mask)
630-
{
631-
unsigned long size = pages * PAGE_SIZE;
632-
struct page_change_data data;
633-
int ret;
634-
635-
data.set_mask = set_mask;
636-
data.clear_mask = clear_mask;
637-
638-
ret = apply_to_page_range(&init_mm, start, size, change_page_range,
639-
&data);
640-
641-
flush_tlb_kernel_range(start, start + size);
642-
643-
return ret;
644-
}
645-
646-
int set_memory_ro(unsigned long addr, int numpages)
647-
{
648-
return change_memory(addr, numpages, 0, _PAGE_RW);
649-
}
650-
651-
int set_memory_rw(unsigned long addr, int numpages)
652-
{
653-
return change_memory(addr, numpages, _PAGE_RW, 0);
654-
}
655-
656-
int set_memory_nx(unsigned long addr, int numpages)
657-
{
658-
return -EOPNOTSUPP;
659-
}
660-
661-
int set_memory_x(unsigned long addr, int numpages)
662-
{
663-
return -EOPNOTSUPP;
664-
}

0 commit comments

Comments
 (0)