From: "Oliver Pinter (Pintér Olivér)" <oliver.pntr@gmail.com>
To: "Linux Kernel" <linux-kernel@vger.kernel.org>,
stable@kernel.org, stable-commits@vger.kernel.org,
"Linus Torvalds" <torvalds@linux-foundation.org>
Cc: "chrisw@sous-sol.org" <chrisw@sous-sol.org>,
"Greg KH" <gregkh@suse.de>, "Willy Tarreau" <w@1wt.eu>,
"Adrian Bunk" <bunk@kernel.org>, "Nick Piggin" <npiggin@suse.de>
Subject: [2.6.22.y] {17**/17} - nopage-range-fix.patch (CVE-2008-0007) - series for stable kernel #2
Date: Sat, 2 Feb 2008 02:34:47 +0100 [thread overview]
Message-ID: <6101e8c40802011734k2b4f7c49o980a32fa4a84cd61@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 64 bytes --]
NOT IN MAINLINE
Linus it's go or drop it?
--
Thanks,
Oliver
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nopage-range-fix.patch --]
[-- Type: text/x-diff; name=nopage-range-fix.patch, Size: 4984 bytes --]
From: Nick Piggin <npiggin@suse.de>
Subject: insufficient range checks of certain fault handlers (CVE-2008-0007)
References: 353207
Patch-upstream: not yet
This patch is a security fix for CVE-2008-0007. See bugzilla for details.
---
Index: linux-2.6.22/drivers/char/drm/drm_vm.c
===================================================================
--- linux-2.6.22.orig/drivers/char/drm/drm_vm.c
+++ linux-2.6.22/drivers/char/drm/drm_vm.c
@@ -520,6 +520,7 @@ static int drm_mmap_dma(struct file *fil
vma->vm_ops = &drm_vm_dma_ops;
vma->vm_flags |= VM_RESERVED; /* Don't swap */
+ vma->vm_flags |= VM_DONTEXPAND;
vma->vm_file = filp; /* Needed for drm_vm_open() */
drm_vm_open_locked(vma);
@@ -669,6 +670,7 @@ static int drm_mmap_locked(struct file *
return -EINVAL; /* This should never happen. */
}
vma->vm_flags |= VM_RESERVED; /* Don't swap */
+ vma->vm_flags |= VM_DONTEXPAND;
vma->vm_file = filp; /* Needed for drm_vm_open() */
drm_vm_open_locked(vma);
Index: linux-2.6.22/kernel/relay.c
===================================================================
--- linux-2.6.22.orig/kernel/relay.c
+++ linux-2.6.22/kernel/relay.c
@@ -91,6 +91,7 @@ int relay_mmap_buf(struct rchan_buf *buf
return -EINVAL;
vma->vm_ops = &relay_file_mmap_ops;
+ vma->vm_flags |= VM_DONTEXPAND;
vma->vm_private_data = buf;
buf->chan->cb->buf_mapped(buf, filp);
Index: linux-2.6.22/mm/mmap.c
===================================================================
--- linux-2.6.22.orig/mm/mmap.c
+++ linux-2.6.22/mm/mmap.c
@@ -2157,7 +2157,7 @@ int install_special_mapping(struct mm_st
vma->vm_start = addr;
vma->vm_end = addr + len;
- vma->vm_flags = vm_flags | mm->def_flags;
+ vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND;
vma->vm_page_prot = protection_map[vma->vm_flags & 7];
vma->vm_ops = &special_mapping_vmops;
Index: linux-2.6.22/sound/oss/via82cxxx_audio.c
===================================================================
--- linux-2.6.22.orig/sound/oss/via82cxxx_audio.c
+++ linux-2.6.22/sound/oss/via82cxxx_audio.c
@@ -2104,6 +2104,7 @@ static struct page * via_mm_nopage (stru
{
struct via_info *card = vma->vm_private_data;
struct via_channel *chan = &card->ch_out;
+ unsigned long max_bufs;
struct page *dmapage;
unsigned long pgoff;
int rd, wr;
@@ -2127,14 +2128,11 @@ static struct page * via_mm_nopage (stru
rd = card->ch_in.is_mapped;
wr = card->ch_out.is_mapped;
-#ifndef VIA_NDEBUG
- {
- unsigned long max_bufs = chan->frag_number;
- if (rd && wr) max_bufs *= 2;
- /* via_dsp_mmap() should ensure this */
- assert (pgoff < max_bufs);
- }
-#endif
+ max_bufs = chan->frag_number;
+ if (rd && wr)
+ max_bufs *= 2;
+ if (pgoff >= max_bufs)
+ return NOPAGE_SIGBUS;
/* if full-duplex (read+write) and we have two sets of bufs,
* then the playback buffers come first, sez soundcard.c */
Index: linux-2.6.22/sound/usb/usx2y/usX2Yhwdep.c
===================================================================
--- linux-2.6.22.orig/sound/usb/usx2y/usX2Yhwdep.c
+++ linux-2.6.22/sound/usb/usx2y/usX2Yhwdep.c
@@ -88,7 +88,7 @@ static int snd_us428ctls_mmap(struct snd
us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
}
area->vm_ops = &us428ctls_vm_ops;
- area->vm_flags |= VM_RESERVED;
+ area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
area->vm_private_data = hw->private_data;
return 0;
}
Index: linux-2.6.22/sound/usb/usx2y/usx2yhwdeppcm.c
===================================================================
--- linux-2.6.22.orig/sound/usb/usx2y/usx2yhwdeppcm.c
+++ linux-2.6.22/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -728,7 +728,7 @@ static int snd_usX2Y_hwdep_pcm_mmap(stru
return -ENODEV;
}
area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops;
- area->vm_flags |= VM_RESERVED;
+ area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
area->vm_private_data = hw->private_data;
return 0;
}
Index: linux-2.6.22/drivers/char/mspec.c
===================================================================
--- linux-2.6.22.orig/drivers/char/mspec.c
+++ linux-2.6.22/drivers/char/mspec.c
@@ -265,7 +265,7 @@ mspec_mmap(struct file *file, struct vm_
vdata->refcnt = ATOMIC_INIT(1);
vma->vm_private_data = vdata;
- vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED | VM_PFNMAP);
+ vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED | VM_PFNMAP | VM_DONTEXPAND);
if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED)
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
vma->vm_ops = &mspec_vm_ops;
Index: linux-2.6.22/sound/oss/emu10k1/audio.c
===================================================================
--- linux-2.6.22.orig/sound/oss/emu10k1/audio.c
+++ linux-2.6.22/sound/oss/emu10k1/audio.c
@@ -1111,7 +1111,7 @@ static int emu10k1_audio_mmap(struct fil
if (pgoffset + n_pages > max_pages)
return -EINVAL;
- vma->vm_flags |= VM_RESERVED;
+ vma->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
vma->vm_ops = &emu10k1_mm_ops;
vma->vm_private_data = wave_dev;
return 0;
next reply other threads:[~2008-02-02 1:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-02 1:34 Oliver Pinter (Pintér Olivér) [this message]
2008-02-02 3:40 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6101e8c40802011734k2b4f7c49o980a32fa4a84cd61@mail.gmail.com \
--to=oliver.pntr@gmail.com \
--cc=bunk@kernel.org \
--cc=chrisw@sous-sol.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=stable-commits@vger.kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®