Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Camm Maguire <camm@maguirefamily.org>
To: David Daney <ddaney@caviumnetworks.com>
Cc: debian-mips@lists.debian.org,
	Frederick Isaac <freddyisaac@gmail.com>,
	gcl-devel@gnu.org, linux-mips <linux-mips@linux-mips.org>
Subject: Re: recent SIGBUS/SIGSEGV mips kernel bug
Date: Thu, 21 Oct 2010 15:07:57 -0400	[thread overview]
Message-ID: <874ocf74aa.fsf@maguirefamily.org> (raw)
In-Reply-To: <4CC0787C.2040902@caviumnetworks.com> (David Daney's message of "Thu\, 21 Oct 2010 10\:29\:32 -0700")

Greetings!

David Daney <ddaney@caviumnetworks.com> writes:

> On 10/21/2010 09:19 AM, David Daney wrote:
>> On 10/20/2010 02:31 PM, Camm Maguire wrote:
>>> Greetings!
>>>
>>> Does this suffice?
>>>
>>> (sid)camm@gabrielli:~/maxima-5.22.1/tests$ uname -a
>>> Linux gabrielli 2.6.35.4-dsa-octeon #1 SMP Fri Sep 17 21:15:34 UTC
>>> 2010 mips64 GNU/Linux
>>> (sid)camm@gabrielli:~/maxima-5.22.1/tests$ cat /proc/cpuinfo
>>> system type : CUST_WSX16 (CN3860p3.X-500-EXP)
>>> processor : 0
>>> cpu model : Cavium Octeon V0.3
>> [...]
>>
>> Hah! I have those things piled up all around me.
>>
>> No guarantees, but I will try to reproduce it. If I can reproduce it, it
>> should be easy to fix.
>>
>
> Definitely a kernel bug.  Consider this program:
>
> ------------8<--------sigbus.c-------
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> #include <sys/mman.h>
>
> int main(int argc, char *argv[])
> {
>   int pgsize;
>   float *p1;
>   float *p2;
>   int r;
>
>   pgsize = getpagesize();
>
>   p1 = mmap(NULL, pgsize, PROT_READ | PROT_WRITE,
> 	    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>
>   if (p1 == MAP_FAILED) {
>     perror("mmap p1 failed");
>     exit(1);
>   }
>
>   p2 = mmap(NULL, pgsize, PROT_READ | PROT_WRITE,
> 	    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>
>   if (p2 == MAP_FAILED) {
>     perror("mmap p2 failed");
>     exit(1);
>   }
>
>   *p1 = 2.5;
>   *p2 = 3.5;
>
>   r = mprotect(p1, pgsize, PROT_READ);
>   if (r) {
>     perror("mprotect p1 failed");
>     exit(1);
>   }
>
>   r = mprotect(p2, pgsize, PROT_READ);
>   if (r) {
>     perror("mprotect p2 failed");
>     exit(1);
>   }
>
>   *p2 = *p1;
>
>   asm volatile("" ::: "memory");
>
>   puts("All done!");
>
>   exit(0);
> }
> ------------8<-----------------------
>
> $ mips64-octeon-linux-gnu-gcc -Wall -mhard-float -march=mips64 -O3 -o 
> sigbus sigbus.c
> $ mips64-octeon-linux-gnu-objdump -d sigbus > sigbus.dis
>
> The float copy '*p2 = *p1;' dissassembles as:
>
>    120000b30:	c6400000 	lwc1	$f0,0(s2)
>    120000b34:	e6000000 	swc1	$f0,0(s0)
>
> When run on an FPU-less system I get:
>
> ~ # ./sigbus
> Bus error
>
> When run on my x86_64 workstation:
>
> $ ./sigbus
> Segmentation fault (core dumped)
>
> I will fix this kernel bug.
>

Great!  Thanks!  If you have time to drop a quick note when done, that
would be awesome.

Separately, do you know where I can find pre-built gdb binaries for
mips64, i.e. to debug -mabi=64?  I'm assuming that is the 'official
one' going foward.  (I have an account on the gcc compile farm.)

Thanks so much!

> David Daney
>
>
>
>

-- 
Camm Maguire			     		    camm@maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

  reply	other threads:[~2010-10-21 19:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1OwbkA-0006gv-Bi@localhost.m.enhanced.com>
     [not found] ` <4C93993E.7030008@caviumnetworks.com>
     [not found]   ` <8762y49k1k.fsf@maguirefamily.org>
     [not found]     ` <4C93D86D.5090201@caviumnetworks.com>
     [not found]       ` <87fwx4dwu5.fsf@maguirefamily.org>
     [not found]         ` <4C97D9A1.7050102@caviumnetworks.com>
     [not found]           ` <87lj6te9t1.fsf@maguirefamily.org>
     [not found]             ` <4C9A8BC9.1020605@caviumnetworks.com>
     [not found]               ` <4C9A9699.6080908@caviumnetworks.com>
     [not found]                 ` <87pqvbs7oa.fsf@maguirefamily.org>
     [not found]                   ` <4CB88D2C.8020900@caviumnetworks.com>
     [not found]                     ` <87r5fksxby.fsf_-_@maguirefamily.org>
2010-10-20 16:38                       ` recent SIGBUS/SIGSEGV mips kernel bug David Daney
2010-10-20 21:31                         ` Camm Maguire
2010-10-21 16:19                           ` David Daney
2010-10-21 16:32                             ` Camm Maguire
2010-10-21 17:29                             ` David Daney
2010-10-21 19:07                               ` Camm Maguire [this message]
2010-10-25 20:11                               ` Camm Maguire
2010-10-25 21:32                               ` gdb for mips64 Camm Maguire
2010-10-25 21:45                                 ` David Daney
2010-10-26 12:47                                   ` Maciej W. Rozycki
2010-10-26 17:19                                     ` David Daney
2010-11-01 16:24                                       ` mips and ADDR_NO_RANDOMIZE Camm Maguire
2010-11-01 18:06                                         ` David Daney
2010-11-01 18:24                                           ` Camm Maguire
2010-10-26 14:47                                   ` gdb for mips64 Camm Maguire
2010-10-26 20:12                                     ` [Gcl-devel] " Camm Maguire
2010-10-28 10:50                                       ` Maciej W. Rozycki
2010-10-28 21:28                                         ` Camm Maguire
2010-10-29  7:47                                           ` Maciej W. Rozycki
2010-10-29 15:52                                             ` Camm Maguire
2010-10-30 12:39                                               ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874ocf74aa.fsf@maguirefamily.org \
    --to=camm@maguirefamily.org \
    --cc=ddaney@caviumnetworks.com \
    --cc=debian-mips@lists.debian.org \
    --cc=freddyisaac@gmail.com \
    --cc=gcl-devel@gnu.org \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox