[PATCH] 2.3.18ac7 (and probably 8): Shut up a.out complaints

david parsons (o.r.c@p.e.l.l.p.o.r.t.l.a.n.d.o.r.u.s)
23 Sep 1999 12:51:09 -0700


The problem (libc.so.4.8.0 was built this week, and this is a 30-second
test of 2.3.18ac7):

N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0
N_TXTOFF is not page aligned. Please convert library: libc.so.4.8.0

A solution. This may be the ideal solution for everyone, because it
allows you to set your tolerance for backwards compatability to taste:
#define I_HATE_AOUT 0 makes binfmt_aout quiet about things that don't
make programs not run.
#define I_HATE_AOUT 1 allows people to fill your syslogs with millions
of messages about library alignment.
#define I_HATE_AOUT 2 crashes your machine if you have the temerity
to run an a.out program on it:

diff -Naur linux-2.3.18ac7/fs/binfmt_aout.c.bad linux-2.3.18ac7/fs/binfmt_aout.c
--- linux-2.3.18ac7/fs/binfmt_aout.c.bad Thu Sep 23 12:34:03 1999
+++ linux-2.3.18ac7/fs/binfmt_aout.c Thu Sep 23 12:41:37 1999
@@ -29,6 +29,14 @@
#include <asm/uaccess.h>
#include <asm/pgtable.h>

+#define I_HATE_AOUT 0
+
+#if I_HATE_AOUT > 1
+# define COMPLAIN panic
+#else
+# define COMPLAIN printk
+#endif
+
static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
static int load_aout_library(int fd);
static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
@@ -270,7 +278,6 @@
unsigned long fd_offset;
unsigned long rlim;
int retval;
- static unsigned long error_time=0;

ex = *((struct exec *) bprm->buf); /* exec-header */
if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
@@ -284,11 +291,7 @@

#ifdef __i386__
if (N_MAGIC(ex) == ZMAGIC && fd_offset != BLOCK_SIZE) {
- if((jiffies-error_time) >5)
- {
- printk(KERN_NOTICE "N_TXTOFF != BLOCK_SIZE. See a.out.h.\n");
- error_time=jiffies;
- }
+ printk(KERN_NOTICE "N_TXTOFF != BLOCK_SIZE. See a.out.h.\n");
return -ENOEXEC;
}

@@ -296,11 +299,7 @@
bprm->dentry->d_inode->i_op &&
bprm->dentry->d_inode->i_op->get_block &&
(fd_offset < bprm->dentry->d_inode->i_sb->s_blocksize)) {
- if((jiffies-error_time) >5)
- {
- printk(KERN_NOTICE "N_TXTOFF < BLOCK_SIZE. Please convert binary.\n");
- error_time=jiffies;
- }
+ printk(KERN_NOTICE "N_TXTOFF < BLOCK_SIZE. Please convert binary.\n");
return -ENOEXEC;
}
#endif
@@ -364,21 +363,23 @@
flush_icache_range((unsigned long) 0,
(unsigned long) ex.a_text+ex.a_data);
} else {
+#if I_HATE_AOUT
if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
(N_MAGIC(ex) != NMAGIC))
- printk(KERN_NOTICE "executable not page aligned\n");
+ COMPLAIN("executable not page aligned\n");
+#endif

fd = open_dentry(bprm->dentry, O_RDONLY);
if (fd < 0)
return fd;
file = fget(fd);

+#if I_HATE_AOUT
if ((fd_offset & ~PAGE_MASK) != 0) {
- printk(KERN_WARNING
- "fd_offset is not page aligned. Please convert program: %s\n",
- file->f_dentry->d_name.name
- );
+ COMPLAIN("fd_offset is not page aligned. Please convert program: %s\n",
+ file->f_dentry->d_name.name );
}
+#endif

if (!file->f_op || !file->f_op->mmap || ((fd_offset & ~PAGE_MASK) != 0)) {
fput(file);
@@ -508,10 +509,10 @@
start_addr = ex.a_entry & 0xfffff000;

if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
- printk(KERN_WARNING
- "N_TXTOFF is not page aligned. Please convert library: %s\n",
- file->f_dentry->d_name.name
- );
+#if I_HATE_AOUT
+ COMPLAIN("N_TXTOFF is not page aligned. Please convert library: %s\n",
+ file->f_dentry->d_name.name );
+#endif

do_mmap(NULL, start_addr & PAGE_MASK, ex.a_text + ex.a_data + ex.a_bss,
PROT_READ | PROT_WRITE | PROT_EXEC,

____
david parsons \bi/ Sorry, I'm not going to convert the library I just built.
\/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/