tech-kern archive

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

Re: re-enabling debugging of 32 bit processes with 64 bit debugger

On 01.07.2019 17:06, Andrew Cagney wrote:
> On Mon, 1 Jul 2019 at 10:06, Kamil Rytarowski <> wrote:
>> On 01.07.2019 16:01, Christos Zoulas wrote:
>>> In article <qfd1sp$9bj$>,
>>> Michael van Elst <> wrote:
>>>> (Christos Zoulas) writes:
>>>>> We can fill them completely with 0 as we pad with 0 the 32 bit
>>>>> part of the 64 bit registers that does not exist in a 32 bit
>>>>> process.
>>>> The corefile pretends to be a 32bit file, so the register
>>>> section should probably be similar to a coredump of a
>>>> 32bit system.
>>>> N.B. two registers were not zero padded, a temporary and the 'hi'
>>>> register. So I don't think there is padding (or truncating)
>>>> done.
>>> I have not looked at the core file, I was referring to what should be
>>> returned by PT_GETREGS in the 64 bit tracer 32 bit tracee case.
>>> christos
>> From a debugger point of view, native struct reg, that is on the kernel
>> side adapted (truncated registers) for 32bit tracee
> Right, a 64-bit ptrace() interface must return 64-bit structures.  I'd
> start with that, test it and see what breaks.
> However, beyond that, the main thing is for all parties to play nice.
> In general:
> - when reading values the debugger is converting 64-bit raw values to
> the 32-bit ISA
> - when storing values the debugger should be writing to the full
> 64-bit ISA register
> - and the kernel should kindly do the same thing
> But wait, and this is where everyone gets to play nice.  There's
> likely some obscure edge case where the kernel needs to leak a full
> 64-bit register value so that some feature works - perhaps h/w debug
> registers, perhaps not.

Debug Registers use the same registers and almost the same bits since
80386. Control and Status register is meaningful for least significant
32 bits only.

We just need to validate that address in DR0-4 is within the 32bit
address space.

> Andrew

Attachment: signature.asc
Description: OpenPGP digital signature

Home | Main Index | Thread Index | Old Index