From: Michael Schmitz <schmitzmic@gmail.com>
To: Finn Thain <fthain@linux-m68k.org>
Cc: geert@linux-m68k.org, linux-m68k@lists.linux-m68k.org
Subject: Re: [PATCH RFC v2 1/2] m68k: Handle __generic_copy_to_user faults more carefully
Date: Thu, 25 Apr 2024 19:43:20 +1200 [thread overview]
Message-ID: <0c2d9b59-7a91-9660-55fd-6ba1b96302a2@gmail.com> (raw)
In-Reply-To: <e34c716c-8dc9-f74f-1183-03ecfb0b300d@linux-m68k.org>
Hi Finn,
Am 25.04.2024 um 18:47 schrieb Finn Thain:
> On Thu, 25 Apr 2024, Michael Schmitz wrote:
>
>> --- a/arch/m68k/lib/uaccess.c
>> +++ b/arch/m68k/lib/uaccess.c
>> @@ -68,23 +68,25 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from,
>> "3: subq.l #1,%0\n"
>> "4: jne 1b\n"
>> "5: btst #1,%5\n"
>> - " jeq 7f\n"
>> - " move.w (%1)+,%3\n"
>> - "6: "MOVES".w %3,(%2)+\n"
>> - "7: btst #0,%5\n"
>> - "8: jeq 10f\n"
>> - " move.b (%1)+,%3\n"
>> - "9: "MOVES".b %3,(%2)+\n"
>> - "10:\n"
>> + " jeq 8f\n"
>> + "6: move.w (%1)+,%3\n"
>> + "7: "MOVES".w %3,(%2)+\n"
>> + "8: btst #0,%5\n"
>
> I understand why you put the MOVE.W and MOVE.B into the exception table.
>
>> + "9: jeq 13f\n"
>> + "10: move.b (%1)+,%3\n"
>> + "11: "MOVES".b %3,(%2)+\n"
>> + "12: nop\n"
>> + "13:\n"
>> " .section .fixup,\"ax\"\n"
>> " .even\n"
>> "20: lsl.l #2,%0\n"
>> "50: add.l %5,%0\n"
>> - " jra 10b\n"
>> + " jra 13b\n"
>> " .previous\n"
>> "\n"
>> " .section __ex_table,\"a\"\n"
>> " .align 4\n"
>> + " .long 1b,20b\n"
>
> ... but I don't see why you need the MOVE.L in there (?)
It's part of a loop - if there's enough longwords to copy, that
instruction may follow the fault instruction eventually.
> Also, it is odd to see the third JEQ added to the table but not the second.
> Perhaps we don't need either one in there (?)
Faults on 030 appear to happen two instructions after a moves. But I may
be misremembering that...
I'll have to verify that.
Cheers,
Michael
>> " .long 2b,20b\n"
>> " .long 3b,20b\n"
>> " .long 4b,20b\n"
>> @@ -93,6 +95,8 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from,
>> " .long 8b,50b\n"
>> " .long 9b,50b\n"
>> " .long 10b,50b\n"
>> + " .long 11b,50b\n"
>> + " .long 12b,50b\n"
>> " .previous"
>> : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
>> : "0" (n / 4), "d" (n & 3));
next prev parent reply other threads:[~2024-04-25 7:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 2:29 [PATCH RFC v2 0/2] m68k uaccess fault handling fixes Michael Schmitz
2024-04-22 2:29 ` [PATCH RFC v2 1/2] m68k: Handle __generic_copy_to_user faults more carefully Michael Schmitz
2024-04-25 4:16 ` Finn Thain
2024-04-25 5:32 ` Michael Schmitz
2024-04-25 6:32 ` Finn Thain
2024-04-25 7:52 ` Michael Schmitz
2024-04-25 5:45 ` Michael Schmitz
2024-04-25 6:47 ` Finn Thain
2024-04-25 7:43 ` Michael Schmitz [this message]
2024-04-25 8:20 ` Michael Schmitz
2024-04-25 19:15 ` Michael Schmitz
2024-04-26 1:00 ` Finn Thain
2024-04-26 1:22 ` Michael Schmitz
2024-04-26 7:10 ` Michael Schmitz
2024-04-26 7:57 ` Finn Thain
2024-04-26 8:31 ` Michael Schmitz
2024-04-26 7:58 ` Finn Thain
2024-04-27 1:44 ` Finn Thain
2024-04-27 4:41 ` Michael Schmitz
2024-04-22 2:29 ` [PATCH RFC v2 2/2] m68k: improve __constant_copy_to_user_asm() fault handling Michael Schmitz
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=0c2d9b59-7a91-9660-55fd-6ba1b96302a2@gmail.com \
--to=schmitzmic@gmail.com \
--cc=fthain@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=linux-m68k@lists.linux-m68k.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