* [PATCH v2] arch: define weak abort [not found] <1513118956-8718-1-git-send-email-sudipm.mukherjee@gmail.com> @ 2017-12-13 21:46 ` Alexey Brodkin 2017-12-19 21:39 ` Vineet Gupta 1 sibling, 0 replies; 4+ messages in thread From: Alexey Brodkin @ 2017-12-13 21:46 UTC (permalink / raw) To: linux-snps-arc Hi Sudip, On Tue, 2017-12-12@22:49 +0000, Sudip Mukherjee wrote: > 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 at synopsys.com> > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee at 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. Understood, that's fine by me. > We can also send a patch to remove the > same code in arm and unicore32. Sure that would be really great! -Alexey ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] arch: define weak abort [not found] <1513118956-8718-1-git-send-email-sudipm.mukherjee@gmail.com> 2017-12-13 21:46 ` [PATCH v2] arch: define weak abort Alexey Brodkin @ 2017-12-19 21:39 ` Vineet Gupta 2017-12-19 21:55 ` Andrew Morton 1 sibling, 1 reply; 4+ messages in thread From: Vineet Gupta @ 2017-12-19 21:39 UTC (permalink / raw) To: linux-snps-arc On 12/12/2017 02:49 PM, Sudip Mukherjee wrote: > 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 at synopsys.com> > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee at 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"); > +} Hmm, I realize there's a small gotcha with this, when testing with a different patch from Arnd. This needs an EXPORT_SYMBOL() as well ! -Vineet ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] arch: define weak abort 2017-12-19 21:39 ` Vineet Gupta @ 2017-12-19 21:55 ` Andrew Morton 2017-12-21 23:20 ` Sudip Mukherjee 0 siblings, 1 reply; 4+ messages in thread From: Andrew Morton @ 2017-12-19 21:55 UTC (permalink / raw) To: linux-snps-arc On Tue, 19 Dec 2017 13:39:22 -0800 Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote: > > --- 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"); > > +} > > Hmm, I realize there's a small gotcha with this, when testing with a different > patch from Arnd. This needs an EXPORT_SYMBOL() as well ! Yup. This? From: Andrew Morton <akpm@linux-foundation.org> Subject: kernel/exit.c: export abort() to modules gcc -fisolate-erroneous-paths-dereference can generate calls to abort() from modular code too. Reported-by: Vineet Gupta <Vineet.Gupta1 at synopsys.com> Cc: Sudip Mukherjee <sudipm.mukherjee at gmail.com> Cc: Arnd Bergmann <arnd at arndb.de> Cc: "Alexey Brodkin" <Alexey.Brodkin at synopsys.com> Signed-off-by: Andrew Morton <akpm at linux-foundation.org> --- kernel/exit.c | 1 + 1 file changed, 1 insertion(+) diff -puN kernel/exit.c~a kernel/exit.c --- a/kernel/exit.c~a +++ a/kernel/exit.c @@ -1763,3 +1763,4 @@ __weak void abort(void) /* if that doesn't kill us, halt */ panic("Oops failed to kill thread"); } +EXPORT_SYMBOL(abort); _ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] arch: define weak abort 2017-12-19 21:55 ` Andrew Morton @ 2017-12-21 23:20 ` Sudip Mukherjee 0 siblings, 0 replies; 4+ messages in thread From: Sudip Mukherjee @ 2017-12-21 23:20 UTC (permalink / raw) To: linux-snps-arc On Tue, Dec 19, 2017@01:55:59PM -0800, Andrew Morton wrote: > On Tue, 19 Dec 2017 13:39:22 -0800 Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote: > <snip> > > Hmm, I realize there's a small gotcha with this, when testing with a different > > patch from Arnd. This needs an EXPORT_SYMBOL() as well ! > > Yup. This? Yes, just faced this when I was testing with the reverted patch on m32r. > > From: Andrew Morton <akpm at linux-foundation.org> > Subject: kernel/exit.c: export abort() to modules > > gcc -fisolate-erroneous-paths-dereference can generate calls to abort() > from modular code too. > > Reported-by: Vineet Gupta <Vineet.Gupta1 at synopsys.com> > Cc: Sudip Mukherjee <sudipm.mukherjee at gmail.com> > Cc: Arnd Bergmann <arnd at arndb.de> > Cc: "Alexey Brodkin" <Alexey.Brodkin at synopsys.com> > Signed-off-by: Andrew Morton <akpm at linux-foundation.org> > --- Acked-by: Sudip Mukherjee <sudipm.mukherjee at gmail.com> -- Regards Sudip ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-12-21 23:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1513118956-8718-1-git-send-email-sudipm.mukherjee@gmail.com>
2017-12-13 21:46 ` [PATCH v2] arch: define weak abort 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; as well as URLs for NNTP newsgroup(s).