Re: [PATCH 2.6.21.1] i386: save registers before intra-privilege syscall

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

 



Philipp Kohlbecher wrote:
>>
>> In other words, your patch doesn't actually fix anything, it *masks*
>> potential bugs which would also be triggered by interrupts in kernel
>> mode.  This is bad.
> 
> I am not sure these potential bugs would also be triggered by interrupts
> in kernel mode. After all, kernel_execve is a special case: It is the
> only case (AFAIK) where a software interrupt is generated while in
> kernel mode (intra-privilege interrupt), but (if all goes right) the
> iret "returns" to user mode (inter-privilege return).
> 
> This iret will pop the ss and esp registers off the stack, so
> start_thread (include/asm-i386/processor.h:444) needs to put the correct
> values in these stack positions, which it does.

Yes, and it *BETTER*, because those are user-mode values which refer to
the newly created task.

Sticking kernel mode values in those fields would add no value, except
as a poison (since %ss == KERNEL_DS and would cause a #GP(0) if it ever
reached IRET.)  If anything, those fields should be pushed as zero or
some other poison bits.  That would be slightly better than what's there
now, which is whatever garbage happens to be on the stack.  Pushing the
kernel SS:ESP is just plain wrong (not to mention that the way you do it
doesn't even produce the right value for ESP -- you'd have to save away
ESP before you push SS.)

	-hpa

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux