<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/arch/parisc/math-emu, branch docs-fixes</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-fixes</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-fixes'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2025-05-04T15:30:03+00:00</updated>
<entry>
<title>parisc: Fix double SIGFPE crash</title>
<updated>2025-05-04T15:30:03+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2025-05-03T16:24:01+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=de3629baf5a33af1919dec7136d643b0662e85ef'/>
<id>urn:sha1:de3629baf5a33af1919dec7136d643b0662e85ef</id>
<content type='text'>
Camm noticed that on parisc a SIGFPE exception will crash an application with
a second SIGFPE in the signal handler.  Dave analyzed it, and it happens
because glibc uses a double-word floating-point store to atomically update
function descriptors. As a result of lazy binding, we hit a floating-point
store in fpe_func almost immediately.

When the T bit is set, an assist exception trap occurs when when the
co-processor encounters *any* floating-point instruction except for a double
store of register %fr0.  The latter cancels all pending traps.  Let's fix this
by clearing the Trap (T) bit in the FP status register before returning to the
signal handler in userspace.

The issue can be reproduced with this test program:

root@parisc:~# cat fpe.c

static void fpe_func(int sig, siginfo_t *i, void *v) {
        sigset_t set;
        sigemptyset(&amp;set);
        sigaddset(&amp;set, SIGFPE);
        sigprocmask(SIG_UNBLOCK, &amp;set, NULL);
        printf("GOT signal %d with si_code %ld\n", sig, i-&gt;si_code);
}

int main() {
        struct sigaction action = {
                .sa_sigaction = fpe_func,
                .sa_flags = SA_RESTART|SA_SIGINFO };
        sigaction(SIGFPE, &amp;action, 0);
        feenableexcept(FE_OVERFLOW);
        return printf("%lf\n",1.7976931348623158E308*1.7976931348623158E308);
}

root@parisc:~# gcc fpe.c -lm
root@parisc:~# ./a.out
 Floating point exception

root@parisc:~# strace -f ./a.out
 execve("./a.out", ["./a.out"], 0xf9ac7034 /* 20 vars */) = 0
 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
 ...
 rt_sigaction(SIGFPE, {sa_handler=0x1110a, sa_mask=[], sa_flags=SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
 --- SIGFPE {si_signo=SIGFPE, si_code=FPE_FLTOVF, si_addr=0x1078f} ---
 --- SIGFPE {si_signo=SIGFPE, si_code=FPE_FLTOVF, si_addr=0xf8f21237} ---
 +++ killed by SIGFPE +++
 Floating point exception

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Suggested-by: John David Anglin &lt;dave.anglin@bell.net&gt;
Reported-by: Camm Maguire &lt;camm@maguirefamily.org&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>parisc/math-emu: Remove unused struct 'exc_reg'</title>
<updated>2024-05-10T13:09:15+00:00</updated>
<author>
<name>Dr. David Alan Gilbert</name>
<email>linux@treblig.org</email>
</author>
<published>2024-05-05T23:10:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=0ca4f51fa522df285ebff76ec8bd2bde7d1c080d'/>
<id>urn:sha1:0ca4f51fa522df285ebff76ec8bd2bde7d1c080d</id>
<content type='text'>
This has been here since pre-git.  Build tested.

Signed-off-by: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: avoid c23 'nullptr' idenitifier</title>
<updated>2024-02-27T21:51:44+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2024-02-12T11:20:51+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=cf159848860d38c2f2509ec19d595f5490ed03e5'/>
<id>urn:sha1:cf159848860d38c2f2509ec19d595f5490ed03e5</id>
<content type='text'>
Starting in c23, this is a reserved keyword, so in the future, using it
will start causing build failures:

arch/parisc/math-emu/frnd.c:36:23: error: expected ';', ',' or ')' before 'nullptr'

Since I can't think of a good replacement name, add a leading underscore
to the function argument to avoid this namespace conflict. Apparently
all of these arguments are unused.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: math-emu: Avoid compiler warnings with W=1</title>
<updated>2023-07-03T16:56:03+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2023-07-03T16:38:02+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=de53f3f7a9ffb8a24c3382aa41e24666c28f0368'/>
<id>urn:sha1:de53f3f7a9ffb8a24c3382aa41e24666c28f0368</id>
<content type='text'>
The math-emu code is a snapshot from the HP-UX kernel. They've
been modified as little as possible.
See arch/parisc/math-emu/README.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: align '*' in comment in math-emu code</title>
<updated>2022-06-25T22:19:27+00:00</updated>
<author>
<name>Jiang Jian</name>
<email>jiangjian@cdjrlc.com</email>
</author>
<published>2022-06-21T06:38:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d16c5c7c925658ea94689dfe4469441f7fd59f00'/>
<id>urn:sha1:d16c5c7c925658ea94689dfe4469441f7fd59f00</id>
<content type='text'>
Signed-off-by: Jiang Jian &lt;jiangjian@cdjrlc.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: Fix typos in comments</title>
<updated>2022-05-08T18:01:12+00:00</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@inria.fr</email>
</author>
<published>2022-04-30T19:07:18+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a65bcad5421507c2f6c52e1e2ca6a6ce02fd1ad6'/>
<id>urn:sha1:a65bcad5421507c2f6c52e1e2ca6a6ce02fd1ad6</id>
<content type='text'>
Various spelling mistakes in comments.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: math-emu: Fix fall-through warnings</title>
<updated>2021-09-01T20:18:18+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2021-09-01T20:18:18+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=6f1fce595b78b775d7fb585c15c2dc3a6994f96e'/>
<id>urn:sha1:6f1fce595b78b775d7fb585c15c2dc3a6994f96e</id>
<content type='text'>
Fix lots of fallthrough warnings, e.g.:
arch/parisc/math-emu/fpudispatch.c:323:33: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: math-emu: Avoid "fmt" macro collision</title>
<updated>2021-08-30T08:18:24+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2021-08-18T03:18:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=7f2dcc7371c1ab6e5d3678a7eff1cb0eb9725de9'/>
<id>urn:sha1:7f2dcc7371c1ab6e5d3678a7eff1cb0eb9725de9</id>
<content type='text'>
The printk "fmt" macro was colliding. Rename like the others with a
"bits" suffix. Fixes a build failure:

arch/parisc/math-emu/decode_exc.c: In function 'decode_fpu':
arch/parisc/math-emu/decode_exc.c:49:14: error: expected identifier before numeric constant
   49 | #define fmt  11 /* bits 19 &amp; 20 */
      |              ^~
./include/linux/printk.h:379:6: note: in expansion of macro 'fmt'
  379 |     .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
      |      ^~~
./include/linux/printk.h:417:3: note: in expansion of macro '__printk_index_emit'
  417 |   __printk_index_emit(_fmt, NULL, NULL);   \
      |   ^~~~~~~~~~~~~~~~~~~
./include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
  446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~~~
arch/parisc/math-emu/decode_exc.c:339:3: note: in expansion of macro 'printk'
  339 |   printk("%s(%d) Unknown FPU exception 0x%x\n", __FILE__,
      |   ^~~~~~

Cc: "James E.J. Bottomley" &lt;James.Bottomley@HansenPartnership.com&gt;
Cc: Helge Deller &lt;deller@gmx.de&gt;
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>parisc: math-emu: Few spelling fixes in the file fpu.h</title>
<updated>2021-04-06T13:34:14+00:00</updated>
<author>
<name>Bhaskar Chowdhury</name>
<email>unixbhaskar@gmail.com</email>
</author>
<published>2021-03-17T19:24:27+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=0aa2ddc9af44bf9032098a587aeabada4da181a7'/>
<id>urn:sha1:0aa2ddc9af44bf9032098a587aeabada4da181a7</id>
<content type='text'>
with some additional cleanups by Helge.

Signed-off-by: Bhaskar Chowdhury &lt;unixbhaskar@gmail.com&gt;
Acked-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
</content>
</entry>
<entry>
<title>Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang</title>
<updated>2019-08-10T19:45:37+00:00</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2019-08-05T22:11:15+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=bfd77145f35c3deafe57e9eb67fff4ccffdaef6e'/>
<id>urn:sha1:bfd77145f35c3deafe57e9eb67fff4ccffdaef6e</id>
<content type='text'>
A compilation -Wimplicit-fallthrough warning was enabled by commit
a035d552a93b ("Makefile: Globally enable fall-through warning")

Even though clang 10.0.0 does not currently support this warning without
a patch, clang currently does not support a value for this option.

  Link: https://bugs.llvm.org/show_bug.cgi?id=39382

The gcc default for this warning is 3 so removing the =3 has no effect
for gcc and enables the warning for patched versions of clang.

Also remove the =3 from an existing use in a parisc Makefile:
arch/parisc/math-emu/Makefile

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Reviewed-and-tested-by: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Cc: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
