sales are assholes, engineers are dicks. assholes always ask dicks to
do dirty things, when it's done, assholes are happy, while engineers
are covered with shit all over them.
sale: "please modify this driver, make it not work on other OS."
me: "why?"
after 0.1 second...
me: "i see."
me: "where is the source code?"
sale: "no source code"
me: "i cannot modify the binary without the source code."
sale: "can you just hide the driver somewhere?"
me: "they will find it anyway."
sale: "anyway, i just want it tomorrow."
me: "OK, let me think what i can do."
OK, basic knowledge of linking and ELF is not totally useless. here is how to do that:
support the original driver is foo.ko,
1. rename the __this_module to something else (e.g. __THIS_module)
2. write some code to replace the original __this_module symbol:
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = __stringify(KBUILD_MODNAME),
.init = new_module_init,
.exit = cleanup_module,
};
3. in new_module_init(), check if OS is ours, if NOT, puke. otherwise, call the original module_init():
static int is_ax(void)
{
if (strstr(system_utsname.release, "AX") == NULL)
return 0;
else
return 1;
}
static int new_module_init(void)
{
int err = -1;
if (is_ax())
err = original_init();
return err;
}
4. link foo.ko with the code generated in step 2 and 3. build a new driver module.
that's it. simple and evil.
when you dive deep into technical issues, the notion of ethic simply disappears, so you wont go crazy.
阅读(2350) | 评论(3) | 转发(1) |