From: erik quanstrom <quanstro@labs.coraid.com>
To: 9fans@9fans.net
Subject: [9fans] acid hack
Date: Tue, 25 Oct 2011 20:30:39 -0400 [thread overview]
Message-ID: <bcb90c08dfecd770f70cc314a4d09bc3@coraid.com> (raw)
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
reply other threads:[~2011-10-26 0:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bcb90c08dfecd770f70cc314a4d09bc3@coraid.com \
--to=quanstro@labs.coraid.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).