lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Jun 2016 14:38:15 +0300
From:	Dmitry Safonov <dsafonov@...tuozzo.com>
To:	Oleg Nesterov <oleg@...hat.com>
CC:	<linux-kernel@...r.kernel.org>, <mingo@...hat.com>,
	<luto@...capital.net>, <tglx@...utronix.de>, <hpa@...or.com>,
	<x86@...nel.org>, <0x7f454c46@...il.com>, <gorcunov@...nvz.org>,
	<xemul@...tuozzo.com>, <khorenko@...tuozzo.com>,
	Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH 5/6] x86/ptrace: down with test_thread_flag(TIF_IA32)

On 06/07/2016 12:19 AM, Oleg Nesterov wrote:
> On 06/01, Dmitry Safonov wrote:
>>
>> Note, that this will work only if application has changed it's CS.
>
> So, suppose it changes it's CS and crashes,
>
>> If the application does 32-bit syscall with __USER_CS, ptrace
>> @@ -1355,7 +1355,7 @@ void update_regset_xstate_info(unsigned int size, u64 xstate_mask)
>>  const struct user_regset_view *task_user_regset_view(struct task_struct *task)
>>  {
>>  #ifdef CONFIG_IA32_EMULATION
>> -	if (test_tsk_thread_flag(task, TIF_IA32))
>> +	if (!user_64bit_mode(task_pt_regs(task)))
>>  #endif
>
> then coredump will do fill_elf_header(view->e_machine) and use EM_X86_64
> instead of EM_386, or vice versa...
>
> I simply can't understand is this better or worse, I guess gdb or any
> other tool which looks at this coredump will be confused anyway.

Oleg, thanks for your reply!

At least, gdb will have all registers at that moment.
Firstly, I did it for returning with GET_REGSET corresponding
register set. So ptrace-attaching to a task with 64-bit code
selector would return 64-bit register set and contrariwise.
(as task may use all 64-bit registers, that seems logical
for me even if it has been loaded as 32-bit ELF)

And for coredump -- I guess it will show full register set
on the crash moment and show proper disasm around that place.
And for my purpose -- that's really what I need, to generate
32-bit ELF core file on crash after changing CS.

I did it for C/R of 32-bit application with changing code
selector from 64-bit. So last thing restorer does - unmap
itself (it's pie blob) and sigreturn to application.
So if the application crashes after it - it will be good
to have 32-bit coredump as for the original application.

Thanks,
Dmitry Safonov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ