[PATCH] contort getdents64 to pacify gcc-2.96

From: Adam Kropelin (akropel1_at_rochester.rr.com)
Date: 01/13/05

  • Next message: Andrew Morton: "Re: thoughts on kernel security issues"
    Date:	Thu, 13 Jan 2005 00:42:19 -0500
    To: Linus Torvalds <torvalds@osdl.org>
    
    

    A recent trivial fixup in sys_getdents64...

    > diff -Nru a/fs/readdir.c b/fs/readdir.c
    > --- a/fs/readdir.c 2005-01-12 19:22:35 -08:00
    > +++ b/fs/readdir.c 2005-01-12 19:22:35 -08:00
    > @@ -287,8 +287,9 @@
    > lastdirent = buf.previous;
    > if (lastdirent) {
    > typeof(lastdirent->d_off) d_off = file->f_pos;
    > - __put_user(d_off, &lastdirent->d_off);
    > error = count - buf.count;
    > + if (__put_user(d_off, &lastdirent->d_off))
    > + error = -EFAULT;
    > }
    >
    > out_putf:

    ...gives gcc-2.96 indigestion:

    > fs/readdir.c: In function `sys_getdents64':
    > fs/readdir.c:299: Unrecognizable insn:
    > (insn 166 257 174 (parallel[
    > (set (reg/v:SI 6 ebp)
    > (asm_operands/v ("1: movl %%eax,0(%2)
    > 2: movl %%edx,4(%2)
    > 3:
    > .section .fixup,"ax"
    > 4: movl %3,%0
    > jmp 3b
    > .previous
    > .section __ex_table,"a"
    > .align 4
    > .long 1b,4b
    > .long 2b,4b
    > .previous") ("=r") 0[
    > (reg:DI 1 edx)
    > (reg:SI 0 eax)
    > (const_int -14 [0xfffffff2])
    > (reg/v:SI 6 ebp)
    > ]
    > [
    > (asm_input:DI ("A"))
    > (asm_input:SI ("r"))
    > (asm_input:SI ("i"))
    > (asm_input:SI ("0"))
    > ] ("fs/readdir.c") 291))
    > (clobber (reg:QI 19 dirflag))
    > (clobber (reg:QI 18 fpsr))
    > (clobber (reg:QI 17 flags))
    > ] ) -1 (insn_list 132 (insn_list 146 (insn_list 165 (nil))))
    > (nil))
    > fs/readdir.c:299: confused by earlier errors, bailing out

    While upgrading to a sane gcc would be the preferred solution,
    rewriting the change as follows eliminates the error for those who
    cannot do so.

    Signed-off-by: Adam Kropelin <akropel1@rochester.rr.com>

    --- linux-2.6.11-rc1.orig/fs/readdir.c Wed Jan 12 22:35:03 2005
    +++ linux-2.6.11-rc1/fs/readdir.c Wed Jan 12 22:16:55 2005
    @@ -287,9 +287,10 @@
             lastdirent = buf.previous;
             if (lastdirent) {
                     typeof(lastdirent->d_off) d_off = file->f_pos;
    - error = count - buf.count;
    + error = -EFAULT;
                     if (__put_user(d_off, &lastdirent->d_off))
    - error = -EFAULT;
    + goto out_putf;
    + error = count - buf.count;
             }
     
     out_putf:

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


  • Next message: Andrew Morton: "Re: thoughts on kernel security issues"

    Relevant Pages

    • Re: [RFC][CFLART] ipmi procfs bogosity
      ... In rewriting, I couldn't find a ... perversion, you need something like: ... Not a big deal, but a little nicer. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC][CFLART] ipmi procfs bogosity
      ... In rewriting, I couldn't find a ... nice function for reading integers from userspace, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [3/3] sparsemem memory model for ppc64
      ... > Just two formatting nitpicks below. ... this would be better served by rewriting the first comment and ... removing the second all together. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC][CFLART] ipmi procfs bogosity
      ... In rewriting, I couldn't find a ... > nice function for reading integers from userspace, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC][CFLART] ipmi procfs bogosity
      ... In rewriting, I couldn't find a ... > nice function for reading integers from userspace, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)