Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2015 17:04:12 +1100
From:      Peter Jeremy <peter@rulingia.com>
To:        freebsd-arm@freebsd.org
Subject:   read(2) into some addresses doesn't return data on RPi
Message-ID:  <20150110060412.GE77914@server.rulingia.com>

next in thread | raw e-mail | index | archive | help

--dc+cDN39EJAMEtIO
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Trying to access the boot partition using mtools consistently fails on my
RPi because the kernel is returning NULs for the first sector.  The second
sector is correct.  If I use dd(2) then the expected data is returned.

This is running 11-current r276818 (but ISTR seeing it on older kernels).

I did some digging and found that read(2)s of the SD card device return
successful but do not actually write anything to the buffer for some
addresses (and they happen to contain all NULs in mtools).  This doesn't
appear to affect reads of normal files.

Running the attached program on /dev/mmcsd0s1 gave me the following results:
- There are no partial reads.  Either all 512 bytes are updated or none are.
- There are two blocks of addresses 0xbfff0e00 thru 0xbfff0e00 and 0xbfff2e=
00
  thru 0xbfff2e00 where reads work on a 32-byte alignment but not otherwise.
- Reads consistently fail between 0xbfff1e08 and 0xbfff1ff8
- Reads consistently fail between 0xbfff3e08 and 0xbfff3f?? (I got a hang).
- The program never completes.  In 3 runs, I've gotten:
  - panic: null_fetch_syscall_args
  - kernel hang
  - panic: malloc: bad malloc type magic
  I don't have a serial console and so can't debug kernel panics.

Putting that together, it seems to related to accesses that aren't cache-li=
ne
aligned and cross page boundaries but I'm not sure why it behaves different=
ly
at different page boundaries.  The hangs/panics suggest that it's writing to
random other kernel addresses instead.

Does this ring a bell for anyone?

--=20
Peter Jeremy

--dc+cDN39EJAMEtIO
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQJ8BAEBCgBmBQJUsMDcXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFRUIyOTg2QzMwNjcxRTc0RTY1QzIyN0Ux
NkE1OTdBMEU0QTIwQjM0AAoJEBall6Dkogs05dAP/igwOX4g8cQh0+wjk4CV2n4R
qCLSA1ZUEV15Nwf5N7yx0CZWM2uuUmE/p5IzWXTa9JIorQB5Nj5212R0nKT29UDW
Tv2u6yWD9Oyvhw4AQPqyXm8rRDq0CrIi+CWnSPIMTZ3weeiwRCkXU8Z3u5u0Gp96
7uJ0zU6wBMWbrO2f1M2iJGDpBMpdFd56LD/dWAHIp96/an9oWVYBEdTYvXNpdBkH
FCRQ4gA3jxuKGI2MmrRcGscBj9aj/pSxOwJSo5xE5VRHjQyq0Y6RPUnAadQIYEjB
N2nvquJytbiroXYmdfH6L+Y35lw/QtsDZX5TXBevk9yiFG6xoeJ+iQ8VBspnjKat
yUzaUF5FdY8FwXXqhOh9Ku4UoamvDqOKRWy/i2Z5ARJwkt+CIQ2GeipsSSJsJf22
L4rxTUUvpT/kDadcM0F9b/n4/hGTacUkDypzw6uZMExBVIuJYa2HmF8sLj1nP467
hh1uN68k4bh2iH7hUb1oQU7eLrk2cFBLunvq8MX2EwZY4FLk42sEMTpTROjwwAJ1
9HkerOVdvbTUHzXFGETJlSgZt9YW1UCRaa/Nb3NIFhBx+SXuzKhWvMgPC/iAOmQn
AeAtLWa+wJqKTvDjEKsmFi3Sr00hhVssIEnLJ54aJnEnL5u+3eBCrDYaceewVB76
pVh+mST8Q3aYZyM9uNuV
=2LCF
-----END PGP SIGNATURE-----

--dc+cDN39EJAMEtIO--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150110060412.GE77914>