[PATCH] Add support for Altera's Nios-II softcore architecture

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Sat Apr 25 20:29:36 UTC 2015



On 04/25/2015 01:00 PM, Ezequiel Garcia wrote:
[..]
> 
> Then, we have a test failing randomly. Yes, that's right: randomly.
> For instance, the statfs test seem to pass occassionally, but sometimes
> it fails!
> 
> # strace ./strace-master/tests/statfs 
> [..]
> statfs64("/proc/self/status", 84, {f_type=0x37f8, f_bsize=9016, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=4128}) = 0
> 
> However, this doesn't seem to be an issue with the syscall itself, but with
> either strace or the ptrace implementation.
> 

After some digging...

This doesn't seem to be a problem with the statfs64 syscall itself, or at least
the statfs test program always get proper results.

However, when the test is ptrace'd, the data is occassionaly wrongly obtained
(either using process_vm_readv or a PEEK_DATA request).

A small hack in statfs.c which retries the call to umoven() if the
f_type value was wrong, workarounds the issue:

  static void
  printstatfs64(struct tcb *tcp, long addr)
  {
  [..]
  try_again:
          if (umove(tcp, addr, &statbuf) < 0) {
                  tprints("{...}");
                  return;
          }
          if (statbuf.f_type != 0x9fa0)
                  goto try_again;

I'm inclined to think this shows some problem on the kernel side, and not
on the strace port.

Same goes for the PC test, if the si_addr is bogus (see Andreas reply) then
it would indicate an issue in the kernel signal handling. Something like
this makes the test pass, but I'm pretty sure it's not fixing the real problem:

diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c
index 0c9b6af..64f0795 100644
--- a/arch/nios2/mm/fault.c
+++ b/arch/nios2/mm/fault.c
@@ -190,7 +190,7 @@ bad_area_nosemaphore:
 				"cause %ld\n", current->comm, SIGSEGV, address, cause);
 			show_regs(regs);
 		}
-		_exception(SIGSEGV, regs, code, address);
+		_exception(SIGSEGV, regs, code, regs->ea);
 		return;
 	}

In any case, all these issues are unrelated to the strace Nios-II port.
Quite the opposite, I'd say the strace port will be useful to spot these kind
of issues.
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150425/3cd9d706/attachment.bin>


More information about the Strace-devel mailing list