(please guide me, if there is a more appropiate list/forum for this
question)
I modified net/socket.c file in Linux kernel 2.6.11. The modifications are
at the end of the email.
The idea is that function socket_work is defined at another place (so I can
install/uninstall this function just by loading/unloading my module, I have
used this technique before, it does speed up thinks). After compiling,
installing and rebooting the kernel, when I try to ssh to the machine, I am
unable to do so.
On the machine which has modifications, I get following error
Nov 21 17:39:54 localhost sshd[2828]: error: ssh_msg_recv: read: header -1
Nov 21 17:39:54 localhost sshd[2828]: fatal: recv_rexec_state: ssh_msg_recv
failed
and on machine where I try to ssh from, I get
[goodguy@snake /root]$ ssh root@tpc
ssh_exchange_identification: Connection closed by remote host
I have verified, that if I put original socket.c back, recompile kernel and
reboot ssh works fine.
I started looking into ssh and found that error message is coming from
int ssh_msg_recv(int fd, Buffer *m)
{
.
.
.
res = atomicio(read, fd, buf, sizeof(buf));
if (res != sizeof(buf)) {
if (res != 0)
error("ssh_msg_recv: read: header %ld", (long)res);
return (-1);
}
.
.
.
}
atomicio, is simply calling read, what I do not understan is that why adding
few lines (see below to kernel file net/socket.c) fails ssh. I am not too
fimiliar with security, ssh etc, is it calculating some checksum or it it
trying to verify something and failing.
Any help is appriciated.
Talib Alim
Changes to net/socket.c
97,101d96
< int (*socket_work)(int, int, int, struct socket *, int) = NULL;
<
< EXPORT_SYMBOL(socket_work);
<
1200,1206d1194
< if (socket_work)
< {
< printk("socket_work called\n");
< if (socket_work(family, type, protocol, sock, retval) < 0)
< goto out_release;
< }
<
1261,1274c1249,1250
< if (err)
< goto out_close_2;
<
< if (socket_work)
< {
< printk("socket_work called\n");
< err = socket_work(family, type, protocol, sock1, fd1);
<
< if (!err)
< err = socket_work(family, type, protocol, sock2, fd2);
<
< if (!err)
< return 0;
< }
---
if (!err)
return 0;
1276d1251
< out_close_2:
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/