libc6 select problem SOLVED

1998-01-04 Thread Juan Cespedes
I think I've discovered the problem...

I have two Sparcs handy, with exactly the same config, and the
same packages installed; one of them showed the problem but the other
didn't.  The only difference between them is the kernel, so I thought
it might be kernel related.

I've investigated a bit, and I think this patch to the Linux
Kernel should fix this problem:

==
--- linux/arch/sparc/kernel/systbls.S~  Sun Dec 14 19:37:14 1997
+++ linux/arch/sparc/kernel/systbls.S   Sun Jan  4 00:30:16 1998
@@ -122,7 +122,7 @@
.long C_LABEL(sys_create_module), C_LABEL(sys_delete_module)
.long C_LABEL(sys_get_kernel_syms), C_LABEL(sys_getpgid), 
C_LABEL(sys_bdflush)
.long C_LABEL(sys_sysfs), C_LABEL(sys_nis_syscall), 
C_LABEL(sys_setfsuid)
-   .long C_LABEL(sys_setfsgid), C_LABEL(sys_llseek), C_LABEL(sys_time)
+   .long C_LABEL(sys_setfsgid), C_LABEL(sys_select), C_LABEL(sys_time)
.long C_LABEL(sys_nis_syscall), C_LABEL(sys_stime), 
C_LABEL(sys_nis_syscall)
.long C_LABEL(sys_nis_syscall), C_LABEL(sys_llseek)
/* We are the Knights of the Forest of Ni!! */
==

It's against sparclinux-2.0.32-971208 from vger, but it should
apply cleanly to almost any modern version of the Linux kernel.

Please tell me if this solves your problems... it worked for
me.

-- 
Juan Cespedes


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: libc6 select problem SOLVED

1998-01-04 Thread Johnie Ingram

Juan == Juan Cespedes [EMAIL PROTECTED] writes:

Juan   I've investigated a bit, and I think this patch to the Linux
Juan Kernel should fix this problem:

Because I'm reluctant to change the kernel being used (its been up 40
days), I modifed the glibc-sparc itself so that it uses the working
call.

Its at ftp://ftp1.us.debian.org/debian/local, if anyone else needs it.
I couldn't complete the building of the libc6 .deb files because the
compile segfaults in the sunrpc dir.  Apparently ld-linux.so.2 can't
take programs to run on the command line.  :-(

At any rate ftp1.us.debian.org contains libc.so.6, the brilliant
Anders Hammarquist fix to ld-linux.so.2, and ldso_1.9.6-2.deb (which
has been uploaded).

Network daemons like apache and proftpd actually work now
The ldd program actually shows dependencies!!

This is looking to be a great year.  :-)


-  PGP  E4 70 6E 59 80 6A F5 78  63 32 BC FB 7A 08 53 4C
 
   __ _Debian GNU Johnie Ingram [EMAIL PROTECTED]  mm   mm
  / /(_)_ __  _   ___  __netgod irc.debian.org  mm mm
 / / | | '_ \| | | \ \/ / m m m
/ /__| | | | | |_| |Those who do not understand UNIX   mm   mm
\/_|_| |_|\__,_/_/\_\ are doomed to repeat it, poorly.   GO BLUE



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: libc6 select problems?

1998-01-04 Thread Mark W. Eichin
whh!!! yay!!!  Excellent work!

That's a *nasty* one.  I can even see why it sometimes worked -- in
the rsync code, the branch that does the select on one fd only happens
if the operation on the other fd blocked, and if it went one way, the
count was n+1 which was a valid fd, the other way it wasn't and the
EBADF happenned.

I've built a working kernel with this patch from the
sparclinux-2.0-971208 sources (and note that modules in that kernel
don't seem to work -- or at least NFS as a module doesn't...)

   I'm working on `strace'... there is a working version (in .rpm
 format) in ftp.nuclecu.unam.mx:/pub/Linux/Sparc-miguel (well, I cannot

Thanks.  Since then I've also noticed that the
vger.rutgers.edu:/pub/linux/Sparc/userland has a sparc strace rpm...

Now I just need to find sources for the debian build of silo (they're
not on ftp.debian.org, tsk tsk!) so I can patch it to understand
x86-byte-order root partitions...


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: libc6 select problem SOLVED

1998-01-04 Thread Eric Delaunay
Johnie Ingram wrote:
 
 Juan == Juan Cespedes [EMAIL PROTECTED] writes:
 
 Juan I've investigated a bit, and I think this patch to the Linux
 Juan Kernel should fix this problem:
 
 Because I'm reluctant to change the kernel being used (its been up 40
 days), I modifed the glibc-sparc itself so that it uses the working
 call.

Nice ;-)

 Its at ftp://ftp1.us.debian.org/debian/local, if anyone else needs it.
 I couldn't complete the building of the libc6 .deb files because the
 compile segfaults in the sunrpc dir.  Apparently ld-linux.so.2 can't
 take programs to run on the command line.  :-(

You have to apply a patch to your kernel.  See the MIME attachment.

 At any rate ftp1.us.debian.org contains libc.so.6, the brilliant
 Anders Hammarquist fix to ld-linux.so.2, and ldso_1.9.6-2.deb (which
 has been uploaded).
 
 Network daemons like apache and proftpd actually work now
 The ldd program actually shows dependencies!!

Hmm, ldso 1.9.6-2 don't work anymore on binaries linked with libc5 :-(
$ ldd /usr/local/redhat/bin/ncftp
ldd: /usr/local/redhat/bin/ncftp exited with signal 11

-- 
 Eric Delaunay | La guerre justifie l'existence des militaires.
 [EMAIL PROTECTED] | En les supprimant. Henri Jeanson (1900-1970)
diff -ruNp sparclinux-stable/fs/binfmt_elf.c sls-rth/fs/binfmt_elf.c
--- sparclinux-stable/fs/binfmt_elf.c   Tue May 27 22:47:19 1997
+++ sls-rth/fs/binfmt_elf.c Sun Jun 15 07:38:35 1997
@@ -119,15 +119,15 @@ unsigned long * create_elf_tables(char *
/*
 * Force 16 byte alignment here for generality.
 */
-   sp = (unsigned long *) (~15UL  (unsigned long) p);
-#ifdef __sparc__
+   sp = (unsigned long *) (-sizeof(long)  (unsigned long)p);
csp = sp;
csp -= exec ? DLINFO_ITEMS*2 : 2;
csp -= envc+1;
csp -= argc+1;
-   if (!(((unsigned long) csp)  4))
-   sp--;
-#endif
+   csp -= 1;  /* argc */
+   if ((unsigned long) csp  15UL)
+   sp -= (16 - ((unsigned long) csp  15UL)) / sizeof(long);
+
sp -= exec ? DLINFO_ITEMS*2 : 2;
dlinfo = sp;
sp -= envc+1;
@@ -385,13 +385,13 @@ do_load_elf_binary(struct linux_binprm *
struct file * file;
struct exec interp_ex;
struct inode *interpreter_inode;
-   unsigned long load_addr;
+   unsigned long load_addr, load_bias;
int load_addr_set = 0;
unsigned int interpreter_type = INTERPRETER_NONE;
unsigned char ibcs2_interpreter;
int i;
int old_fs;
-   int error;
+   unsigned long error;
struct elf_phdr * elf_ppnt, *elf_phdata;
int elf_exec_fileno;
unsigned long elf_bss, k, elf_brk;
@@ -405,7 +405,7 @@ do_load_elf_binary(struct linux_binprm *

ibcs2_interpreter = 0;
status = 0;
-   load_addr = 0;
+   load_addr = load_bias = 0;
elf_ex = *((struct elfhdr *) bprm-buf);  /* exec-header */

if (elf_ex.e_ident[0] != 0x7f ||
@@ -582,6 +582,19 @@ do_load_elf_binary(struct linux_binprm *
bprm-p = setup_arg_pages(bprm-p, bprm);
current-mm-start_stack = bprm-p;

+   /* Try and get dynamic programs out of the way of the default mmap
+  base, as well as whatever program they might try to exec.
+  This is because the brk will follow the loader, and is not 
+  movable.  */
+
+   if (elf_ex.e_type == ET_DYN) {
+#ifdef __sparc__
+   load_bias = TASK_UNMAPPED_BASE - 0x1000;
+#else
+   load_bias = 2 * TASK_SIZE / 3;
+#endif
+   }
+
/* Now we do a little grungy work by mmaping the ELF image into
   the correct location in memory.  At this point, we assume that
   the image should be loaded at fixed address, not at a variable
@@ -591,29 +604,41 @@ do_load_elf_binary(struct linux_binprm *
set_fs(get_ds());
for(i = 0, elf_ppnt = elf_phdata; i  elf_ex.e_phnum; i++, elf_ppnt++) {
if (elf_ppnt-p_type == PT_LOAD) {
-   int elf_prot = 0;
+   int elf_flags, elf_prot = 0;
+   unsigned long vaddr = 0;
+
if (elf_ppnt-p_flags  PF_R) elf_prot |= PROT_READ;
if (elf_ppnt-p_flags  PF_W) elf_prot |= PROT_WRITE;
if (elf_ppnt-p_flags  PF_X) elf_prot |= PROT_EXEC;
 
+   elf_flags = MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE;
+
+   if (elf_ex.e_type == ET_EXEC || load_addr_set) {
+   vaddr = elf_ppnt-p_vaddr;
+   elf_flags |= MAP_FIXED;
+   }
+
error = do_mmap(file,
-   ELF_PAGESTART(elf_ppnt-p_vaddr),
+   ELF_PAGESTART(load_bias + vaddr),
(elf_ppnt-p_filesz +
   

Re: libc6 select problems?

1998-01-04 Thread Eric Delaunay
Juan Cespedes wrote:
 On 3 Jan 1998, Mark W. Eichin wrote:
 
  Now at least I've got someplace else to look.  Question: where are the
  sources to the *libc5* that we're using? It's 5.3.12-mumble, not the
  debian standard 5.4.x, for which sources are on the mirrors, which
  doesn't have *any* sparc support that I can find...
 
   I think they are exactly the sources from RedHat, which have a
 lot of patches from David S. Miller and Miguel de Icaza.  I have never
 built it (I think Davide Barbieri and Eric Delaunay did).

I've put the source a long time ago on my ftp site (under
lix.polytechnique.fr:/pub/Linux/debian/sparc/bo/source/libs).
I'm now willing to work on libc5 to add some Debian specific stuff, like
the utmp wrapper and move the -dev pkg to -altdev.

Regards.

-- 
 Eric Delaunay | La guerre justifie l'existence des militaires.
 [EMAIL PROTECTED] | En les supprimant. Henri Jeanson (1900-1970)


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: libc6 select problems?

1998-01-04 Thread Juan Cespedes
On Sun, 4 Jan 1998, Eric Delaunay wrote:

 I've put the source a long time ago on my ftp site (under
 lix.polytechnique.fr:/pub/Linux/debian/sparc/bo/source/libs).
 I'm now willing to work on libc5 to add some Debian specific stuff, like
 the utmp wrapper and move the -dev pkg to -altdev.

That's already done (-dev - -altdev), and it works.  But I
think we shouldn't spend much time on libc5... there's plenty of work
to do with libc6, with X... 

-- 
Juan Cespedes


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .