[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with hfsprogs on G5 Power Macs



On 1/7/19 21:57, Mark Cave-Ayland wrote:
On 07/01/2019 19:57, Frank Scheiner wrote:
root@powermac-g5:~# gdb --args /sbin/fsck.hfs -d /dev/sda2
GNU gdb (Debian 8.2-1) 8.2
[...]
Reading symbols from /sbin/fsck.hfs...done.
(gdb) run
Starting program: /sbin/fsck.hfs -d /dev/sda2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1".
** /dev/sda2
     Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
** Checking HFS volume.

Program received signal SIGSEGV, Segmentation fault.
0x0000000100034be4 in hfs_swap_HFSBTInternalNode (src=0x7fffffffd378,
fcb=0x100081898, direction=kSwapBTNodeBigToHost) at hfs_endian.c:883
883    hfs_endian.c: No such file or directory.
(gdb) bt
[...]
Interesting. So line 883 appears to be:

  nextRecord = (char *)src->buffer + srcOffs[i-1];

Certainly there is some interesting pointer arithmetic going on there (and if i == 0
then you're reading something before src->buffer). Can you try the following commands
in gdb:

p src
p srcDesc
p srcOffs
p sizeof(UInt16)

Here you go:

```
[...]
(gdb) run
Starting program: /sbin/fsck.hfs -d /dev/sda2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1".
** /dev/sda2
	Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
** Checking HFS volume.

Program received signal SIGSEGV, Segmentation fault.
0x0000000100034be4 in hfs_swap_HFSBTInternalNode (src=0x7fffffffd3a8, fcb=0x100081898, direction=kSwapBTNodeBigToHost) at hfs_endian.c:883
883	hfs_endian.c: No such file or directory.
(gdb) p src
$1 = (BlockDescriptor *) 0x7fffffffd3a8
(gdb) p srcDesc
$2 = (BTNodeDescriptor *) 0x7ffff5c91200
(gdb) p srcOffs
$3 = (uint16_t *) 0x7ffff5c913fe
(gdb) p sizeof(UInt16)
No symbol "UInt16" in current context.
[...]
(gdb) p sizeof(uint16_t)
$4 = 2
```

Cheers,
Frank


Reply to: