Re: How change process flags from userland?
Hi, I resolve this problem (thanks Julian Elischer for his thoughts): === int fd; int cnt; off_t off; void *p; kvm_t *kd; struct kinfo_proc *kip; struct proc *p_mmap; kd = kvm_open(NULL, _PATH_MEM, NULL, O_RDONLY, NULL); kip = kvm_getprocs(kd, KERN_PROC_PID, pid, cnt); fd = open(_PATH_KMEM, O_RDWR, 0); off = (off_t)((uintptr_t)kip-ki_paddr); p = mmap(0, sizeof(struct proc), PROT_READ | PROT_WRITE, MAP_SHARED, fd, off); p_mmap = (struct proc *)p; p_mmap-p_flag |= P_PROTECTED; ... === I wrote daemon [1] that set P_PROTECTED flag for applications. May be it useful for someone. [1] http://zonov.pp.ru/pprotectd/pprotectd.tbz -- Andrey Zonov 2010/6/30 Andrey Zonov andrey.zo...@gmail.com: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: How change process flags from userland?
On 30.06.2010 10:26, Andrey Zonov wrote: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? Did you try sysutils/scprotect? -- WBR, Andrey V. Elsukov signature.asc Description: OpenPGP digital signature
Re: How change process flags from userland?
On 30 June 2010 10:26, Andrey Zonov andrey.zo...@gmail.com wrote: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? May be madvise(NULL, 0, MADV_PROTECT) will fit your needs? (see howto example in usr.sbin/cron). Note, this behav isn't portable. -- wbr, pluknet ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: How change process flags from userland?
On 30 June 2010 11:33, pluknet pluk...@gmail.com wrote: On 30 June 2010 10:26, Andrey Zonov andrey.zo...@gmail.com wrote: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? May be madvise(NULL, 0, MADV_PROTECT) will fit your needs? (see howto example in usr.sbin/cron). Note, this behav isn't portable. Ahem, please ignore my post. -- wbr, pluknet ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: How change process flags from userland?
Yes, but I want change process flags without kernel hacking/loading modules or modification applications. Andrey V. Elsukov пишет: On 30.06.2010 10:26, Andrey Zonov wrote: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? Did you try sysutils/scprotect? -- Andrey Zonov ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: How change process flags from userland?
On 6/30/10 11:23 AM, Andrey Zonov wrote: Yes, but I want change process flags without kernel hacking/loading modules or modification applications. you are going to have to do one of those. The only alternative is that if you have root you can modify a processe's flags using gdb and /dev/kmem. you could use a program to do it specially if you have root, but if that's not what you want then you will need to add a syscall to do what you want as far as I can see. Andrey V. Elsukov пишет: On 30.06.2010 10:26, Andrey Zonov wrote: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? Did you try sysutils/scprotect? ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: How change process flags from userland?
Can you explain how change flags with /dev/kmem? kvm_write(3) not work for this. Julian Elischer пишет: On 6/30/10 11:23 AM, Andrey Zonov wrote: Yes, but I want change process flags without kernel hacking/loading modules or modification applications. you are going to have to do one of those. The only alternative is that if you have root you can modify a processe's flags using gdb and /dev/kmem. you could use a program to do it specially if you have root, but if that's not what you want then you will need to add a syscall to do what you want as far as I can see. Andrey V. Elsukov пишет: On 30.06.2010 10:26, Andrey Zonov wrote: Hi, I want to set P_PROTECTED flag for some daemons after it start, without patching application and kernel. It possible? Did you try sysutils/scprotect? -- Andrey Zonov ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org