bug-ddrescue
[Top][All Lists]
Advanced

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

Re: [Bug-ddrescue] Alignment of I/O buffer for direct disk access could


From: Antonio Diaz Diaz
Subject: Re: [Bug-ddrescue] Alignment of I/O buffer for direct disk access could fail on some memory addresses?
Date: Mon, 04 Jan 2016 20:16:23 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.8.1.4) Gecko/20070601 SeaMonkey/1.1.2

Hello again,

Heikki Tauriainen wrote:
To protect the code from a buffer alignment failure whose occurrence depends on the buffer's address (which is not guaranteed to remain consistent between invocations of the program), I think it would be safer to compute "disp" using unsigned arithmetic on an integral type
large enough to hold the address of the buffer.

The problem is that the C++ standard does not guarantee that such integral type exists in all implementations. 'intptr_t/uintptr_t' are optional in C++11 and do not exist in C++03. (The alignment code of ddrescue was written in 2005).

I have released version 1.21-pre3 using a cast to 'unsigned long long', a type already used by ddrescue that most probably will be able to contain the pointer value.


Alternatively, the program could (as a sanity check) abort with an
error in case the buffer cannot be adjusted to a multiple of the
sector size for direct disk access, or give more debug information
about the failing read(2) requests, instead of failing silently in
this case.

In a few days I'll add some code to make ddrescue exit on EINVAL and report an error.


Thanks again,
Antonio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]