accessing files from kld module

2001-06-27 Thread Eugene L. Vorokov
Hi, probably this question was asked here many times before, but I'm new to kernel mode hacks ... Is it somehow possible to access files from my kld module ? I have seen functions like printf(), MALLOC() for kernel mode, but nothing like open() ... using open() syscall directly seems impossible t

allocating user space memory from kernel mode

2001-06-28 Thread Eugene L. Vorokov
Hello, is it possible to allocate and then maybe free memory in user space from kernel mode, if I have struct proc of the process that memory should belong to ? What is the easiest and safest method of doing this ? I have seen some example that uses obreak(), but that seems very tricky and suspic

Re: TCP Problems in 4.3 ?

2001-07-02 Thread Eugene L. Vorokov
> I use "LPRng 3.6.20" and openssh on the 4.3 box, lpd-server is on a 4.1 box. > Issuing 4-5 lpq's in a minute gives "Connection timed out". > First i thought it may be a problem with LPRng, but scp'ing large files > doesnt work anymore, too. Even ssh hangs sometimes. > I tried to disable the "new

catching ip packets from module

2001-07-02 Thread Eugene L. Vorokov
Hello, can please someone enlighten me how can a module catch ip packets before they actually enter the stack, the way ipfw or ipf does ? I tried to look at the sources, but ipfw seems to do it some very specific way which is based on some in-kernel hacks to make it possible (ofcourse correct me

Re: TCP Problems in 4.3 ?

2001-07-02 Thread Eugene L. Vorokov
> On Mon, Jul 02, 2001 at 03:53:53PM +0400, Eugene L. Vorokov wrote: > > > I use "LPRng 3.6.20" and openssh on the 4.3 box, lpd-server is on a 4.1 box. > > > Issuing 4-5 lpq's in a minute gives "Connection timed out". > > > First i thought

kernel panic when trying to use init's address space

2001-07-05 Thread Eugene L. Vorokov
Hello, Some time ago I was asking about I/O in kernel mode when I don't have struct proc to use syscalls. Actually I just wanted my kld to read it's config file on load. Terry told me it's tricky, and I was thinking about possible workarounds. I decided to try the following: look for some process

Re: LIST_NEXT()

2001-07-06 Thread Eugene L. Vorokov
> Hello, > > I'm writing a kernel module, and it involves traversing the proc list searching for >the right structure, > however, when I use SLIST_NEXT(p, p_list) in the program, I get a warning when I >compile it: > > warning: statement with mo effect > > What am I doing wrong? I've read th

Re: kernel panic when trying to use init's address space

2001-07-06 Thread Eugene L. Vorokov
> On Thu, Jul 05, 2001 at 02:59:17PM +0200, Bernd Walter wrote: > > You are mmaping into the address space for the process you use the > > struct proc from. > > As long as it's this programm that is curproc everything is fine. Okay, I understand what the problem is. But what if I still want to si

panic when returning error on MOD_LOAD

2001-07-08 Thread Eugene L. Vorokov
Hello, I'm pretty confused with the fact that kernel panics when my module's event handler returns something greater than zero on MOD_LOAD. I wanted module to refuse to load when it can't find it's config file, so I thought I can return error code and it will not be loaded, and behaviour of modul

Re: Some questions about kernel programming

2001-07-12 Thread Eugene L. Vorokov
Forgot to Cc: here: > You can't call kernel strlen on a userland address, you must do > something like this: How so ? It seems to work for me. For instance, I used userland address space buffer to simulate __getcwd() syscall on the current process (I was hacking open() syscall and log full path

Re: Some questions about kernel programming

2001-07-13 Thread Eugene L. Vorokov
> /* > * return number of characters in a userland address string > * or -1 if an illegal access occurs. > */ > int > user_strlen(uaddr) > char *uaddr; > { > int ret; > > ret = -1; > do { > ch = fubyte(uaddr); > ret++; > } while (ch !=

Re: Some questions about kernel programming

2001-07-13 Thread Eugene L. Vorokov
> ch = fubyte(uaddr); And one more question, does this mean that I can't use things x = *uaddr and *uaddr = x for userspace, but always have to use fubyte() and subyte () ? If so, what is the reason it was done like that ? Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTE

Re: DDB & mp3's

2001-07-15 Thread Eugene L. Vorokov
> diman wrote: > > > > Hi, folks. > > When I switch to DDB to check something or debug something > > usefull, mp3 player process (mpg123) hangs up and dissonate > > me. So guys how do you do in such a case? I'm shure that > > I'm not one having such a problem. ;-) > > > > Maybe someone has allre

disabling reboot on kernel panic

2001-07-17 Thread Eugene L. Vorokov
Hello, maybe it's a bit offtopic, but still: how can I disable reboot on kernel panic in 15 seconds, so that it just hangs and I'm able to see what happened when I come ? Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the messag

Re: KLD Programming

2001-07-18 Thread Eugene L. Vorokov
> > Yes. But it is not easy. Look at code vfs_vnops.c. You can let a user > process open a file and then push the file descriptor into kernel via a > special system call. Search the mailing list archive and you will find > discussions on how to add a new system call. > Well, if you aren't going

KLD parameters

2001-07-18 Thread Eugene L. Vorokov
Hello, it seems that I can't pass any parameters to a KLD module when I load it (i.e., some command line). Am I missing something, or if not, why is it like that, on purpose or just no one was willing to implement that ? Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsu

using syscalls in a module (stack problem ?)

2001-07-22 Thread Eugene L. Vorokov
Hello, using my ugly hack to do file i/o from a module, I discovered some problem calling mmap() from a function with a lot of local buffers defined. I have: char * pizda_malloc(struct proc *p, int size) { struct mmap_args mem; int res; register_t save; char *buf; save = p->p_retval[0]; mem.

Re: using syscalls in a module (stack problem ?)

2001-07-23 Thread Eugene L. Vorokov
> > I call this function with (curproc, PATH_MAX+1), and everything is fine > > when I have just a few local variables defined in the caller (it all > > works on MOD_LOAD only). However, if I have 2 buffers, 4096 bytes each, > > as local variables and then try to allocate userspace memory the same

Re: calling kernel functions

2001-07-24 Thread Eugene L. Vorokov
> Thank you very much for the help so far > the functions open() and write() expect there arguments to be in user space > and not kernel space, which is what I was doing wrong. My question is, how > then would you go about opening and editing a file from the kernel? > > To Unsubscribe: send mail

Re: ARP cache problems....

2001-07-26 Thread Eugene L. Vorokov
> Things seem to work fine now, but I still get a lot of those: > > "Jul 26 00:43:48 test256m /kernel: arp: 192.168.1.4 is on sis0 but got > reply from 00:a0:cc:a0:d4:07 on sis1" > > Anybody know how to turn them off ? Yes, I have this problem too. We use several interfaces with totally differe

Re: ARP cache problems....

2001-07-26 Thread Eugene L. Vorokov
> > Anybody know how to turn them off ? > > sysctl net.link.ether.inet.log_arp_wrong_iface ? vel@bugz:/home/vel # sysctl net.link.ether.inet.log_arp_wrong_iface sysctl: unknown oid 'net.link.ether.inet.log_arp_wrong_iface' Huh ? Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED]

Re: ARP cache problems....

2001-07-26 Thread Eugene L. Vorokov
> why not use several addresses on one card? Because we must test how our software works with several different cards (we develop VPN software for windows, linux & FreeBSD) Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the mess

Re: crash dump output

2001-07-31 Thread Eugene L. Vorokov
> Can you compile a debug kernel please and repeat this? That way you will have > debug symbols so that you can get more useful information out of gdb. You'll > have to get a new crashdump with the debug kernel running however. Maybe it's offtopic a bit, but can you please give exact instructio

Re: crash dump output

2001-08-01 Thread Eugene L. Vorokov
> > Maybe it's offtopic a bit, but can you please give exact instructions of how > > to compile debug kernel ? My machine crashes sometimes too, I tried to compile > > debug kernel, but it seemed not so easy and I gave up due to lack of time. Or > > is there any URL with a good explanation ? > >

Re: crash dump output

2001-08-01 Thread Eugene L. Vorokov
> you just call config with '-g' option. and compile the kernel in normal > way. The freebsd handbook discusses this in more detail. Yet another issue, I have run config -g, then make depend, make and make install.debug. But my /kernel is still about 2mb long, which probably means it's not real

crash report

2001-08-01 Thread Eugene L. Vorokov
Hello, here's my crash dump, something related to mbufs. If more information is needed, tell me what to do, I'll provide it. This usually happens (but not always) when someone is downloading something huge from ftp server on this machine. Regards, Eugene vel@bugz:/home/vel # uname -r 4.2-RELE

Re: crash report

2001-08-01 Thread Eugene L. Vorokov
> In message <[EMAIL PROTECTED]>, "Eugene L. Vorokov" wr > ites: > >fault virtual address = 0x60c0ff00 > > I missed the beginning of this thread, but this looks like a problem > that was fixed just before 4.3-RELEASE. What version of FreeBSD > are y

libmp

2001-08-06 Thread Eugene L. Vorokov
Hello, I cvsup'ed 5.0-CURRENT yesterday, successfully compiled the kernel and tried to compile the rest. However, when doing make in the lib directory, it stops on libmp. The problem is that libmp uses include files from openssl/, and they are not present in my system, as I can see they don't com

pam_ssh

2001-08-06 Thread Eugene L. Vorokov
Hello, while trying to compile -current, I discovered some possible bug: when compiling libpam, it stops on libpam/modules/pam_ssh/pam_ssh.c, giving bunch of errors. The problem is that including security/pam_mod_misc.h seems wrong, it doesn't find it there. When I changed it to simple pam_mod_mi

Re: libmp

2001-08-06 Thread Eugene L. Vorokov
> Er... the OpenSSL sources *are* shipped with FreeBSD. > Or at least they should be, if your CVSup is doing the right thing. > Are you cvsup'ping the src-all collection, or the subcollections? > There is no longer any need to *not* cvsup src-all, no matter if > you are in an export-controlle

Re: libmp

2001-08-06 Thread Eugene L. Vorokov
> > Hmm yes, it's there. But the snapshot I installed first doesn't > > have it (why ?). When I installed it manually prior to compiling libs, > > libmp compiles fine ... Btw, is there any guide of what is the proper > > order of compiling things after cvsup ? > > Yep, the src/UPDATING file. > >

pam_wheel

2001-08-06 Thread Eugene L. Vorokov
Hello, pam_wheel authentication module seems to be broken in -current. Look at this (from src/lib/libpam/modules/pam_wheel): PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, const char **argv) { struct options options; struct passwd *pwd; struc

[PATCH] pam_wheel fix

2001-08-07 Thread Eugene L. Vorokov
Hello, can anyone please commit this fix to pam_wheel authentication module. It fixed two problem I mentioned in my previous mail (currently for any non-root user PAM_IGNORE is returned, and in case of auth_as_self and debug options used together it logs strange things instead of username). The

PFIL_HOOKS

2001-08-08 Thread Eugene L. Vorokov
Hello, why isn't PFIL_HOOKS kernel compile option listed in NOTES ? If it just was forgotten, please add it. One trying to compile in ipfilter will get confused I think. Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message

Re: SMBFS and NETSMB?

2001-08-10 Thread Eugene L. Vorokov
> You can try the following in your kernel config: > > options NETSMB > options NETSMBCRYPTO > options LIBMCHAIN > options ICONV I think it's "options LIBICONV" (or do both work ?). Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscrib

Re: Doing file operations on syscalls handler

2001-08-10 Thread Eugene L. Vorokov
> Hello hackers, > > I'm new on FreeBSD modules programming, and I've a little question... > How can I do file operations (like open(), read()..) on a syscall handler of > a syscall module ? > In fact I've met the problem since my module must open a file which contains > some informations for the

Re: Getting filename from descriptor or vnode struct

2001-08-16 Thread Eugene L. Vorokov
> Hi hackers, > > I'm confronted to a problem when I try to hack getdirentries(2) in a kld > module : > > To summarize, getdirentries() filled in a buffer a series of dirent struct, > and the 'd_name' field represents the filename (without the full path). I > must recover the full path because

IP address on bridge

2001-08-17 Thread Eugene L. Vorokov
Hello, I'm observing some strange problem when I have an IP address on one card on a bridge machine and want to telnet in. I have 4.2-RELEASE box with two network cards: Realtek 8139 (rl0) and 3Com 3C905B (xl0). rl0 is connected to the world, and xl0 to the intranet switch. FreeBSD handbook says

Re: kernel stack size

2001-08-17 Thread Eugene L. Vorokov
> In 5-0-KSE there is a single page that contains the stack and > the PCB (which is about 660 bytes). We are also looking at adding > code to set a hardware watchpoint between the stack and the PCB > to catch overruns. Maybe I'm just dumb, but I still don't understand, what is the reason of keep

kill a process in kernel

2001-08-24 Thread Eugene L. Vorokov
Hello, what is the most proper and easy way to shutdown given process (not curproc) from kernel module ? Any advices regarding this are appreciated. Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message

Re: Why is csh tcsh? This can be a bad thing...

2001-08-24 Thread Eugene L. Vorokov
> > It's kinda late in the process to be complaining about this, but I just noticed >this myself... Why not just symlink csh to tcsh then ? vel@bugz:/sys/modules/paudit # ls -l /bin/*csh -r-xr-xr-x 2 root wheel 740996 Aug 23 23:19 /bin/csh -r-xr-xr-x 2 root wheel 740996 Aug 23 23:19 /bin/

Re: Re: Why is csh tcsh? This can be a bad thing...

2001-08-24 Thread Eugene L. Vorokov
> On Fri, Aug 24, 2001 at 01:45:48PM +0400, Eugene L. Vorokov wrote: > > > > It's kinda late in the process to be complaining about this, but I just >noticed this myself... > > > > Why not just symlink csh to tcsh then ? > > Because csh is hardlinked

Re: unknown PNP hardware

2001-08-26 Thread Eugene L. Vorokov
> : I'm running -current as of an hour ago. I've gotten this since I've > : been running 4.2-stable, any ideas on how I can find out what it > : belongs to? > : > : unknown: can't assign resources > : unknown: can't assign resources > : unknown: can't assign resources > : unknown: can't as

pam_rootok

2001-08-26 Thread Eugene L. Vorokov
Hello, would someone (Mark ?) finally remove this: pam_rootok: pam_sm_authenticate: Refused; not superuser I think it should be sent to the debug output, not a terminal. It's quite annoying ... Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers"

problem with unloading device driver

2001-08-27 Thread Eugene L. Vorokov
Hello, I have a module which adds new device. It does make_dev() and then simulates mknod() syscall, so that /dev/name is always automatically created. Also I have a daemon which reads from and writes to this device. The daemon opens the device once and then holds it open. When my module unloads,

Re: problem with unloading device driver

2001-08-27 Thread Eugene L. Vorokov
> > Hello, > > > > I have a module which adds new device. It does make_dev() and then simulates > > mknod() syscall, so that /dev/name is always automatically created. > > Also I have a daemon which reads from and writes to this device. The daemon > > opens the device once and then holds it open.

Re: problem with unloading device driver

2001-08-27 Thread Eugene L. Vorokov
> > Hello, > > > > I have a module which adds new device. It does make_dev() and then simulates > > mknod() syscall, so that /dev/name is always automatically created. > > Also I have a daemon which reads from and writes to this device. The daemon > > opens the device once and then holds it open.

Re: MFC request (was Re: symlink(2) [Was: Re: tcsh.cat])

2001-09-03 Thread Eugene L. Vorokov
> I comitted a fix to -current two months ago. It's still in my -stable > tree... if Jordan gives the O.K., I will MFC it to -stable. > > -Matt Erm, sorry, but what does MFC mean here ? I see this term used a lot and I can even guess what it

KLD subsystem improvement

2001-09-04 Thread Eugene L. Vorokov
Hello, I'm going to implement a small improvement to a KLD system. I want linker file not to be loaded at all when all modules inside it fail to load for some reasons. I think that would be logical behaviour. Does anyone think that such change would break something ? Regards, Eugene To Unsubsc

corrupted 'w' output

2001-09-06 Thread Eugene L. Vorokov
Hello, I updated from -current yesterday, ran "make world; make kernel KERNCONF=X" and went to bed. When I rebooted with fresh kernel this morning, I noticed something strange: vel@bugz:/usr/src # w 3:47PM up 5:38, 4 users, load averages: 0.00, 0.11, 0.08 USER TTY FROM

Re: Kernel-loadable Root Kits

2001-09-09 Thread Eugene L. Vorokov
> > 1) scan the sysent table and check syscalls pointers (generally, rootkits > > intercepts syscalls) > > This can get really "hairy". To scan the syscall table, even if you > are 'root' and directly access /dev/mem you will have to use some > system calls to open(), read() and seek() into the

how to make 'for' understand two words as a single argument

2001-10-01 Thread Eugene L. Vorokov
Hello, I have a script which is supposed to convert all filenames to lowercase recursively from current directory. It looks like: echo "Processing files" for i in `ls |grep [A-Z]`; \ do mv $i `echo $i |tr [A-Z] [a-z]`; echo $i;\ done; for i in `find . -name "*" -type d -maxdepth 1`;\

Re: how to make 'for' understand two words as a single argument

2001-10-01 Thread Eugene L. Vorokov
> > "Eugene L. Vorokov" wrote: > > > > > > I have a script which is supposed to convert all filenames to lowercase > > > recursively from current directory. It looks like: > > > > > > echo "Processing files" > > > fo

kernel threads

2001-10-25 Thread Eugene L. Vorokov
Hello, does FreeBSD currently have something similar to linux's kernel_thread() ? Or is it what KSE intends to implement ? Can I somehow run "independent" kernel thread, which will, for instance, check some flag that I set inside interrupt handler and do some job that can't be done in the interru

Re: buildworld breakage during "make depend" at usr.bin/kdump

2001-11-01 Thread Eugene L. Vorokov
> > "David O'Brien" <[EMAIL PROTECTED]> writes: > > because `echo' nicely removes \n's from env vars when it prints them. > > des@des ~% foo='bar > quote> baz' > des@des ~% echo $foo > bar > baz > des@des ~% /bin/echo $foo > bar > baz > Uhmz ? bash-2.05# foo='bar > baz' bash-2.05# echo $foo b

Re:

2001-11-29 Thread Eugene L. Vorokov
> --_ABC1234567890DEF_ > Content-Type: audio/x-wav; >name="New_Napster_Site.MP3.pif" > Content-Transfer-Encoding: base64 > Content-ID: You virus senders, please, do not send your viruses to this list. We all read mail under Unix and don't give a shit to these windows executables.

Re: offtopic: assembly

2001-12-05 Thread Eugene L. Vorokov
> > Fabio Miranda wrote: > > I want to understand Why each byte (8 bit of data and > > 1 bit of parity) has one bit of parity? > > To permit the hardware to catch single bit errors. > > ECC is a better version of this, which permits the hardware to > correct single bit errors, and catch multipl

Re: Motion for removal of xargs(1) from base system

2001-12-11 Thread Eugene L. Vorokov
> My, is it April 1st already? How quickly time flies! December feels > like it was just yesterday! > > - Jordan Ehe, as far as I can see some people even have taken it seriously :) This probably shows that when you have to read 300 emails/day, your attention slowly but constantly leaves you.

Re: email

2002-01-10 Thread Eugene L. Vorokov
> > email áàçû ìîñêâû, ïèòåðà, ðîññèè è ïð. ðàññûëêà email ñîîáùåíèé. > ÷òî áû óçíàòü ïîäðîáíåå, íàïèøèòå ïèñüìî íà [EMAIL PROTECTED] , óêàçàâ â òåìå >ÇÀÏÐÎÑ > (ñîîáùåíèÿ áåç ñëîâà ÇÀÏÐÎÑ - àâòîìàòè÷åñêè óäàëÿþòñÿ) > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe free

Re: kld question

2002-01-10 Thread Eugene L. Vorokov
> > I made a kernel module that logs execve system calls by intercepting the > execve syscall, log it and then execute the original syscall. This was > pretty straightforward to do, and it works beautifully on STABLE, but on > CURRENT it bombs on this line: > > uid = p->p_cred->pc_ucred->cr_uid;

Re: Super Block

2002-01-15 Thread Eugene L. Vorokov
> What does the SuperBlock actually do ? > Why is the SuperBlock so critical ? > > Can anyone give me a *good* summary on the purpose of the Super Block ? > And/Or any recommendations ? On FreeBSD, 'man fs' can help you I think. Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTECTED]

Re: file name

2002-02-04 Thread Eugene L. Vorokov
> I want to control for example open() syscall: > static int my_open(register struct proc *p, register struct open_args *ea) > { > [...] > } > Name of file to open is in ea->path, but this name can be: ./somefile > and i need a full path to it. I faced that problem once. I used an ugly hack: sim

Re: THTTPD web server: problems with KQUEUE on FreeBSD 4.5-STABLE

2002-02-13 Thread Eugene L. Vorokov
> I still wonder, whether this problem occurs because of how thttpd does > things, or how FreeBSD implements kqueue stuff, however, I am not sure > that I will have enough time to dig deep into this. Right now I'm pretty > happy with the fact that I got thttpd working again, and those "200 0" > m

C vs C++

2002-03-05 Thread Eugene L. Vorokov
Hello, I have a small problem. I work for software development company and write daemons and console tools for Unix. My boss wants everything to be written in C++, because he thinks C++ is cool. I prefer C for such tasks, but I cannot really put good arguments of why and where C++ can be worse th

"quota" output

2002-06-04 Thread Eugene L. Vorokov
Hi, I was setting up quotas on 20gb disk, and seen this: vel@bugz:/home/vel # quota -v for_all Disk quotas for user for_all (uid 1003): Filesystem usage quota limit grace files quota limit grace /usr13471298 01350 45321 0 0

Re: allocating memory

2002-06-06 Thread Eugene L. Vorokov
On Wed, Jun 05, 2002 at 11:56:57PM -0500, Stephen Montgomery-Smith wrote: > I have access to a rather large computer (3GB of RAM) and I would like > to write a program to access most of this memory. I find that I am > unable to malloc more than about 0.5 GB of memory, even if I do it in > small i

SMP problem on E7500 chipset

2002-07-31 Thread Eugene L. Vorokov
4 CPUs are found. Network operation slows down to hell, syslog is full of Jul 31 14:44:54 superjob /kernel: fxp0: device timeout Without SMP, everything runs fine. Syslog output regarding dmesg and kernel config are below. Regards, Eugene L. Vorokov Jul 31 14:40:12 superjob /kernel