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]
Message-ID: <4992DD63.5080308@kernel.org>
Date:	Wed, 11 Feb 2009 23:14:59 +0900
From:	Tejun Heo <tj@...nel.org>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Brian Gerst <brgerst@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] x86: Pass in pt_regs pointer for syscalls that	need
 it

Ingo Molnar wrote:
> * Tejun Heo <tj@...nel.org> wrote:
> 
>> Hello, Brian.
>>
>> Brian Gerst wrote:
>>> Some syscalls need to access the pt_regs structure, either to copy
>>> user register state or to modifiy it.  This patch adds stubs to load
>>> the address of the pt_regs struct into the %eax register, and changes
>>> the syscalls to regparm(1) to receive the pt_regs pointer as the
>>> first argument.
>> Heh... neat.  Just one question.
>>
>>> -asmlinkage long sys_iopl(unsigned long regsp)
>>> +ptregscall long sys_iopl(struct pt_regs *regs, unsigned int level)
>>>  {
>>> -	struct pt_regs *regs = (struct pt_regs *)&regsp;
>>> -	unsigned int level = regs->bx;
>> Here and at other places where the function takes more than one
>> arguments, wouldn't it be better to just take *regs and use other
>> parameters from regs?  That way we won't have to worry about gcc
>> corrupting register frame at all and I think it's cleaner that way.
> 
> Hm, gcc cannot corrupt register arguments only on-stack arguments - but
> your suggestion nevertheless makes sense as an optimization. I'd suggest
> this to be done as a separate patch though, both for regression analysis
> reasons (easier to bisect - the patch is large enough already) and from
> a size/performance analysis POV. (so we can see the benefits in isolation)

ptregscall is regparm(1) so arguments are on-stack from the second
one, so the callee can corrupt them.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ