<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/arch/mips/math-emu, branch linux-5.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2019-01-22T19:17:20Z</updated>
<entry>
<title>mips: math-emu: no need to check return value of debugfs_create functions</title>
<updated>2019-01-22T19:17:20Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2019-01-22T14:57:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ef9d5a6a3f5c0badaf0d33170c02a2c30164b5be'/>
<id>urn:sha1:ef9d5a6a3f5c0badaf0d33170c02a2c30164b5be</id>
<content type='text'>
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Ralf Baechle &lt;ralf@linux-mips.org&gt;
Cc: Paul Burton &lt;paul.burton@mips.com&gt;
Cc: James Hogan &lt;jhogan@kernel.org&gt;
Cc: Yangtao Li &lt;tiny.windzz@gmail.com&gt;
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Paul Burton &lt;paul.burton@mips.com&gt;
</content>
</entry>
<entry>
<title>Remove 'type' argument from access_ok() function</title>
<updated>2019-01-04T02:57:57Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2019-01-04T02:57:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=96d4f267e40f9509e8a66e2b39e8b95655617693'/>
<id>urn:sha1:96d4f267e40f9509e8a66e2b39e8b95655617693</id>
<content type='text'>
Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
of the user address range verification function since we got rid of the
old racy i386-only code to walk page tables by hand.

It existed because the original 80386 would not honor the write protect
bit when in kernel mode, so you had to do COW by hand before doing any
user access.  But we haven't supported that in a long time, and these
days the 'type' argument is a purely historical artifact.

A discussion about extending 'user_access_begin()' to do the range
checking resulted this patch, because there is no way we're going to
move the old VERIFY_xyz interface to that model.  And it's best done at
the end of the merge window when I've done most of my merges, so let's
just get this done once and for all.

This patch was mostly done with a sed-script, with manual fix-ups for
the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.

There were a couple of notable cases:

 - csky still had the old "verify_area()" 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 printout

but other than those oddities this should be a total no-op patch.

I tried to fix up all architectures, did fairly extensive grepping for
access_ok() uses, and the changes are trivial, but I may have missed
something.  Any missed conversion should be trivially fixable, though.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>MIPS: math-emu: Write-protect delay slot emulation pages</title>
<updated>2018-12-20T18:00:01Z</updated>
<author>
<name>Paul Burton</name>
<email>paul.burton@mips.com</email>
</author>
<published>2018-12-20T17:45:43Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=adcc81f148d733b7e8e641300c5590a2cdc13bf3'/>
<id>urn:sha1:adcc81f148d733b7e8e641300c5590a2cdc13bf3</id>
<content type='text'>
Mapping the delay slot emulation page as both writeable &amp; executable
presents a security risk, in that if an exploit can write to &amp; jump into
the page then it can be used as an easy way to execute arbitrary code.

Prevent this by mapping the page read-only for userland, and using
access_process_vm() with the FOLL_FORCE flag to write to it from
mips_dsemul().

This will likely be less efficient due to copy_to_user_page() performing
cache maintenance on a whole page, rather than a single line as in the
previous use of flush_cache_sigtramp(). However this delay slot
emulation code ought not to be running in any performance critical paths
anyway so this isn't really a problem, and we can probably do better in
copy_to_user_page() anyway in future.

A major advantage of this approach is that the fix is small &amp; simple to
backport to stable kernels.

Reported-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Paul Burton &lt;paul.burton@mips.com&gt;
Fixes: 432c6bacbd0c ("MIPS: Use per-mm page to execute branch delay slot instructions")
Cc: stable@vger.kernel.org # v4.8+
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Rich Felker &lt;dalias@libc.org&gt;
Cc: David Daney &lt;david.daney@cavium.com&gt;
</content>
</entry>
<entry>
<title>MIPS: Ensure emulated FP sets PF_USED_MATH</title>
<updated>2018-11-09T18:23:14Z</updated>
<author>
<name>Paul Burton</name>
<email>paul.burton@mips.com</email>
</author>
<published>2018-11-07T23:14:00Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=1975ed43ce67542befed188f6aed6a82cfaffd0b'/>
<id>urn:sha1:1975ed43ce67542befed188f6aed6a82cfaffd0b</id>
<content type='text'>
Emulated floating point instructions don't ensure that the PF_USED_MATH
flag is set for the task. This results in a couple of inconsistencies:

  - ptrace will return the default initial state of FP registers rather
    than the values actually stored in struct thread_struct, hiding
    state that has been updated by emulated floating point instructions.

  - If a task migrates to a CPU with an FPU after having emulated
    floating point instructions then its floating point register state
    will be reset to the default ~0 bit pattern, losing state from the
    emulated instructions.

Fix this by calling init_fp_ctx() from fpu_emulator_cop1Handler() to
consistently initialize FP state if it was previously uninitialized,
setting the PF_USED_MATH flag in the process.

All callers of fpu_emulator_cop1Handler() either call lose_fpu(1) before
it in order to save any live FPU registers to struct thread_struct, or
in the case of do_cpu() already know that the task does not own an FPU
so lose_fpu(1) would be a no-op. Since we know that saving FP context
will be unnecessary in the case where FP context was just initialized we
move this call into fpu_emulator_cop1Handler() too, providing
consistency &amp; avoiding needless duplication.

Calls to own_fpu(1) are common after return from
fpu_emulator_cop1Handler() too, but this would not be a no-op in the
do_cpu() case so these are left as-is. A potential future improvement
could be to have fpu_emulator_cop1Handler() restore FPU state
automatically only if it saved it, though this may not be optimal if
some callers are better off without their current calls to own_fpu(1).
One potential example of this could be mipsr2_decoder() which as-is
could end up saving &amp; restoring FP context repeatedly &amp; unnecessarily if
emulating multiple FP instructions.

Signed-off-by: Paul Burton &lt;paul.burton@mips.com&gt;
Patchwork: https://patchwork.linux-mips.org/patch/21003/
Cc: linux-mips@linux-mips.org
</content>
</entry>
<entry>
<title>MIPS: math-emu: Change to use DEFINE_SHOW_ATTRIBUTE macro</title>
<updated>2018-11-05T18:13:21Z</updated>
<author>
<name>Yangtao Li</name>
<email>tiny.windzz@gmail.com</email>
</author>
<published>2018-11-05T14:50:49Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=67769857f05a3b6af79c990e53aa47f4c2b4a000'/>
<id>urn:sha1:67769857f05a3b6af79c990e53aa47f4c2b4a000</id>
<content type='text'>
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li &lt;tiny.windzz@gmail.com&gt;
Signed-off-by: Paul Burton &lt;paul.burton@mips.com&gt;
Patchwork: https://patchwork.linux-mips.org/patch/20988/
Cc: ralf@linux-mips.org
Cc: jhogan@kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
</content>
</entry>
<entry>
<title>MIPS: math-emu: Mark fall throughs in switch statements with a comment</title>
<updated>2017-12-12T16:20:20Z</updated>
<author>
<name>Aleksandar Markovic</name>
<email>aleksandar.markovic@mips.com</email>
</author>
<published>2017-11-02T11:14:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2a14b21acd056499cb150014e93d805a5ade2ce1'/>
<id>urn:sha1:2a14b21acd056499cb150014e93d805a5ade2ce1</id>
<content type='text'>
Mark intentional fall throughs in switch statements with a consistent
comment.

In most of the cases, a new comment line containing text "fall through"
is inserted. In some of the cases, existing comment contained a variation
of the text "fall through" (for example, "FALL THROUGH" or "drop through").
In such cases, the existing comment is modified to contain "fall through".
Lastly, in two cases, code segments were described in comments as "fall
througs", but were in reality "breaks out" of switch statement. In such
cases, existing comments are accordingly modified.

Apart from making code easier to follow and debug, this change enables
some static code analysers to interpret newly inserted comments as their
annotations (and, therefore, not issue warnings of type "fall through in
switch statement", which is desireable, since marked fallthroughs are
intentional).

Signed-off-by: Aleksandar Markovic &lt;aleksandar.markovic@mips.com&gt;
Cc: Douglas Leung &lt;douglas.leung@mips.com&gt;
Cc: Goran Ferenc &lt;goran.ferenc@mips.com&gt;
Cc: James Hogan &lt;james.hogan@mips.com&gt;
Cc: Maciej W. Rozycki &lt;macro@mips.com&gt;
Cc: Manuel Lauss &lt;manuel.lauss@gmail.com&gt;
Cc: Miodrag Dinic &lt;miodrag.dinic@mips.com&gt;
Cc: Paul Burton &lt;paul.burton@mips.com&gt;
Cc: Petar Jovanovic &lt;petar.jovanovic@mips.com&gt;
Cc: Raghu Gandham &lt;raghu.gandham@mips.com&gt;
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/17588/
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
</content>
</entry>
<entry>
<title>MIPS: math-emu: Avoid multiple assignment</title>
<updated>2017-12-12T16:20:20Z</updated>
<author>
<name>Aleksandar Markovic</name>
<email>aleksandar.markovic@mips.com</email>
</author>
<published>2017-11-02T11:14:04Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=61100500a15aed732f363cf19c5206bcd30f4754'/>
<id>urn:sha1:61100500a15aed732f363cf19c5206bcd30f4754</id>
<content type='text'>
Replace several instances of multiple assignment with individual
assignments.

Signed-off-by: Aleksandar Markovic &lt;aleksandar.markovic@mips.com&gt;
Cc: Douglas Leung &lt;douglas.leung@mips.com&gt;
Cc: Goran Ferenc &lt;goran.ferenc@mips.com&gt;
Cc: James Hogan &lt;james.hogan@mips.com&gt;
Cc: Maciej W. Rozycki &lt;macro@mips.com&gt;
Cc: Manuel Lauss &lt;manuel.lauss@gmail.com&gt;
Cc: Miodrag Dinic &lt;miodrag.dinic@mips.com&gt;
Cc: Paul Burton &lt;paul.burton@mips.com&gt;
Cc: Petar Jovanovic &lt;petar.jovanovic@mips.com&gt;
Cc: Raghu Gandham &lt;raghu.gandham@mips.com&gt;
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/17587/
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
</content>
</entry>
<entry>
<title>MIPS: math-emu: Avoid an assignment within if statement condition</title>
<updated>2017-12-12T16:20:20Z</updated>
<author>
<name>Aleksandar Markovic</name>
<email>aleksandar.markovic@mips.com</email>
</author>
<published>2017-11-02T11:14:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8904d5b1a31febe0ced1f56aa347e761668af571'/>
<id>urn:sha1:8904d5b1a31febe0ced1f56aa347e761668af571</id>
<content type='text'>
Move invocation of fpu_emu() to be out of if statement condition.

This makes code easier to follow and debug, and fixes a checkpatch
warning.

Signed-off-by: Aleksandar Markovic &lt;aleksandar.markovic@mips.com&gt;
Cc: Douglas Leung &lt;douglas.leung@mips.com&gt;
Cc: Goran Ferenc &lt;goran.ferenc@mips.com&gt;
Cc: James Hogan &lt;james.hogan@mips.com&gt;
Cc: Maciej W. Rozycki &lt;macro@mips.com&gt;
Cc: Miodrag Dinic &lt;miodrag.dinic@mips.com&gt;
Cc: Paul Burton &lt;paul.burton@mips.com&gt;
Cc: Petar Jovanovic &lt;petar.jovanovic@mips.com&gt;
Cc: Raghu Gandham &lt;raghu.gandham@mips.com&gt;
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/17586/
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
</content>
</entry>
<entry>
<title>MIPS: math-emu: Declare function srl128() as static</title>
<updated>2017-12-12T16:20:19Z</updated>
<author>
<name>Aleksandar Markovic</name>
<email>aleksandar.markovic@mips.com</email>
</author>
<published>2017-11-02T11:14:02Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=95306f0469580ba94e909d63ee1e2a67c5dc5cba'/>
<id>urn:sha1:95306f0469580ba94e909d63ee1e2a67c5dc5cba</id>
<content type='text'>
Declare function srl128() as static, since it it used just locally
to the source file.

This also removes a sparse warning for corresponding file.

Signed-off-by: Aleksandar Markovic &lt;aleksandar.markovic@mips.com&gt;
Cc: Douglas Leung &lt;douglas.leung@mips.com&gt;
Cc: Goran Ferenc &lt;goran.ferenc@mips.com&gt;
Cc: James Hogan &lt;james.hogan@mips.com&gt;
Cc: Miodrag Dinic &lt;miodrag.dinic@mips.com&gt;
Cc: Paul Burton &lt;paul.burton@mips.com&gt;
Cc: Petar Jovanovic &lt;petar.jovanovic@mips.com&gt;
Cc: Raghu Gandham &lt;raghu.gandham@mips.com&gt;
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/17585/
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
</content>
</entry>
<entry>
<title>MIPS: math-emu: Avoid definition duplication for macro DPXMULT()</title>
<updated>2017-12-12T16:20:19Z</updated>
<author>
<name>Aleksandar Markovic</name>
<email>aleksandar.markovic@mips.com</email>
</author>
<published>2017-11-02T11:14:01Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=999eae9bf61d379b22f460b31f76b4a03f40bb22'/>
<id>urn:sha1:999eae9bf61d379b22f460b31f76b4a03f40bb22</id>
<content type='text'>
Avoid duplicate definition of macro DPXMULT(). Move its definition
to a header.

Signed-off-by: Aleksandar Markovic &lt;aleksandar.markovic@mips.com&gt;
Cc: Douglas Leung &lt;douglas.leung@mips.com&gt;
Cc: Goran Ferenc &lt;goran.ferenc@mips.com&gt;
Cc: James Hogan &lt;james.hogan@mips.com&gt;
Cc: Miodrag Dinic &lt;miodrag.dinic@mips.com&gt;
Cc: Paul Burton &lt;paul.burton@mips.com&gt;
Cc: Petar Jovanovic &lt;petar.jovanovic@mips.com&gt;
Cc: Raghu Gandham &lt;raghu.gandham@mips.com&gt;
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/17584/
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
</content>
</entry>
</feed>
