18 port_val = inb(PORT_ADDR);
19 printf("Original value of port 0x%x is : %.2x\n", PORT_ADDR, port_val);
20
21 /*reverse the least significant bit */
22
23 outb(port_val^0x01, PORT_ADDR);
24 port_val = inb(PORT_ADDR);
25 printf("Current value of port 0x%x is : %.2x\n", PORT_ADDR, port_val);
26
27 /*set r/w permission of all 65536 ports*/
28
29 ret = iopl(0);
30 if(ret < 0){
31 perror("iopl set error");
32 return 0;
33 }
34 return 0;
35 }
编译:
gcc iopl.c -o iopl
普通用户运行iopl程序,提示没有权限.
/tmp/iopl
iopl set error: Operation not permitted
给程序iopl授权CAP_SYS_RAWIO能力,此时普通用户可以执行iopl程序,如下:
setcap cap_sys_rawio=eip /tmp/iopl
su - test
/tmp/iopl
Original value of port 0x3ff is : 01
Current value of port 0x3ff is : 00
/tmp/iopl
Original value of port 0x3ff is : 00
Current value of port 0x3ff is : 01
二十三)CAP_SYS_CHROOT 18 (允许使用chroot()系统调用)
普通用户不能通过chroot系统调用更改程式执行时所参考的根目录位置,而CAP_SYS_CHROOT可以帮助普通用户做到这一点.
普通用户使用chroot,如下:
/usr/sbin/chroot / /bin/bash
/usr/sbin/chroot: cannot change root directory to /: Operation not permitted
通过root授权CAP_SYS_CHROOT能力给chroot程序,如下:
capset cap_sys_chroot=eip /usr/sbin/chroot
普通用户再次用chroot切换根目录,如下:
/usr/sbin/chroot / /bin/sh
sh-3.2$
linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...旋转锁将在第 10 章进行深入介绍。 如果你对 flags 在传送给 spin_lock_...
linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...内核体系结构的深入了解 442 3.4 Linux 内核的类型 444 3.5 设计和实现的...
下面,在具体深入 linux 内核分析研究之前,需要 对内核中进程相关的几个概念做...具体的实现:Processors typically provide this capability with a mode bit in ...
(HHARM9-EDU实验6中断、 14GPIO/key、AD/DA、I2C等) 进一步深入学习其它的...<linux/major.h> #include <linux/blkdev.h> #include <linux/capability.h...
capability of Linux.Based on the SMP support of Linux,the kernel of Linux...随着对中间件研究的深入,相关的技 术会越来越多,所设计的中间件产品性能会更好...
.c 功能:initializes some of the processor’s interrupt handling capability. ...2005-12-30 28 内容 Linux启动函数分析 X86下的Linux启动分析 ARM下的Linux...
amongallthemethodsofimprovingLinuxrealtimecapability,theprimarywayincludesthinning...本课题针对Linux实时调度策略单一性限帛lJLinux实时应用的情况,深入研 究和分析...
Linux下的Capabilities安全机制分析_IT/计算机_专业资料。Linux下的Capabilities...即将 r00t的特权分割成不同的capabIlIty(本文译为权能),每种 权能代表一定的...
(2008)03—0109—04 ResearchofReaI—TimeCapabilityofEmbeddedLinux0SZHANGZi—qiang...开发难度等方面对两者进行一些深入 的对比,以及分析:3.1实时性能 合前面提到的...
capability.h 147 /linux/elf.h 150 /linux/elfcore.h 156 /linux/errupt.h...(spin-lock)来控制对控制台访问旋转锁将在第10章进行深入介绍 如果你对 flags...
热门文档