Re: sys_execve("/bin/init",args,18) => 65528

Riley Williams
2003-07-11T18:35:56Z

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

Hi.

> I am new to ELKS.
>
> I am using elks-0.1.1,elksnet-0.1.1, elkscmd_20020501.tar.gz,
> Dev86src-0.16.11.tar.gz and I am compiling on a Pentium - Linux
> Kernel 2.4. I have been able to compile and get all the Binaries.
> The boot floppy comes up fine. The root floppy is giving me a
> panic.
>
> ***********************
>
> ELKS version 0.1.1
> fd: probing disc in /dev/fd1
> fd: /dev/fd1 probably has 18 sectors and 80 cylinders
> VFS: Mounted root (minix filesystem).
> Loading init
> sys_execve("/bin/init",args,18) => 65528.

That 65528 is -6 written as an unsigned integer, and indicates a bug
in the printk routine (more specifically in the numout() routine it
calls to actually display the values). I have just committed a patch
to fix that bug, and the patch is enclosed.

> panic: Oops - trying to access dir
> apparant call stack:
> (0) ret addr = 3296 params = 67B4 26C4 2 26D0 2F64 0
> (1) ret addr = 33F4 params = 3D6 26EA 26EC 67B4 26E6 80
> (2) ret addr = 35C3 params = 3D6 3 8000 2706 0 3
> (3) ret addr = 41C0 params = 3D6 2 0 310 FFF8 2268
> (4) ret addr = 103 params = 0 0 0 0 0 0
> (5) ret addr = 0 params = 2268 A9 9FC0 2C74 3FF2 1E
> (6) ret addr = 9C params = E120 1DA4 E5EC 0 0 1

We really need something to convert those return addresses into actual
routine names, as the addresses themselves are basically meaningless 8(

> I saw an identical posting by Mark Robson in Mar 03. I did not
> find a solution to it. It looks like the init is not able to get
> executed. Has anybody faced this problem ?

Unfortunately, I can't help with your problem itself. Sorry.

Best wishes from Riley.
---
* Nothing as pretty as a smile, nothing as ugly as a frown.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.500 / Virus Database: 298 - Release Date: 10-Jul-2003

[-- Attachment #2: printk.diff --]
[-- Type: application/octet-stream, Size: 1407 bytes --]

Index: elks/kernel/printk.c
===================================================================
RCS file: /cvsroot/elks/elks/kernel/printk.c,v
retrieving revision 1.11
diff -u -5 -u -r1.11 printk.c
--- elks/kernel/printk.c 22 Jun 2002 09:28:21 -0000 1.11
+++ elks/kernel/printk.c 11 Jul 2003 18:32:10 -0000
@@ -78,33 +78,35 @@
/************************************************************************
*
* Output a number
*/

-char *hex_string = "0123456789ABCDEF"; /* Also used by devices. */
+char *hex_string = "0123456789ABCDEF"; /* Also used by devices. */

static void numout(char *ptr, int len, int base, int useSign)
{
+ long int vs;
unsigned long int v;
register char *bp;
char buf[16];

bp = buf + 15;

- v = (len == 2)
- ? *((unsigned short *) ptr)
- : *((unsigned long *) ptr);
-
- if (useSign && (((long)v) < 0)) {
- v = -v;
- *bp = '-';
- con_write(bp, 1);
- }
+ if (useSign) {
+ vs = (len == 2) ? *((short *) ptr) : *((long *) ptr);
+ if (vs < 0) {
+ v = - vs;
+ *bp = '-';
+ con_write(bp, 1);
+ } else
+ v = vs;
+ } else
+ v = (len == 2) ? *((unsigned short *) ptr) : *((unsigned long *) ptr);

*bp = 0;
do {
- *--bp = hex_string[(v % base)]; /* Store digit. */
+ *--bp = hex_string[(v % base)]; /* Store digit. */
} while ((v /= base) && (bp > buf));

con_write(bp, buf - bp + sizeof(buf) - 1);
}