Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97971
b: refs/heads/master
c: 74b6b52
h: refs/heads/master
i:
  97969: ac569cb
  97967: 37efb38
v: v3
  • Loading branch information
Christian Borntraeger authored and Avi Kivity committed Jun 6, 2008
1 parent aa55d97 commit 4f56cbd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8cee18cc75d7b9dbe6c6526dfae9ab49e84fa95
refs/heads/master: 74b6b522ec83f9c44fc7743f2adcb24664aa8f45
44 changes: 27 additions & 17 deletions trunk/arch/s390/mm/pgtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,36 +254,46 @@ void disable_noexec(struct mm_struct *mm, struct task_struct *tsk)
int s390_enable_sie(void)
{
struct task_struct *tsk = current;
struct mm_struct *mm;
int rc;
struct mm_struct *mm, *old_mm;

task_lock(tsk);

rc = 0;
/* Do we have pgstes? if yes, we are done */
if (tsk->mm->context.pgstes)
goto unlock;
return 0;

rc = -EINVAL;
/* lets check if we are allowed to replace the mm */
task_lock(tsk);
if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
tsk->mm != tsk->active_mm || tsk->mm->ioctx_list)
goto unlock;
tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) {
task_unlock(tsk);
return -EINVAL;
}
task_unlock(tsk);

tsk->mm->context.pgstes = 1; /* dirty little tricks .. */
/* we copy the mm with pgstes enabled */
tsk->mm->context.pgstes = 1;
mm = dup_mm(tsk);
tsk->mm->context.pgstes = 0;

rc = -ENOMEM;
if (!mm)
goto unlock;
mmput(tsk->mm);
return -ENOMEM;

/* Now lets check again if somebody attached ptrace etc */
task_lock(tsk);
if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) {
mmput(mm);
task_unlock(tsk);
return -EINVAL;
}

/* ok, we are alone. No ptrace, no threads, etc. */
old_mm = tsk->mm;
tsk->mm = tsk->active_mm = mm;
preempt_disable();
update_mm(mm, tsk);
cpu_set(smp_processor_id(), mm->cpu_vm_mask);
preempt_enable();
rc = 0;
unlock:
task_unlock(tsk);
return rc;
mmput(old_mm);
return 0;
}
EXPORT_SYMBOL_GPL(s390_enable_sie);

0 comments on commit 4f56cbd

Please sign in to comment.