From: Andrey Panin <pazke@donpac.ru>
To: linux-kernel@vger.kernel.org
Cc: Trivial Patch Monkey <trivial@rustcorp.com.au>
Subject: [PATCH][TRIVIAL] madvise() syscall: don't test arguments holding semaphore
Date: Thu, 8 Jan 2004 16:25:39 +0300 [thread overview]
Message-ID: <20040108132539.GD16362@pazke> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 321 bytes --]
Hi,
madvise() system call checks its arguments holding current->mm->mmap_sem
semaphore. I know that madvise() shouldn't be perfomance critical,
but fix it so obvious :) Patch against 2.6.1-rc
Best regards.
--
Andrey Panin | Linux and UNIX system administrator
pazke@donpac.ru | PGP key: wwwkeys.pgp.net
[-- Attachment #1.2: patch-madvise-2.6.1 --]
[-- Type: text/plain, Size: 804 bytes --]
diff -urN -X /usr/share/dontdiff linux-2.6.0-test3.vanilla/mm/madvise.c linux-2.6.0-test3/mm/madvise.c
--- linux-2.6.0-test3.vanilla/mm/madvise.c 2003-08-09 08:34:02.000000000 +0400
+++ linux-2.6.0-test3/mm/madvise.c 2004-01-01 16:51:58.000000000 +0300
@@ -166,20 +166,20 @@
unsigned long end;
struct vm_area_struct * vma;
int unmapped_error = 0;
- int error = -EINVAL;
-
- down_write(¤t->mm->mmap_sem);
+ int error;
if (start & ~PAGE_MASK)
- goto out;
+ return -EINVAL;
+
len = (len + ~PAGE_MASK) & PAGE_MASK;
end = start + len;
if (end < start)
- goto out;
+ return -EINVAL;
- error = 0;
if (end == start)
- goto out;
+ return 0;
+
+ down_write(¤t->mm->mmap_sem);
/*
* If the interval [start,end) covers some unmapped address
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2004-01-08 13:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040108132539.GD16362@pazke \
--to=pazke@donpac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=trivial@rustcorp.com.au \
/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