|
210 | 210 | /*
|
211 | 211 | * The high bits of the CS dword (__csh) are used for CS_FROM_*.
|
212 | 212 | * Clear them in case hardware didn't do this for us.
|
| 213 | + * |
| 214 | + * Be careful: we may have nonzero SS base due to ESPFIX. |
213 | 215 | */
|
214 | 216 | andl $0x0000ffff, 3*4(%esp)
|
215 | 217 |
|
|
263 | 265 | .endm
|
264 | 266 |
|
265 | 267 | .macro IRET_FRAME
|
| 268 | + /* |
| 269 | + * We're called with %ds, %es, %fs, and %gs from the interrupted |
| 270 | + * frame, so we shouldn't use them. Also, we may be in ESPFIX |
| 271 | + * mode and therefore have a nonzero SS base and an offset ESP, |
| 272 | + * so any attempt to access the stack needs to use SS. (except for |
| 273 | + * accesses through %esp, which automatically use SS.) |
| 274 | + */ |
266 | 275 | testl $CS_FROM_KERNEL, 1*4(%esp)
|
267 | 276 | jz .Lfinished_frame_\@
|
268 | 277 |
|
|
276 | 285 | movl 5*4(%esp), %eax # (modified) regs->sp
|
277 | 286 |
|
278 | 287 | movl 4*4(%esp), %ecx # flags
|
279 |
| - movl %ecx, -4(%eax) |
| 288 | + movl %ecx, %ss:-1*4(%eax) |
280 | 289 |
|
281 | 290 | movl 3*4(%esp), %ecx # cs
|
282 | 291 | andl $0x0000ffff, %ecx
|
283 |
| - movl %ecx, -8(%eax) |
| 292 | + movl %ecx, %ss:-2*4(%eax) |
284 | 293 |
|
285 | 294 | movl 2*4(%esp), %ecx # ip
|
286 |
| - movl %ecx, -12(%eax) |
| 295 | + movl %ecx, %ss:-3*4(%eax) |
287 | 296 |
|
288 | 297 | movl 1*4(%esp), %ecx # eax
|
289 |
| - movl %ecx, -16(%eax) |
| 298 | + movl %ecx, %ss:-4*4(%eax) |
290 | 299 |
|
291 | 300 | popl %ecx
|
292 |
| - lea -16(%eax), %esp |
| 301 | + lea -4*4(%eax), %esp |
293 | 302 | popl %eax
|
294 | 303 | .Lfinished_frame_\@:
|
295 | 304 | .endm
|
|
0 commit comments