* [9fans] acid hack
@ 2011-10-26 0:30 erik quanstrom
0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2011-10-26 0:30 UTC (permalink / raw)
To: 9fans
i was having some trouble with a user program that was setting
Proc.debugmem. for various reasons it was easier to hack the
kernel than hack the program in question. so i thought i'd
just get into the kernel and set Proc.debugmem = 0.
obviously, this doesn't work out-of-the-box, so i modified the
kernel a bit to allow writes. (relax, it's normally compiled out ☺)
and it was easy enough to write a bit of acid
p = (Proc)procalloc.ht[mypid % 128]
while(p != 0 && p.pid != mypid) do p = p.pidhash
but how to set p.privatemem=0? a first cut was to take
p\X + y
where y was determined by grepping around in the kernel acid
file. but this really is ugly, and hard to hand off to somebody else
as a "solution". since -> is something wierd and . is taken, i used
the syntax
x·y ≡ x\X + y
where y is the same value as before, e.g. offsetof(Proc, privatemem)
so now i can say
*(p·privatemem) = 0
before jeering too much, consider that this also allows one to set
aggr members in user programs. if you've got another solution that
looks better, doesn't require a rune, etc. i'd be happy to hear it.
so perhaps i'll define the "acid prize". 5 euros to the first person
to post a convincingly improved approach to the list.
- erik
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-26 0:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-26 0:30 [9fans] acid hack erik quanstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).