Skip to contentSkip to conversation

ipipe-2.6.38-x86

GIT PULL New Jan Kiszka 2 participants 5 messages Dec 7, 2012 – Dec 12, 2012

Subsystems (4)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

The following changes since commit ac565906d56ced004f39bc38a751466b2b5242ae:

ipipe-2.6.38.8-x86-2.11-02 (2012-03-17 11:09:18 +0100)

are available in the git repository at:
git://git.kiszka.org/ipipe queues/2.6.38-x86

Jan Kiszka (3):
ipipe: Factor out ipipe_pin_vma
ipipe: Pin potential COW pages before applying mprotect changes
ipipe: Clear IRQ_MASKED from irq descriptor on setup

 include/linux/ipipe.h |    1 +
 kernel/irq/chip.c     |    2 +-
 kernel/irq/manage.c   |    2 +-
 mm/memory.c           |   43 +++++++++++++++++++++++++------------------
 mm/mprotect.c         |   18 ++++++++++++++++++
 5 files changed, 46 insertions(+), 20 deletions(-)

Jan Kiszka (3):
ipipe: Factor out ipipe_pin_vma
ipipe: Pin potential COW pages before applying mprotect changes
ipipe: Clear IRQ_MASKED from irq descriptor on setup

 include/linux/ipipe.h |    1 +
 kernel/irq/chip.c     |    2 +-
 kernel/irq/manage.c   |    2 +-
 mm/memory.c           |   43 +++++++++++++++++++++++++------------------
 mm/mprotect.c         |   18 ++++++++++++++++++
 5 files changed, 46 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.3.4
author
#1 lore raw

PATCH 1/3 ipipe: Factor out ipipe_pin_vma

Will be used for pinning during mprotect as well.

---
 include/linux/ipipe.h |    1 +
 mm/memory.c           |   43 +++++++++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 18 deletions(-)
include/linux/ipipe.h +1 -0
index fb0789e..48f93bd 100644
@@ -647,6 +647,7 @@ int ipipe_set_ptd(int key,
 void *ipipe_get_ptd(int key);
 
 int ipipe_disable_ondemand_mappings(struct task_struct *tsk);
+int ipipe_pin_vma(struct mm_struct *mm, struct vm_area_struct *vma);
 
 static inline void ipipe_nmi_enter(void)
 {
mm/memory.c +25 -18

61 lines not on this page · raw message

Signature · 1 line
1.7.3.4
author
#2 lore raw

PATCH 2/3 ipipe: Pin potential COW pages before applying mprotect changes

In reply to Jan Kiszka

mprotect may make a region writable that wasn't so far. But non-writable regions are not subject to COW resolution done via ipipe_disable_ondemand_mappings. Thus, enabling write may make pages writable that are not supposed to (e.g. the zero page) as we enforce write access for writable regions to avoid minor faults.

---
 mm/mprotect.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
mm/mprotect.c +18 -0
index 3f234b3..af5da94 100644
@@ -224,6 +224,24 @@ success:
 	}
 
 	mmu_notifier_invalidate_range_start(mm, start, end);
+#ifdef CONFIG_IPIPE
+	/*
+	 * Privatize potential COW pages
+	 */
+	if (test_bit(MMF_VM_PINNED, &mm->flags) &&
+	    (((vma->vm_flags | mm->def_flags) & (VM_LOCKED | VM_WRITE)) ==
+	     (VM_LOCKED | VM_WRITE))) {
+		error = ipipe_pin_vma(mm, vma);
+		if (error)
+			/*
+			 * OOM. Just revert the fake VM_SHARED so that the
+			 * zero page cannot be overwritten.
+			 */
+			vma->vm_page_prot =
+				pgprot_modify(vma->vm_page_prot,
+					      vm_get_page_prot(newflags));
+	}
+#endif
 	if (is_vm_hugetlb_page(vma))
 		hugetlb_change_protection(vma, start, end, vma->vm_page_prot);
 	else
Signature · 1 line
1.7.3.4
author
#3 lore raw

PATCH 3/3 ipipe: Clear IRQ_MASKED from irq descriptor on setup

In reply to Jan Kiszka

This bit is set my the kernel on __free_irq. That's unproblematic in the absence of ipipe, but when it is enabled, handle_fasteoi_irq will fail to reenable the line on exit due to this spurious state. Only required on 2.6 kernels, later versions properly clear the MASKED state themselves.

---
 kernel/irq/chip.c   |    2 +-
 kernel/irq/manage.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/irq/chip.c +1 -1
index b79ec1d..aeb8cc1 100644
@@ -878,7 +878,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
 	desc->name = name;
 
 	if (handle != handle_bad_irq && is_chained) {
-		desc->status &= ~IRQ_DISABLED;
+		desc->status &= ~(IRQ_DISABLED | IRQ_MASKED);
 		desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
 		desc->depth = 0;
 		desc->irq_data.chip->irq_startup(&desc->irq_data);
kernel/irq/manage.c +1 -1
index 9033c1c..57fdf57 100644
@@ -785,7 +785,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 
 		if (!(desc->status & IRQ_NOAUTOEN)) {
 			desc->depth = 0;
-			desc->status &= ~IRQ_DISABLED;
+			desc->status &= ~(IRQ_DISABLED | IRQ_MASKED);
 			desc->irq_data.chip->irq_startup(&desc->irq_data);
 		} else
 			/* Undo nested disables: */
Signature · 1 line
1.7.3.4
#4 lore raw
In reply to Jan Kiszka
Quoted 24 lines · Jan Kiszka

The following changes since commit ac565906d56ced004f39bc38a751466b2b5242ae:

   ipipe-2.6.38.8-x86-2.11-02 (2012-03-17 11:09:18 +0100)

are available in the git repository at:

   git://git.kiszka.org/ipipe queues/2.6.38-x86

Jan Kiszka (3):
ipipe: Factor out ipipe_pin_vma
ipipe: Pin potential COW pages before applying mprotect changes
ipipe: Clear IRQ_MASKED from irq descriptor on setup

  include/linux/ipipe.h |    1 +
  kernel/irq/chip.c     |    2 +-
  kernel/irq/manage.c   |    2 +-
  mm/memory.c           |   43 +++++++++++++++++++++++++------------------
  mm/mprotect.c         |   18 ++++++++++++++++++
  5 files changed, 46 insertions(+), 20 deletions(-)

Jan Kiszka (3):
ipipe: Factor out ipipe_pin_vma
ipipe: Pin potential COW pages before applying mprotect changes
ipipe: Clear IRQ_MASKED from irq descriptor on setup

Quoted 7 lines
  include/linux/ipipe.h |    1 +
  kernel/irq/chip.c     |    2 +-
  kernel/irq/manage.c   |    2 +-
  mm/memory.c           |   43 +++++++++++++++++++++++++------------------
  mm/mprotect.c         |   18 ++++++++++++++++++
  5 files changed, 46 insertions(+), 20 deletions(-)

Merged, thanks.

Signature · 1 line
Philippe.