<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/arch/parisc/lib/memcpy.c, branch v4.9.20</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>parisc: Add hardened usercopy feature</title>
<updated>2016-10-06T20:10:19+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2016-10-06T07:07:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9e91db6b4abecd58647a5e984d538187f1c2ea09'/>
<id>9e91db6b4abecd58647a5e984d538187f1c2ea09</id>
<content type='text'>
Add hardened usercopy checks to parisc architecture and clean up
indenting.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add hardened usercopy checks to parisc architecture and clean up
indenting.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: Replace __get_cpu_var uses for address calculation</title>
<updated>2014-04-03T18:50:33+00:00</updated>
<author>
<name>Christoph Lameter</name>
<email>cl@linux.com</email>
</author>
<published>2014-02-14T20:18:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=496252f787560df18a65fdc74dc3180f7cd2c723'/>
<id>496252f787560df18a65fdc74dc3180f7cd2c723</id>
<content type='text'>
Convert to the use of this_cpu_ptr().

Cc: "James E.J. Bottomley" &lt;jejb@parisc-linux.org&gt;
Cc: Helge Deller &lt;deller@gmx.de&gt;
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Christoph Lameter &lt;cl@linux.com&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Convert to the use of this_cpu_ptr().

Cc: "James E.J. Bottomley" &lt;jejb@parisc-linux.org&gt;
Cc: Helge Deller &lt;deller@gmx.de&gt;
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Christoph Lameter &lt;cl@linux.com&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: size_t is unsigned, so comparison size &lt; 0 doesn't make sense.</title>
<updated>2013-11-19T23:09:42+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2013-11-12T20:01:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=964f413323e8306ac0acb5e08ccdb5f12418835b'/>
<id>964f413323e8306ac0acb5e08ccdb5f12418835b</id>
<content type='text'>
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
CC: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
CC: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: do not inline pa_memcpy() internal functions</title>
<updated>2013-11-19T22:36:16+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2013-11-17T21:03:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9af63aedb84c4281cde1610280246f7749c27799'/>
<id>9af63aedb84c4281cde1610280246f7749c27799</id>
<content type='text'>
gcc (4.8.x) creates wrong code when the pa_memcpy() functions are
inlined.  Especially in 32bit builds it calculates wrong return values
if we encounter a fault during execution of the memcpy.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc (4.8.x) creates wrong code when the pa_memcpy() functions are
inlined.  Especially in 32bit builds it calculates wrong return values
if we encounter a fault during execution of the memcpy.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: let probe_kernel_read() capture access to page zero</title>
<updated>2013-10-13T15:46:31+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2013-10-09T21:47:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=db080f9c530f78dad661257885a1893506077068'/>
<id>db080f9c530f78dad661257885a1893506077068</id>
<content type='text'>
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: Fix gcc miscompilation in pa_memcpy()</title>
<updated>2013-07-09T20:09:23+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2013-07-04T20:34:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b879d78bc0818aa710f5d4d9abbfc2aca075cc3'/>
<id>5b879d78bc0818aa710f5d4d9abbfc2aca075cc3</id>
<content type='text'>
When running the LTP testsuite one may hit this kernel BUG() with the
write06 testcase:

kernel BUG at mm/filemap.c:2023!
CPU: 1 PID: 8614 Comm: writev01 Not tainted 3.10.0-rc7-64bit-c3000+ #6
IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401e6e84 00000000401e6e88
 IIR: 03ffe01f    ISR: 0000000010340000  IOR: 000001fbe0380820
 CPU:        1   CR30: 00000000bef80000 CR31: ffffffffffffffff
 ORIG_R28: 00000000bdc192c0
 IAOQ[0]: iov_iter_advance+0x3c/0xc0
 IAOQ[1]: iov_iter_advance+0x40/0xc0
 RP(r2): generic_file_buffered_write+0x204/0x3f0
Backtrace:
 [&lt;00000000401e764c&gt;] generic_file_buffered_write+0x204/0x3f0
 [&lt;00000000401eab24&gt;] __generic_file_aio_write+0x244/0x448
 [&lt;00000000401eadc0&gt;] generic_file_aio_write+0x98/0x150
 [&lt;000000004024f460&gt;] do_sync_readv_writev+0xc0/0x130
 [&lt;000000004025037c&gt;] compat_do_readv_writev+0x12c/0x340
 [&lt;00000000402505f8&gt;] compat_writev+0x68/0xa0
 [&lt;0000000040251d88&gt;] compat_SyS_writev+0x98/0xf8

Reason for this crash is a gcc miscompilation in the fault handlers of
pa_memcpy() which return the fault address instead of the copied bytes.
Since this seems to be a generic problem with gcc-4.7.x (and below), it's
better to simplify the fault handlers in pa_memcpy to avoid this problem.

Here is a simple reproducer for the problem:

int main(int argc, char **argv)
{
	int fd, nbytes;
	struct iovec wr_iovec[] = {
		{ "TEST STRING                     ",32},
		{ (char*)0x40005000,32} }; // random memory.
	fd = open(DATA_FILE, O_RDWR | O_CREAT, 0666);
	nbytes = writev(fd, wr_iovec, 2);
	printf("return value = %d, errno %d (%s)\n",
		nbytes, errno, strerror(errno));
	return 0;
}

In addition, John David Anglin wrote:
There is no gcc PR as pa_memcpy is not legitimate C code. There is an
implicit assumption that certain variables will contain correct values
when an exception occurs and the code randomly jumps to one of the
exception blocks.  There is no guarantee of this.  If a PR was filed, it
would likely be marked as invalid.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: John David Anglin &lt;dave.anglin@bell.net&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 3.8+
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When running the LTP testsuite one may hit this kernel BUG() with the
write06 testcase:

kernel BUG at mm/filemap.c:2023!
CPU: 1 PID: 8614 Comm: writev01 Not tainted 3.10.0-rc7-64bit-c3000+ #6
IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401e6e84 00000000401e6e88
 IIR: 03ffe01f    ISR: 0000000010340000  IOR: 000001fbe0380820
 CPU:        1   CR30: 00000000bef80000 CR31: ffffffffffffffff
 ORIG_R28: 00000000bdc192c0
 IAOQ[0]: iov_iter_advance+0x3c/0xc0
 IAOQ[1]: iov_iter_advance+0x40/0xc0
 RP(r2): generic_file_buffered_write+0x204/0x3f0
Backtrace:
 [&lt;00000000401e764c&gt;] generic_file_buffered_write+0x204/0x3f0
 [&lt;00000000401eab24&gt;] __generic_file_aio_write+0x244/0x448
 [&lt;00000000401eadc0&gt;] generic_file_aio_write+0x98/0x150
 [&lt;000000004024f460&gt;] do_sync_readv_writev+0xc0/0x130
 [&lt;000000004025037c&gt;] compat_do_readv_writev+0x12c/0x340
 [&lt;00000000402505f8&gt;] compat_writev+0x68/0xa0
 [&lt;0000000040251d88&gt;] compat_SyS_writev+0x98/0xf8

Reason for this crash is a gcc miscompilation in the fault handlers of
pa_memcpy() which return the fault address instead of the copied bytes.
Since this seems to be a generic problem with gcc-4.7.x (and below), it's
better to simplify the fault handlers in pa_memcpy to avoid this problem.

Here is a simple reproducer for the problem:

int main(int argc, char **argv)
{
	int fd, nbytes;
	struct iovec wr_iovec[] = {
		{ "TEST STRING                     ",32},
		{ (char*)0x40005000,32} }; // random memory.
	fd = open(DATA_FILE, O_RDWR | O_CREAT, 0666);
	nbytes = writev(fd, wr_iovec, 2);
	printf("return value = %d, errno %d (%s)\n",
		nbytes, errno, strerror(errno));
	return 0;
}

In addition, John David Anglin wrote:
There is no gcc PR as pa_memcpy is not legitimate C code. There is an
implicit assumption that certain variables will contain correct values
when an exception occurs and the code randomly jumps to one of the
exception blocks.  There is no guarantee of this.  If a PR was filed, it
would likely be marked as invalid.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: John David Anglin &lt;dave.anglin@bell.net&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 3.8+
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: avoid unitialized variable warning in pa_memcpy()</title>
<updated>2013-03-02T18:56:27+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2013-02-26T23:06:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d8d0524a39056dbdafece1ed65ae51afc711c8b5'/>
<id>d8d0524a39056dbdafece1ed65ae51afc711c8b5</id>
<content type='text'>
Avoid this warning, while still prevent gcc from optimizing away the exception code:
arch/parisc/lib/memcpy.c: In function ‘pa_memcpy’:
arch/parisc/lib/memcpy.c:256:2: warning: ‘dummy’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid this warning, while still prevent gcc from optimizing away the exception code:
arch/parisc/lib/memcpy.c: In function ‘pa_memcpy’:
arch/parisc/lib/memcpy.c:256:2: warning: ‘dummy’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: add strict copy size checks (v2)</title>
<updated>2010-03-06T22:54:09+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2010-02-01T19:56:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=888c31fc83ddc7fcd9947cb67c5718b4e3dd5e1b'/>
<id>888c31fc83ddc7fcd9947cb67c5718b4e3dd5e1b</id>
<content type='text'>
Add CONFIG_DEBUG_STRICT_USER_COPY_CHECKS, copied from the x86
implementation. Tested with 32 and 64bit kernel.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add CONFIG_DEBUG_STRICT_USER_COPY_CHECKS, copied from the x86
implementation. Tested with 32 and 64bit kernel.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: fix mismatched parenthesis in memcpy.c</title>
<updated>2009-07-03T03:34:09+00:00</updated>
<author>
<name>Randolph Chung</name>
<email>randolph@tausq.org</email>
</author>
<published>2009-06-23T14:53:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=87451d850c895470a122308086069b7c326c914b'/>
<id>87451d850c895470a122308086069b7c326c914b</id>
<content type='text'>
&gt;&gt;&gt;&gt; I think this is what was intended? Note that this patch may affect
&gt;&gt;&gt;&gt; profiling.
&gt;&gt;&gt; it really should be
&gt;&gt;&gt;
&gt;&gt;&gt; -    if (likely(t1 &amp; (sizeof(unsigned int)-1)) == 0) {
&gt;&gt;&gt; +    if (likely((t1 &amp; (sizeof(unsigned int)-1)) == 0)) {
&gt;&gt;&gt;
&gt;&gt;&gt; randolph

Reported-by: Roel Kluin &lt;roel.kluin@gmail.com&gt;
Signed-off-by: Randolph Chung &lt;tausq@parisc-linux.org&gt;
Signed-off-by: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
&gt;&gt;&gt;&gt; I think this is what was intended? Note that this patch may affect
&gt;&gt;&gt;&gt; profiling.
&gt;&gt;&gt; it really should be
&gt;&gt;&gt;
&gt;&gt;&gt; -    if (likely(t1 &amp; (sizeof(unsigned int)-1)) == 0) {
&gt;&gt;&gt; +    if (likely((t1 &amp; (sizeof(unsigned int)-1)) == 0)) {
&gt;&gt;&gt;
&gt;&gt;&gt; randolph

Reported-by: Roel Kluin &lt;roel.kluin@gmail.com&gt;
Signed-off-by: Randolph Chung &lt;tausq@parisc-linux.org&gt;
Signed-off-by: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parisc: lib/: make code static</title>
<updated>2009-01-05T18:15:24+00:00</updated>
<author>
<name>Adrian Bunk</name>
<email>bunk@kernel.org</email>
</author>
<published>2008-12-02T03:28:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8f47cb87eb603fac557a8408c23701dffad07581'/>
<id>8f47cb87eb603fac557a8408c23701dffad07581</id>
<content type='text'>
Make the following needlessly global code static:

- iomap.c: struct iomap_ops[]
- memcpy.c: pa_memcpy()

Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;
Cc: Matthew Wilcox &lt;matthew@wil.cx&gt;
Cc: Grant Grundler &lt;grundler@parisc-linux.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make the following needlessly global code static:

- iomap.c: struct iomap_ops[]
- memcpy.c: pa_memcpy()

Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;
Cc: Matthew Wilcox &lt;matthew@wil.cx&gt;
Cc: Grant Grundler &lt;grundler@parisc-linux.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
</pre>
</div>
</content>
</entry>
</feed>
