获取Linux 2.6.x sys_call_table
在linux中所有的syscall都是调用int 0x80, int 0x80的中断服务程序为system_call(arch/x86/kernel/traps_32.c:set_system_gate(SYSCALL_VECTOR,&system_call). system_call (arch/x86/entry_32.S)最终call *sys_call_table(,%eax,4)来完成一个syscall调用.
即 int 0x80 -> system_call -> sys_call_table, 这样我们只要首先获取int 0x80的中断服务地址system_call地址, 然后在system_call代码中直接搜索call指令即可找到sys_call_table地址了!
另一种方法就是直接修改
通过cat /boot/System.map-`uname -r` |grep sys_call_table 查看当前sys_call_table地址,并与通过以上方法取得的地址做比较!
内核版本: ubuntu 2.6.24-19-server
/*
* Standard in kernel modules
*/
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/module.h> /* Specifically, a module, */
#include <linux/moduleparam.h> /* which will have params */
#include <linux/unistd.h> /* The list of system calls */
/*
* For the current (process) structure, we need
* this to know who the current user is.
*/
#include <linux/sched.h>
#include <asm/uaccess.h>
unsigned long *sys_call_table = 0;
//EXPORT_SYMBOL ( sys_call_table );
struct {
unsigned short limit;
unsigned int base;
} __attribute__ ( ( packed ) ) idtr;
struct {
unsigned short offset_low;
unsigned short segment_select;
unsigned char reserved, flags;
unsigned short offset_high;
} __attribute__ ( ( packed ) ) * idt;
unsigned long* find_sys_call_table(void)
{
unsigned long system_call = 0; // x80中断处理程序system_call 地址
char *call_hex = "\xff\x14\x85"; // call 指令
char *code_ptr = NULL;
 
相关文档:
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......
Linux 内核启动分析
1. 内核启动地址
1.1. 名词解释
ZTEXTADDR
解压代码运行的开始地址。没有物理地址和虚拟地址之分,因为此时MMU处于关闭状态。这个地址不一定时RAM的地址,可以是支持读写寻址的flash等存储中介。
Start address of decompressor. here's no point ......
一、GCC (最最常见:gcc hello.c –o hello) ①常用选项 -c:仅对源文件进行编译
-o:对生成的代码进行优化,有0,1,2,3四个等级,默认为2
-g:加入调试信息
-I dir:编译源文件是增加一个搜索库文件的目录
-w:禁止所有警告
-W warning:允许 ......
在linux中,当我们因为需要新添加一块硬盘,或者是我们swap交换分区空间不够,需要增加,我们怎么来处理呢?首先,找一块新硬盘,在断电的情况下接入,启动计算机,接就进行如下操作:
一、新增磁盘分区、格式化
首先用fdisk -l 查看新增硬盘的盘符,例如/dev/sdb;
将其分成三个区:
#fdis ......