All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Andreas Schwab <schwab@suse.de>
Cc: Helge Deller <deller@gmx.de>, Palmer Dabbelt <palmer@dabbelt.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	Bin Meng <bin.meng@windriver.com>,
	qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [RISC-V] ERROR:../accel/tcg/cpu-exec.c:1028:cpu_exec_setjmp: assertion failed: (cpu == current_cpu)
Date: Tue, 04 Jul 2023 13:02:42 +0100	[thread overview]
Message-ID: <87a5wbhog4.fsf@linaro.org> (raw)
In-Reply-To: <mvmlefwrlt2.fsf@suse.de>


Andreas Schwab <schwab@suse.de> writes:

> I think the issue is that the value returned from brk(0) is no longer
> page aligned.
>
> $ ./qemu-riscv64 -strace ../exe1 
> 18329 brk(NULL) = 0x0000000000303000
> 18329 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,0x3010d0) = -1 errno=2 (No such file or directory)
> 18329 openat(AT_FDCWD,"/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = 3
> 18329 newfstatat(3,"",0x00000040007fe900,0x1000) = 0
> 18329 mmap(NULL,8799,PROT_READ,MAP_PRIVATE,3,0) = 0x0000004000824000
> 18329 close(3) = 0
> 18329 openat(AT_FDCWD,"/lib64/lp64d/libc.so.6",O_RDONLY|O_CLOEXEC) = 3
> 18329 read(3,0x7fea70,832) = 832
> 18329 newfstatat(3,"",0x00000040007fe8f0,0x1000) = 0
> 18329 mmap(NULL,1405128,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x0000004000827000
> 18329
> mmap(0x000000400096d000,20480,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x146000)
> = 0x000000400096d000
> 18329
> mmap(0x0000004000972000,49352,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
> = 0x0000004000972000
> 18329 close(3) = 0
> 18329 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x000000400097f000
> 18329 set_tid_address(0x400097f710) = 18329
> 18329 set_robust_list(0x400097f720,24) = -1 errno=38 (Function not implemented)
> 18329 mprotect(0x000000400096d000,12288,PROT_READ) = 0
> 18329 mprotect(0x0000004000820000,4096,PROT_READ) = 0
> 18329 prlimit64(0,RLIMIT_STACK,NULL,0x00000040007ff4f8) = 0 ({rlim_cur=8388608,rlim_max=-1})
> 18329 munmap(0x0000004000824000,8799) = 0
> 18329 newfstatat(1,"",0x00000040007ff658,0x1000) = 0
> 18329 getrandom(0x4000976a40,8,1) = 8
> 18329 brk(NULL) = 0x0000000000303000
> 18329 brk(0x0000000000324000) = 0x0000000000324000
> 18329 write(1,0x3032a0,12)Hello world
>  = 12
> 18329 exit_group(0)
> $ qemu-riscv64 -strace ../exe1 
> 18369 brk(NULL) = 0x00000000003022e8
> 18369 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,0x3010d0) = -1 errno=2 (No such file or directory)
> 18369 openat(AT_FDCWD,"/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = 3
> 18369 newfstatat(3,"",0x00000040007fe8f0,0x1000) = 0
> 18369 mmap(NULL,8799,PROT_READ,MAP_PRIVATE,3,0) = 0x0000004000824000
> 18369 close(3) = 0
> 18369 openat(AT_FDCWD,"/lib64/lp64d/libc.so.6",O_RDONLY|O_CLOEXEC) = 3
> 18369 read(3,0x7fea60,832) = 832
> 18369 newfstatat(3,"",0x00000040007fe8e0,0x1000) = 0
> 18369 mmap(NULL,1405128,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x0000004000827000
> 18369
> mmap(0x000000400096d000,20480,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x146000)
> = 0x000000400096d000
> 18369
> mmap(0x0000004000972000,49352,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
> = 0x0000004000972000
> 18369 close(3) = 0
> 18369 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x000000400097f000
> 18369 set_tid_address(0x400097f710) = 18369
> 18369 set_robust_list(0x400097f720,24) = -1 errno=38 (Function not implemented)
> 18369 mprotect(0x000000400096d000,12288,PROT_READ) = 0
> 18369 mprotect(0x0000004000820000,4096,PROT_READ) = 0
> 18369 prlimit64(0,RLIMIT_STACK,NULL,0x00000040007ff4e8) = 0 ({rlim_cur=8388608,rlim_max=-1})
> 18369 munmap(0x0000004000824000,8799) = 0
> 18369 newfstatat(1,"",0x00000040007ff648,0x1000) = 0
> 18369 getrandom(0x4000976a40,8,1) = 8
> 18369 brk(NULL) = 0x00000000003022e8
> 18369 brk(0x00000000003232e8)**
> ERROR:../accel/tcg/cpu-exec.c:1028:cpu_exec_setjmp: assertion failed: (cpu == current_cpu)
> Bail out! ERROR:../accel/tcg/cpu-exec.c:1028:cpu_exec_setjmp: assertion failed: (cpu == current_cpu)
> **
> ERROR:../accel/tcg/cpu-exec.c:1028:cpu_exec_setjmp: assertion failed: (cpu == current_cpu)
> Bail out! ERROR:../accel/tcg/cpu-exec.c:1028:cpu_exec_setjmp: assertion failed: (cpu == current_cpu)

And I guess a side effect of this is corrupting QEMU's own memory? I
would have hoped our heap was well away from the guest heap space.

It's a shame the only test cases we have for brk() are specialised ones
for cris and aarch64. This could certainly do with something guarding
the functionality.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-07-04 12:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03  7:52 [RISC-V] ERROR:../accel/tcg/cpu-exec.c:1028:cpu_exec_setjmp: assertion failed: (cpu == current_cpu) Andreas Schwab
2023-07-03 11:55 ` Andreas Schwab
2023-07-03 12:08   ` Alex Bennée
2023-07-03 12:42     ` Andreas Schwab
2023-07-04 10:52       ` Andreas Schwab
2023-07-04 12:02         ` Alex Bennée [this message]
2023-07-09  6:12         ` Helge Deller

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=87a5wbhog4.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=deller@gmx.de \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=schwab@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.