<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/arch/xtensa/include/asm/uaccess.h, branch linux-rolling-stable</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-02-25T08:36:06Z</updated>
<entry>
<title>uaccess: remove CONFIG_SET_FS</title>
<updated>2022-02-25T08:36:06Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2022-02-11T20:42:45Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=967747bbc084b93b54e66f9047d342232314cd25'/>
<id>urn:sha1:967747bbc084b93b54e66f9047d342232314cd25</id>
<content type='text'>
There are no remaining callers of set_fs(), so CONFIG_SET_FS
can be removed globally, along with the thread_info field and
any references to it.

This turns access_ok() into a cheaper check against TASK_SIZE_MAX.

As CONFIG_SET_FS is now gone, drop all remaining references to
set_fs()/get_fs(), mm_segment_t, user_addr_max() and uaccess_kernel().

Acked-by: Sam Ravnborg &lt;sam@ravnborg.org&gt; # for sparc32 changes
Acked-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Tested-by: Sergey Matyukevich &lt;sergey.matyukevich@synopsys.com&gt; # for arc changes
Acked-by: Stafford Horne &lt;shorne@gmail.com&gt; # [openrisc, asm-generic]
Acked-by: Dinh Nguyen &lt;dinguyen@kernel.org&gt;
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
</content>
</entry>
<entry>
<title>uaccess: generalize access_ok()</title>
<updated>2022-02-25T08:36:05Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2022-02-15T16:55:04Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=12700c17fc286149324f92d6d380bc48e43f253d'/>
<id>urn:sha1:12700c17fc286149324f92d6d380bc48e43f253d</id>
<content type='text'>
There are many different ways that access_ok() is defined across
architectures, but in the end, they all just compare against the
user_addr_max() value or they accept anything.

Provide one definition that works for most architectures, checking
against TASK_SIZE_MAX for user processes or skipping the check inside
of uaccess_kernel() sections.

For architectures without CONFIG_SET_FS(), this should be the fastest
check, as it comes down to a single comparison of a pointer against a
compile-time constant, while the architecture specific versions tend to
do something more complex for historic reasons or get something wrong.

Type checking for __user annotations is handled inconsistently across
architectures, but this is easily simplified as well by using an inline
function that takes a 'const void __user *' argument. A handful of
callers need an extra __user annotation for this.

Some architectures had trick to use 33-bit or 65-bit arithmetic on the
addresses to calculate the overflow, however this simpler version uses
fewer registers, which means it can produce better object code in the
end despite needing a second (statically predicted) branch.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt; [arm64, asm-generic]
Acked-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Acked-by: Stafford Horne &lt;shorne@gmail.com&gt;
Acked-by: Dinh Nguyen &lt;dinguyen@kernel.org&gt;
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
</content>
</entry>
<entry>
<title>asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols</title>
<updated>2021-07-30T08:30:21Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2021-05-17T07:22:34Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e6226997ec5ac272fa76274c3675bd5b7b437c53'/>
<id>urn:sha1:e6226997ec5ac272fa76274c3675bd5b7b437c53</id>
<content type='text'>
Most architectures do not need a custom implementation, and in most
cases the generic implementation is preferred, so change the polariy
on these Kconfig symbols to require architectures to select them when
they provide their own version.

The new name is CONFIG_ARCH_HAS_{STRNCPY_FROM,STRNLEN}_USER.

The remaining architectures at the moment are: ia64, mips, parisc,
um and xtensa. We should probably convert these as well, but
I was not sure how far to take this series. Thomas Bogendoerfer
had some concerns about converting mips but may still do some
more detailed measurements to see which version is better.

Cc: "James E.J. Bottomley" &lt;James.Bottomley@HansenPartnership.com&gt;
Cc: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Cc: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Cc: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Cc: Helge Deller &lt;deller@gmx.de&gt;
Cc: Jeff Dike &lt;jdike@addtoit.com&gt;
Cc: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
Cc: Richard Weinberger &lt;richard@nod.at&gt;
Cc: Thomas Bogendoerfer &lt;tsbogend@alpha.franken.de&gt;
Cc: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Cc: linux-ia64@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linux-um@lists.infradead.org
Cc: linux-xtensa@linux-xtensa.org
Acked-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Acked-by: Helge Deller &lt;deller@gmx.de&gt; # parisc
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
</content>
</entry>
<entry>
<title>xtensa: uaccess: Add missing __user to strncpy_from_user() prototype</title>
<updated>2020-11-17T13:09:28Z</updated>
<author>
<name>Laurent Pinchart</name>
<email>laurent.pinchart@ideasonboard.com</email>
</author>
<published>2020-08-31T21:09:37Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=dc293f2106903ab9c24e9cea18c276e32c394c33'/>
<id>urn:sha1:dc293f2106903ab9c24e9cea18c276e32c394c33</id>
<content type='text'>
When adding __user annotations in commit 2adf5352a34a, the
strncpy_from_user() function declaration for the
CONFIG_GENERIC_STRNCPY_FROM_USER case was missed. Fix it.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Message-Id: &lt;20200831210937.17938-1-laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>uaccess: remove segment_eq</title>
<updated>2020-08-12T17:57:58Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-08-12T01:33:44Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=428e2976a5bf7e7f5554286d7a5a33b8147b106a'/>
<id>urn:sha1:428e2976a5bf7e7f5554286d7a5a33b8147b106a</id>
<content type='text'>
segment_eq is only used to implement uaccess_kernel.  Just open code
uaccess_kernel in the arch uaccess headers and remove one layer of
indirection.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Acked-by: Greentime Hu &lt;green.hu@gmail.com&gt;
Acked-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Cc: Nick Hu &lt;nickhu@andestech.com&gt;
Cc: Vincent Chen &lt;deanbo422@gmail.com&gt;
Cc: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;
Cc: Palmer Dabbelt &lt;palmer@dabbelt.com&gt;
Link: http://lkml.kernel.org/r/20200710135706.537715-5-hch@lst.de
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>xtensa: add missing __user annotations to asm/uaccess.h</title>
<updated>2020-05-22T23:09:00Z</updated>
<author>
<name>Max Filippov</name>
<email>jcmvbkbc@gmail.com</email>
</author>
<published>2020-05-22T18:40:20Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2adf5352a34ac65a776d709607939bc82cf9819e'/>
<id>urn:sha1:2adf5352a34ac65a776d709607939bc82cf9819e</id>
<content type='text'>
clear_user, strncpy_user, strnlen_user and their helpers operate on user
pointers, but don't have their arguments marked as __user.
Add __user annotation to userspace pointers of those functions.
Fix open-coded access check in the strnlen_user while at it.

Signed-off-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>xtensa: fix error paths in __get_user_{check,size}</title>
<updated>2020-05-22T23:09:00Z</updated>
<author>
<name>Max Filippov</name>
<email>jcmvbkbc@gmail.com</email>
</author>
<published>2020-05-22T22:52:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9afcc71b4f85ee9c9604c9b8349bac0eed44aa63'/>
<id>urn:sha1:9afcc71b4f85ee9c9604c9b8349bac0eed44aa63</id>
<content type='text'>
Error paths in __get_user_check and __get_user_size directly assing 0 to
the result. It causes the following sparse warnings:

  sparse: warning: Using plain integer as NULL pointer

Convert 0 to the type pointed to by the user pointer before assigning it.

Signed-off-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>xtensa: fix type conversion in __get_user_size</title>
<updated>2020-05-22T21:33:52Z</updated>
<author>
<name>Max Filippov</name>
<email>jcmvbkbc@gmail.com</email>
</author>
<published>2020-05-22T20:20:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c22f9075044057f130f6b73a0638a2eb78f459ad'/>
<id>urn:sha1:c22f9075044057f130f6b73a0638a2eb78f459ad</id>
<content type='text'>
8-byte access in __get_user_size converts pointer to temporary variable
to the type of original user pointer and then dereferences it, resulting
in the following sparse warning:

  sparse: warning: dereference of noderef expression

Instead dereference the original user pointer under the __typeof__ and
add indirection outside.

Signed-off-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>xtensa: add missing __user annotations to __{get,put}_user_check</title>
<updated>2020-05-22T21:32:13Z</updated>
<author>
<name>Max Filippov</name>
<email>jcmvbkbc@gmail.com</email>
</author>
<published>2020-05-22T17:54:32Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3ac4a615bdb10ee7df8818ff107f974322e4c190'/>
<id>urn:sha1:3ac4a615bdb10ee7df8818ff107f974322e4c190</id>
<content type='text'>
__get_user_check and __put_user_check use temporary pointer but don't
mark it as __user, resulting in sparse warnings:

  sparse: warning: incorrect type in initializer (different address spaces)
  sparse:    expected long *__pu_addr
  sparse:    got long [noderef] &lt;asn:1&gt; *ret

  sparse: warning: incorrect type in argument 1 (different address spaces)
  sparse:    expected void [noderef] &lt;asn:1&gt; *to
  sparse:    got long *__pu_addr

Add __user annotation to temporary pointer in __get_user_check and
__put_user_check.

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Reported-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>xtensa: use "m" constraint instead of "a" in uaccess.h assembly</title>
<updated>2019-11-26T19:33:38Z</updated>
<author>
<name>Max Filippov</name>
<email>jcmvbkbc@gmail.com</email>
</author>
<published>2019-10-15T21:03:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=cbc6e28703c44a321e9d8a8894ec11bc6e7e473d'/>
<id>urn:sha1:cbc6e28703c44a321e9d8a8894ec11bc6e7e473d</id>
<content type='text'>
Use "m" constraint instead of "r" for the address, as "m" allows
compiler to access adjacent locations using base + offset, while "r"
requires updating the base register every time.
Use %[mem] * 0 + v to replace offset part of %[mem] expansion with v.
It is impossible to change address alignment through the offset part on
xtensa, so just ignore offset in alignment checks.

Signed-off-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
</feed>
