<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in usercopy.c</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>0cd11518 - csky: use generic strncpy/strnlen from_user</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#0cd11518</link>
        <description>csky: use generic strncpy/strnlen from_userRemove the csky implemenation of strncpy/strnlen and instead use thegeneric versions.  The csky version is fairly slow because it always doesbyte accesses even for aligned data, and it lacks a checks foruser_addr_max().Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Thu, 16 Jan 2020 14:58:41 +0000</pubDate>
        <dc:creator>Arnd Bergmann &lt;arnd@arndb.de&gt;</dc:creator>
    </item>
<item>
        <title>f27180dd - asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#f27180dd</link>
        <description>asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_userThis is a preparation for changing over architectures to thegeneric implementation one at a time. As there are no callersof either __strncpy_from_user() or __strnlen_user(), fold theseinto the strncpy_from_user() and strnlen_user() functions to makeeach implementation independent of the others.Many of these implementations have known bugs, but the intentionhere is to not change behavior at all and stay compatible withthose bugs for the moment.Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Thu, 16 Jan 2020 12:18:38 +0000</pubDate>
        <dc:creator>Arnd Bergmann &lt;arnd@arndb.de&gt;</dc:creator>
    </item>
<item>
        <title>e58a41c2 - csky: uaccess.h: Coding convention with asm generic</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#e58a41c2</link>
        <description>csky: uaccess.h: Coding convention with asm genericUsing asm-generic/uaccess.h to prevent duplicated code: - Add user_addr_max which mentioned in generic uaccess.h - Remove custom definitions of KERNEL/USER_DS, get/set_fs,   uaccess_kerenl - Using generic extable.h instead of custom definitions in   uaccess.hChange v2: - Fixup tinyconfig compile error, &quot;__put_user_bad&quot; - Add __get_user_asm_64Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;Link: https://lore.kernel.org/linux-csky/CAK8P3a1DvsXSEDoovLk11hzNHyJi7vqNoToU+n5aFi2viZO_Uw@mail.gmail.com/T/#mbcd58a0e3450e5598974116b607589afa16a3ab7Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Wed, 21 Apr 2021 08:03:28 +0000</pubDate>
        <dc:creator>Guo Ren &lt;guoren@linux.alibaba.com&gt;</dc:creator>
    </item>
<item>
        <title>a0d8d552 - whack-a-mole: kill strlen_user() (again)</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#a0d8d552</link>
        <description>whack-a-mole: kill strlen_user() (again)Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Sat, 27 Mar 2021 23:36:31 +0000</pubDate>
        <dc:creator>Al Viro &lt;viro@zeniv.linux.org.uk&gt;</dc:creator>
    </item>
<item>
        <title>51bb38cb - csky: Fixup raw_copy_from_user()</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#51bb38cb</link>
        <description>csky: Fixup raw_copy_from_user()If raw_copy_from_user(to, from, N) returns K, callers expectthe first N - K bytes starting at to to have been replaced withthe contents of corresponding area starting at from and the lastK bytes of destination *left* *unmodified*.What arch/sky/lib/usercopy.c is doing is broken - it can lead to e.g.data corruption on write(2).raw_copy_to_user() is inaccurate about return value, which is a bug,but consequences are less drastic than for raw_copy_from_user().And just what are those access_ok() doing in there?  I mean, look intolinux/uaccess.h; that&apos;s where we do that check (as well as zero tailon failure in the callers that need zeroing).AFAICS, all of that shouldn&apos;t be hard to fix; something like a patchbelow might make a useful starting point.I would suggest moving these macros into usercopy.c (they are neverused anywhere else) and possibly expanding them there; if you leavethem alive, please at least rename __copy_user_zeroing(). Again,it must not zero anything on failed read.Said that, I&apos;m not sure we won&apos;t be better off simply turningusercopy.c into usercopy.S - all that is left there is a couple offunctions, each consisting only of inline asm.Guo Ren reply:Yes, raw_copy_from_user is wrong, it&apos;s no need zeroing code.unsigned long _copy_from_user(void *to, const void __user *from,unsigned long n){        unsigned long res = n;        might_fault();        if (likely(access_ok(from, n))) {                kasan_check_write(to, n);                res = raw_copy_from_user(to, from, n);        }        if (unlikely(res))                memset(to + (n - res), 0, res);        return res;}EXPORT_SYMBOL(_copy_from_user);You are right and access_ok() should be removed.but, how about:do {...        &quot;2:     stw     %3, (%1, 0)     \n&quot;             \+       &quot;       subi    %0, 4          \n&quot;               \        &quot;9:     stw     %4, (%1, 4)     \n&quot;             \+       &quot;       subi    %0, 4          \n&quot;               \        &quot;10:    stw     %5, (%1, 8)     \n&quot;             \+       &quot;       subi    %0, 4          \n&quot;               \        &quot;11:    stw     %6, (%1, 12)    \n&quot;             \+       &quot;       subi    %0, 4          \n&quot;               \        &quot;       addi    %2, 16          \n&quot;             \        &quot;       addi    %1, 16          \n&quot;             \Don&apos;t expand __ex_tableAI Viro reply:Hey, I&apos;ve no idea about the instruction scheduling on csky -if that doesn&apos;t slow the things down, all the better.  It&apos;s justthat copy_to_user() and friends are on fairly hot codepaths,and in quite a few situations they will dominate the speed ofe.g. read(2).  So I tried to keep the fast path unchanged.Up to the architecture maintainers, obviously.  Which would beyou...As for the fixups size increase (__ex_table size is unchanged)...You have each of those macros expanded exactly once.So the size is not a serious argument, IMO - useless complexitywould be, if it is, in fact, useless; the size... not really,especially since those extra subi will at least offset it.Again, up to you - asm optimizations of (essentially)memcpy()-style loops are tricky and can depend upon thefairly subtle details of architecture.  So even on somethingI know reasonably well I would resort to direct experimentsif I can&apos;t pass the buck to architecture maintainers.It *is* worth optimizing - this is where read() from a filethat is already in page cache spends most of the time, etc.Guo Ren reply:Thx, after fixup some typo &#8220;sub %0, 4&#8221;, apply the patch.TODO: - user copy/from codes are still need optimizing.Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Tue, 07 Apr 2020 01:40:11 +0000</pubDate>
        <dc:creator>Al Viro &lt;viro@zeniv.linux.org.uk&gt;</dc:creator>
    </item>
<item>
        <title>96d4f267 - Remove &apos;type&apos; argument from access_ok() function</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#96d4f267</link>
        <description>Remove &apos;type&apos; argument from access_ok() functionNobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argumentof the user address range verification function since we got rid of theold racy i386-only code to walk page tables by hand.It existed because the original 80386 would not honor the write protectbit when in kernel mode, so you had to do COW by hand before doing anyuser access.  But we haven&apos;t supported that in a long time, and thesedays the &apos;type&apos; argument is a purely historical artifact.A discussion about extending &apos;user_access_begin()&apos; to do the rangechecking resulted this patch, because there is no way we&apos;re going tomove the old VERIFY_xyz interface to that model.  And it&apos;s best done atthe end of the merge window when I&apos;ve done most of my merges, so let&apos;sjust get this done once and for all.This patch was mostly done with a sed-script, with manual fix-ups forthe cases that weren&apos;t of the trivial &apos;access_ok(VERIFY_xyz&apos; form.There were a couple of notable cases: - csky still had the old &quot;verify_area()&quot; name as an alias. - the iter_iov code had magical hardcoded knowledge of the actual   values of VERIFY_{READ,WRITE} (not that they mattered, since nothing   really used it) - microblaze used the type argument for a debug printoutbut other than those oddities this should be a total no-op patch.I tried to fix up all architectures, did fairly extensive grepping foraccess_ok() uses, and the changes are trivial, but I may have missedsomething.  Any missed conversion should be trivially fixable, though.Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Fri, 04 Jan 2019 02:57:57 +0000</pubDate>
        <dc:creator>Linus Torvalds &lt;torvalds@linux-foundation.org&gt;</dc:creator>
    </item>
<item>
        <title>da551281 - csky: User access</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/arch/csky/lib/usercopy.c#da551281</link>
        <description>csky: User accessThe patch adds &quot;user access from kernel&quot; codes.Signed-off-by: Guo Ren &lt;ren_guo@c-sky.com&gt;Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;

            List of files:
            /linux-6.15/arch/csky/lib/usercopy.c</description>
        <pubDate>Wed, 05 Sep 2018 06:25:18 +0000</pubDate>
        <dc:creator>Guo Ren &lt;ren_guo@c-sky.com&gt;</dc:creator>
    </item>
</channel>
</rss>
