Re: [PATCH] x86_64: handle iret faults better

From: Roland McGrath
Date: Mon Apr 25 2005 - 17:34:38 EST


> Why don't you just do
>
> pushl $0
> pushl $do_iret_error
> jmp error_code

I quote from the comment in the code:

We want
* to turn it into a signal. To make that signal's info exactly match what
* this same kind of fault in a user instruction would show, the fixup
* needs to know the trapno and error code. But those are lost when we get
* back to the fixup entrypoint.

The error code is not always 0, it might be a bad segment value. I think
the kernel ought to give accurate information about the fault consistently
no matter where it occurs, so I did not want to pretend the error code is 0.

I certainly think it would be cleaner if the fixup code could access the
fault information directly. However, it's arguably not so clean to have a
do_iret_error function that replicates the work of do_trap and
do_general_protection. The iret case is really not so much a special case
for what to do, but a special case for how you determine whether the
vanilla user-mode thing is done or the vanilla kernel-mode thing is done.


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