From: rabin@rab.in (Rabin Vincent)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: fix string functions on !MMU
Date: Mon, 2 Jun 2014 18:53:43 +0200 [thread overview]
Message-ID: <20140602165343.GA20915@debian> (raw)
In-Reply-To: <20140428075149.GB28564@pengutronix.de>
On Mon, Apr 28, 2014 at 09:51:49AM +0200, Uwe Kleine-K?nig wrote:
> On Mon, Apr 21, 2014 at 08:10:08PM +0200, Rabin Vincent wrote:
> > 8c56cc8be5b38e ("ARM: 7449/1: use generic strnlen_user and
> > strncpy_from_user functions") apparently broken those string operations
> > for !MMU. USER_DS == KERNEL_DS on !MMU, so user_addr_max() always
> > restricts the addresses to TASK_SIZE.
> >
> > TASK_SIZE has anyway no meaning on !MMU, so make user_addr_max() not
> > restrict anything.
> >
> > Signed-off-by: Rabin Vincent <rabin@rab.in>
> I tested this on my efm32 machine and it booted just fine. Before I used
> a patch that did:
>
> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> index 02fa2558f662..f25c7f4c5a44 100644
> --- a/arch/arm/include/asm/memory.h
> +++ b/arch/arm/include/asm/memory.h
> @@ -92,9 +92,12 @@
> * It is difficult to define and perhaps will never meet the original meaning
> * of this define that was meant to.
> * Fortunately, there is no reference for this in noMMU mode, for now.
> + *
> + * HACK: copy_from_user must even handle copying from flash. So don't impose a
> + * limit at all. Not sure this is correct ...
> */
> #ifndef TASK_SIZE
> -#define TASK_SIZE (CONFIG_DRAM_SIZE)
> +#define TASK_SIZE (~0UL)
> #endif
The current code for user_addr_max() for !MMU is essentialy:
#define user_addr_max() TASK_SIZE
which is obviously wrong for the KERNEL_DS case, since it should be
~0UL. And user space can access all that the kernel does, so there
should be no restriction for USER_DS either (which is anyway equivalent
to KERNEL_DS). Hence, I think my patch, which removes the usage of
TASK_SIZE in user_addr_max() for !MMU, is correct regardless of what the
correct definition or meaning of TASK_SIZE for !MMU is.
If you make TASK_SIZE to ~0UL (which is probably what it should be on
!MMU), then the result is equivalent to my patch but it is not
semantically correct since you are restricting user_addr_max() to
TASK_SIZE even for the KERNEL_DS.
What do you say?
next prev parent reply other threads:[~2014-06-02 16:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 18:10 [PATCH] ARM: fix string functions on !MMU Rabin Vincent
2014-04-22 9:44 ` Will Deacon
2014-04-24 15:43 ` Rabin Vincent
2014-04-25 9:12 ` Will Deacon
2014-04-25 18:45 ` Rabin Vincent
2014-04-28 19:10 ` Will Deacon
2014-04-28 7:51 ` Uwe Kleine-König
2014-06-02 16:53 ` Rabin Vincent [this message]
2014-06-03 7:51 ` Uwe Kleine-König
2014-06-03 19:47 ` Uwe Kleine-König
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=20140602165343.GA20915@debian \
--to=rabin@rab.in \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.