linux-8086.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jody Bruchon <jody@jodybruchon.com>
To: ELKS <linux-8086@vger.kernel.org>
Subject: Tentative "login:" loop fix
Date: Tue, 03 Mar 2015 23:07:47 -0500	[thread overview]
Message-ID: <54F68513.2050002@jodybruchon.com> (raw)

There's this piece of code with no comments in arch/i86/mm/malloc.c:

if (currentp->t_begstack > currentp->t_endbrk)
  if(len > currentp->t_endseg - 0x1000) {
     return -ENOMEM;
}

I don't understand why t_endseg is being reduced by 0x1000 before 
checking and can't find any justification for it anywhere else in the 
kernel code; fs/exec.c:sys_execve() sets t_endseg and only says "needed 
for sys_brk()" which is of no help. Documentation/text/bin_formats.txt 
mentions 0x1000 as part of an example while discussing the ELKS 
executable file format but it doesn't quite seem to be related. From 
what I can gather, ELKS uses 0x1000 as a data segment offset in some 
places but I can't see any of those being related to what's going on in 
sys_brk()...

One thing is for certain: this check is causing the frustrating problem 
with the "login:" prompt that never ends. Removing the offset in the 
check fixes the login loop problem (which has plagued ELKS for a long 
time) and I can't seem to trigger any bad behavior in any random 
userspace programs with the check removed.

The t_endseg check code was originally introduced when ELKS executable 
format support was put into CVS in 2003 or so. If anyone knows why the 
0x1000 reduction was there, please explain it to me. Otherwise I'm 
leaving the change I've already committed in place which fixes this 
problem for now so we can worry about other things.

-Jody

             reply	other threads:[~2015-03-04  4:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04  4:07 Jody Bruchon [this message]
2015-03-04 11:34 ` Tentative "login:" loop fix Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F68513.2050002@jodybruchon.com \
    --to=jody@jodybruchon.com \
    --cc=linux-8086@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).