public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] arch: define weak abort
@ 2017-12-12 22:49 Sudip Mukherjee
  2017-12-13 21:46 ` Alexey Brodkin
  2017-12-19 21:39 ` Vineet Gupta
  0 siblings, 2 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2017-12-12 22:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Vineet Gupta, Sudip Mukherjee, Alexey Brodkin

gcc toggle -fisolate-erroneous-paths-dereference (default at -O2
onwards) isolates faulty code paths such as null pointer access, divide
by zero etc. If gcc port doesnt implement __builtin_trap, an abort() is
generated which causes kernel link error.

In this case, gcc is generating abort due to 'divide by zero' in
lib/mpi/mpih-div.c.

Currently 'frv' and 'arc' are failing. Previously other arch was also
broken like m32r was fixed by d22e3d69ee1a ("m32r: fix build failure").

Lets define this weak function which is common for all arch and fix the
problem permanently. We can even remove the arch specific 'abort' after
this is done.

Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---

Hi Alexey,
I was thinking of sending the m32r revert patch in few days. My m32r
builds are having a little problem and should be fixed by this weekend.
I can not test m32r before that. We can also send a patch to remove the
same code in arm and unicore32.

 kernel/exit.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/exit.c b/kernel/exit.c
index af6c245..90c6869 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1759,3 +1759,11 @@ long kernel_wait4(pid_t upid, int __user *stat_addr, int options,
 	return -EFAULT;
 }
 #endif
+
+__weak void abort(void)
+{
+	BUG();
+
+	/* if that doesn't kill us, halt */
+	panic("Oops failed to kill thread");
+}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-21 23:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-12 22:49 [PATCH v2] arch: define weak abort Sudip Mukherjee
2017-12-13 21:46 ` Alexey Brodkin
2017-12-19 21:39 ` Vineet Gupta
2017-12-19 21:55   ` Andrew Morton
2017-12-21 23:20     ` Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox