Subject: Re: Problems with latest arm32 kernel
To: None <port-arm32@netbsd.org, current-users@netbsd.org>
From: Richard Earnshaw <rearnsha@buzzard.freeserve.co.uk>
List: port-arm32
Date: 02/27/2001 21:15:29
This is a multipart MIME message.

--==_Exmh_-20233137770
Content-Type: text/plain; charset=us-ascii

> 
> I've run into a small problem which is fairly certainly due to a problem 
> in the latest kernels.  However, ATM I'm not sure precisely where.
> 
> The symptoms:
> 
> Kernel 1.5I, userland similar era: gcc-3.0 development sources pass a make 
> bootstrap.
> 
> Kernel 1.5S, userland as above: gcc-3.0 development sources fail a make 
> bootstrap.
> 
> As far as I can tell, the failure is due to 'holes' left by the assembler 
> at the end of a section in an object file (gas/arm32 pads the .text 
> section to a 4-word boundary).  On older kernels this padding was always 
> zero, with the new one, it is garbage data from somewhere.  There seem to 
> be several possible causes of this, though I haven't been able to test 
> many of them:
> 
> - The file system is failing to correctly fill small holes left in files 
> on a seek() with zero.

Following up on this idea, I've written the following test program.  I 
believe the output of this should be a file consiting purely of 0's.  On 
my machine this is not the case and I get:

buzzard:/tmp [579] $ od -x seek-test 
0000000     0000    0000    0000    0000    0000    0000    0000    0000
*
0017720     0000    0000    0000    0000    0000    0000    7800    6665
0017740     6662    3764    6330    302c    6578    0066    0000    0000
0017760     0000    0000    0000    0000    0000    0000    0000    0000
*
0037620     0000    0000    0000    0000    2032    6f4e    7320    6375
0037640     2068    0066    0000    0000    0000    0000    0000    0000
0037660     0000    0000    0000    0000    0000    0000    0000    0000
*
etc.

Does anyone else see problems like this?



--==_Exmh_-20233137770
Content-Type: text/plain ; name="seek.c"; charset=us-ascii
Content-Description: seek.c
Content-Disposition: attachment; filename="seek.c"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

main()
{
  char buf[4096];
  FILE *f;
  int i, offset;
  int j=1;

  f = fopen("seek-test", "w");

  offset = 0;
  i = 4096;

  while (offset < 4096 * 1024)
    {
      i -= random() & 0xf;
      if (i < 0)
	i = 4095;
      memset(buf, 0, 4096);
      memset(buf + i, 1, 4096 - i);
      /*      buf[0] = j++; */
      fseek(f, offset, SEEK_SET);
      fwrite(buf, 1, i, f);
      offset += i + (random() & 0xf);
    }

  fclose(f);
  exit(0);
}

--==_Exmh_-20233137770--