Linux ELFÎļþ×°ÈëÓëÖ´ÐиÅÊö
ELFÊÇlinuxÖÐʹÓÃ×î¹ã·ºµÄÒ»ÖÖÓ¦ÓóÌÐò¸ñʽ£¬ÎªÁËŪÇå³þLinuxÄÚºËÊÇÈçºÎ½²ELFÎļþ¾«È·Ó³Éäµ½Ö¸¶¨ÄÚ´æ¿Õ¼ä£¬ÉÏÖÜÄ©°ÑÄÚºËsys_execve²¿·ÖºÃºÃ¿´ÁËÒ»±é£¬Ð¡½áÈçÏ£º
1. ELF¸ñʽ
ELFÖ¸¶¨Á˽ø³ÌÖÐtext¶Î¡¢bss¶Î¡¢data¶ÎµÈÓ¦¸Ã·ÅÖõ½½ø³ÌÐéÄâÄÚ´æ¿Õ¼äµÄʲôλÖã¬ÒÔ¼°¼Ç¼Á˽ø³ÌÐèÒªÓõ½µÄ¸÷ÖÖ¶¯Ì¬Á´½Ó¿âµÄλÖá£
2. sys_execveµÄ´óÖÂÖ´ÐÐÁ÷³Ì
1) ´ò¿ªELF¶þ½øÖÆÎļþ£¬¶ÁÈëELFÍ·
2) ɾ³ý´Ó¸¸½ø³Ì¼Ì³Ð¹ýÀ´µÄmmÏà¹ØÄÚÈÝ
3) ¸ù¾ÝELFÍ·½«interpreter¶Î¡¢text¶Î¡¢data¶ÎµÈÓ³Éä½øÄڴ棨ÓÉ´ËÖªlinux²»Ö§³ÖѹËõÁ˵Ķþ½øÖƳÌÐò£©
ÉèÖúöÑÕ»µÈ£¬¸üÐÂmmÄÚÈÝ¡£
4) "αÔì"ºÃ±¾½ø³ÌµÄÄÚºËÕ»£¬Îª½ø³Ì·µ»ØÓû§Ì¬Ö´ÐÐ×öºÃ×¼±¸¡£ÄÚºËÕ»ÖеÄipÖ¸ÏòÁËinterpreter¶ÎÈë¿Ú¡£
5) sys_execveϵͳµ÷Ó÷µ»Øµ½Óû§Ì¬£¬¿ªÊ¼interpreterµÄÖ´ÐУ¨interpreterÒ»°ãΪlinux-ld.so.2 or similar£©
½øÈëµ½Óû§Ì¬ºó£¬interpreter×öÁËЩʲôÄØ£¿
6) interpreter°ïÖúÓû§½ø³Ì×°È붯̬Á´½Ó¿â£¬×öºÃÈ«²¿Öض¨Î»Ó³É乤×÷¡£
7) interpreter·µ»Øµ½main¿ªÊ¼Ö´ÐС£
ÕâÀïÃæÓм¸¸öÎÊÌâÐèÒªÉ£º
1> sys_execve±»µ÷ÓõÄʱºòÄÚºËÕ»³¤Ê²Ã´Ñù£¿Óû§Ì¬²ÎÊýÊÇÈçºÎ´«Èëµ½Äں˵ģ¿
Ö»ÓÐŪÃ÷°×ÁËÕâ¸öÎÊÌ⣬²ÅÖªµÀÈçºÎ´ÓÄں˷µ»Øµ½interpreterÈë¿Ú¿ªÊ¼Ö´ÐÐ
A: ¹ØÓÚÕâ¸öÎÊÌâÇë²Î¿¼linuxϵͳµ÷ÓÃÏà¹ØÕ½ڡ£linuxϵͳµ÷ÓòÉÈ¡ÁËÒ»¸öÒ»Öµķ½·¨À´´¦Àíϵͳµ÷ÓòÎÊýÎÊÌ⣬·Ç³£ÖµµÃ½è¼ø£¬½«ÁíÍâ׫ÎÄÊáÀíÆäÉè¼Æ˼·¡£
2> interpreterµÄ²ÎÊý´ÓÄÄÀïÀ´£¿interpreterÈçºÎ·µ»Øµ½main£¿
A: Èç¹û´Ó´«Í³µÄCÓïÑÔº¯Êýµ÷ÓõĽǶÈÀ´Àí½â£¬Õâ¸öÎÊÌâ»áºÜ·Ñ½â¡£µ«ÊÇÈç¹ûÄÜ´Ó»ã±àµÄ½Ç¶È£¬¶¯Ì¬µØ¡¢ÓÐÄ¿µÄµØµ÷ÕûºÍ"αÔì"µ÷ÓÃÕ»£¬¾ÍÄܹ»×öµ½·½±ãµØÔÙ¸÷¸öº¯Êý¼äÇл»ºÍ´«²Î¡£
Äں˻ṹÔìºÃinterpreterËùÐèÒªµÄ²ÎÊýÕ»£¬interpreter»á¹¹ÔìºÃmainËùÐèÒªµÄ²ÎÊýÕ»¡£Óû§Õ»ÊÇÔÚsetup_arg_pagesº¯ÊýÖй¹½¨µÄ¡£
3> ÄÚºËÊÇÈçºÎ±£Ö¤½«¸÷¸ö¶ÎÓ³Éäµ½ÆÚÍûµÄλÖÃ?
mmapº¯ÊýÓÐÒ»¸ö²ÎÊýÈ¡MAP_FIXED²ÎÊý¼´¿É¡£
±Ê¼Ç¸½ÎÄ£º
/* ½«µ±Ç°(current)µÄmm½á¹¹Ìæ»»³É²ÎÊýÖеÄmm½á¹¹¡£±¾º¯Êý±»
* int flush_old_exec(struct linux_binprm * bprm)µ÷Óá£
* ¾Émm±»É¾³ý¡£
*/
stati
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍ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 ......
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
µÈ´ý¶ÓÁÐÔÚÄÚºËÖкܶàÓÃ;£¬ÓÈÆäÓÃÔÚÖжϴ¦Àí¡¢½ø³Ìͬ²½¼°¶¨Ê±¡£µÈ´ý¶ÓÁÐʵÏÖÁËÔÚʼþÉϵÄÌõ¼þµÈ´ý£ºÏ£ÍûµÈ´ýÌض¨Ê¼þµÄ½ø³Ì°Ñ×Ô¼º·Å½øºÏÊʵĵȴý¶ÓÁУ¬²¢·ÅÆú¿ØÖÆȨ¡£Òò´Ë£¬µÈ´ý¶ÓÁбíʾһ×é˯ÃߵĽø³Ì£¬µ±Ä³Ò»Ìõ¼þ±äΪÕæʱ£¬ÓÉÄں˻½ÐÑËüÃÇ¡£
µÈ´ý¶ÓÁÐÓÉË«ÏòÁ´±íʵÏÖ£¬ÆäÔªËØ°üÀ¨Ö¸Ïò½ø³ÌÃèÊö·ûµÄÖ¸Õ롣ÿ¸ö¶ÓÁж¼ÓÐÒ»¸ö ......
linux Äں˷ÖÎöÖ®list_head
±¾ÎÄÏêϸ·ÖÎöÁË 2.6.x ÄÚºËÖÐÁ´±í½á¹¹µÄʵÏÖ£¬²¢Í¨¹ýʵÀý¶Ôÿ¸öÁ´±í²Ù×÷½Ó¿Ú½øÐÐÁËÏ꾡µÄ½²½â¡£
Ò»¡¢ Á´±íÊý¾Ý½á¹¹¼ò½é
Á´±íÊÇÒ»ÖÖ³£ÓõÄ×éÖ¯ÓÐÐòÊý¾ÝµÄÊý¾Ý½á¹¹£¬Ëüͨ¹ýÖ¸Õ뽫һϵÁÐÊý¾Ý½ÚµãÁ¬½Ó³ÉÒ»ÌõÊý¾ÝÁ´£¬ÊÇÏßÐÔ±íµÄÒ»ÖÖÖØҪʵÏÖ·½Ê½¡£Ïà¶ÔÓÚÊý×飬Á´±í¾ßÓиüºÃµÄ¶¯Ì¬Ð ......