From: Andreas Schwab <schwab@suse.de>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] Possible bug in getname32
Date: Fri, 16 Mar 2001 17:20:42 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590693005286@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590693005284@msgid-missing>
"David Engebretsen" <engebret@us.ibm.com> writes:
|> Although I do not work on linux-ia64, I believe we found a bug bringing up
|> PPC64 that also exists in the IA64 code that someone might want to look
|> into.
|>
|> In arch/ia64/ia32/sys_ia32.c, the function getname32 allocates storage via
|> __get_free_page and then returns it via putname (aka kmem_cache_free).
|> This mismatch of storage allocation schemes can cause all kinds of subtle
|> problems as we found in PPC64.
|>
|> Is this a legitimate bug, or are we missing something here?
Yes, I think that this is a bug. Here is a patch:
--- sys_ia32.c 2001/03/16 17:08:13 1.1
+++ sys_ia32.c 2001/03/16 17:15:12
@@ -2762,11 +2762,12 @@
do_getname32(const char *filename, char *page)
{
int retval;
+ unsigned long len = PATH_MAX + 1;
/* 32bit pointer will be always far below TASK_SIZE :)) */
- retval = strncpy_from_user((char *)page, (char *)filename, PAGE_SIZE);
+ retval = strncpy_from_user((char *)page, (char *)filename, len);
if (retval > 0) {
- if (retval < PAGE_SIZE)
+ if (retval < len)
return 0;
return -ENAMETOOLONG;
} else if (!retval)
@@ -2780,7 +2781,7 @@
char *tmp, *result;
result = ERR_PTR(-ENOMEM);
- tmp = (char *)__get_free_page(GFP_KERNEL);
+ tmp = __getname();
if (tmp) {
int retval = do_getname32(filename, tmp);
Andreas.
--
Andreas Schwab "And now for something
SuSE Labs completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
prev parent reply other threads:[~2001-03-16 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-16 16:04 [Linux-ia64] Possible bug in getname32 David Engebretsen
2001-03-16 16:39 ` Don Dugger
2001-03-16 17:20 ` Andreas Schwab [this message]
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=marc-linux-ia64-105590693005286@msgid-missing \
--to=schwab@suse.de \
--cc=linux-ia64@vger.kernel.org \
/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