From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Geyslan_Greg=C3=B3rio_Bem?= Subject: Re: [PATCH 02/02] x86_64: Add safe check in a.out loaders and some coding style Date: Wed, 18 Sep 2013 19:38:36 -0300 Message-ID: References: <1379539641-1726-1-git-send-email-geyslan@gmail.com> <1379539641-1726-2-git-send-email-geyslan@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, "Geyslan G. Bem" To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Return-path: In-Reply-To: <1379539641-1726-2-git-send-email-geyslan@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Please, disregard this due to problems reversing the commit. I'll send the entire one soon. Geyslan Greg=C3=B3rio Bem hackingbits.com 2013/9/18 Geyslan G. Bem : > ia32_aout had no safe checks concerning the mmap and f_op in this mod= ule. > It's not necessary to verify f_op in the load_aout_library, since the > prior kernel_read/vfs_read function already does. > Coding style and printks fixes. > > Tested using qemu, a handcrafted a.out binary and a a.out linked with= a > cross-compiled ld. > > Signed-off-by: Geyslan G. Bem > --- > arch/x86/ia32/ia32_aout.c | 25 ++++++------------------- > 1 file changed, 6 insertions(+), 19 deletions(-) > > diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c > index 15a8319..46a0346 100644 > --- a/arch/x86/ia32/ia32_aout.c > +++ b/arch/x86/ia32/ia32_aout.c > @@ -24,7 +24,7 @@ > #include > #include > #include > -#include > +#include > > #include > #include > @@ -346,21 +346,13 @@ static int load_aout_binary(struct linux_binprm= *bprm) > } > } else { > #ifdef WARN_OLD > - static unsigned long error_time, error_time2; > if ((ex.a_text & 0xfff || ex.a_data & 0xfff) && > - (N_MAGIC(ex) !=3D NMAGIC) && > - time_after(jiffies, error_time2 + 5*H= Z)) { > - printk(KERN_NOTICE "executable not page align= ed\n"); > - error_time2 =3D jiffies; > - } > + (N_MAGIC(ex) !=3D NMAGIC)) > + pr_notice_ratelimited("executable not page al= igned\n"); > > - if ((fd_offset & ~PAGE_MASK) !=3D 0 && > - time_after(jiffies, error_time + 5*HZ)) { > - printk(KERN_WARNING > - "fd_offset is not page aligned. Please= convert program: %s\n", > + if ((fd_offset & ~PAGE_MASK) !=3D 0) > + pr_warn_ratelimited("fd_offset is not page al= igned. Please convert program: %s\n", > bprm->file->f_path.dentry->d_name.name= ); > - error_time =3D jiffies; > - } > #endif > > if ((fd_offset & ~PAGE_MASK) !=3D 0) { > @@ -451,13 +443,8 @@ static int load_aout_library(struct file *file) > > if ((N_TXTOFF(ex) & ~PAGE_MASK) !=3D 0) { > #ifdef WARN_OLD > - static unsigned long error_time; > - if (time_after(jiffies, error_time + 5*HZ)) { > - printk(KERN_WARNING > - "N_TXTOFF is not page aligned. Please = convert library: %s\n", > + pr_warn_ratelimited("N_TXTOFF is not page aligned. Pl= ease convert library: %s\n", > file->f_path.dentry->d_name.name); > - error_time =3D jiffies; > - } > #endif > vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); > > -- > 1.8.4 >