Re: PSL_RF inclusion in PSL_USERCHANGE for i386



On Mon, Sep 03, 2007 at 11:18:37AM +1000, Bruce Evans wrote:

On Sun, 2 Sep 2007, Roman Divacky wrote:

in i386/i386/machdep.c the set_regs() function sets i386 registers (called
by ptrace for example). it checks what eflags are being changed and
compares
that with a mask of allowed flags to be changed. the mask is defined in
psl.h
like this:

#define PSL_USERCHANGE (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_T \
| PSL_D | PSL_V | PSL_NT | PSL_AC | PSL_ID)

PSL_RF (Flag to ensure single-step only happens once per instruction.).
Can someone
tell me why this is omitted? I think its because of having in-kernel
debugger.

I think it is just because user mode cannot set this flag directly,
except probably in vm86 mode (vm86 support code already has special
cases for it). (Old) docs say that it can be set by popfl and iret,
but popfl doesn't set it for me now and user mode cannot execute iret (?).
It can. It would result in exception when the normal privilege checks triggers,
but would execute as expected otherwise. For instance,

#include <sys/syscall.h>

.text

.globl main
.type main, @function
main: pushl $12 /* _exit() code */
pushfl
pushl %cs
pushl $2f

iretl

1: movl $SYS_exit, %eax
pushl %eax
int $0x80

2: pushl $hello
call printf
popl %eax
jmp 1b

.size main, . - main

hello: .asciz "Hello from iret\n"

Attachment: pgpAY5vWXBRJ2.pgp
Description: PGP signature



Relevant Pages

  • Re: Processing Bit Fields (flag) that represent request as quickly/efficient as possible...is there
    ... > approach when trying to find flag with in a structure of bit fields. ... > needs to process its logic is contained in the Input Data Stores. ... now what I need to do is determine if a flag for a request has ... mask constants to 32-bit integers; ...
    (comp.lang.c)
  • Re: PSL_RF inclusion in PSL_USERCHANGE for i386
    ... PSL_RF (Flag to ensure single-step only happens once per instruction.). ... but popfl doesn't set it for me now and user mode cannot execute iret. ... CPU that sets PSL_RF for faults (for all faults or only for debug ...
    (freebsd-arch)
  • Re: KSPROPERTY_TYPE_SET cannot return data??
    ... I've never done set-modify-return on the user mode side, ... item and your user mode code. ... Just design your data structure accordingly. ... Is there some flag I am missing on my UM call (this part I do not have ...
    (microsoft.public.development.device.drivers)
  • Re: Scripting the creation of complex Scheduled Tasks
    ... you run a script every hour that has multiple tests. ... If its 8pm on a Mon-Thu, bit 1 of the schedule flag gets set. ... Any task that needs to run 1pm on Friday has bit 2 of its mask set. ...
    (microsoft.public.scripting.vbscript)
  • Re: Trully unique variable in a driver
    ... launched also in user mode (Q flag in bib file)? ... You driver will run in kernel mode by default, unless you specify to load it in user mode. ... Even if you load it in user mode you can assign it to a process group and have all the instances sharing the same process and the same address space and global variables. ...
    (microsoft.public.windowsce.platbuilder)