lkml.org 
[lkml]   [1999]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Subjectegcs-1.1.2 ping bug also causes miscompilation of pcbit isdn driver
    Date
    Hello,

    the bug in egcs-1.1.2 that causes miscompilations of in_cksum also is
    responsible for the pcbit-isdn driver failure (See thread "Still no ISDN
    connection"). I suspect there are some other places in kernel
    which suffer from this bug.

    --------------------- test case ----------------------
    #include <stdio.h>
    int main(int argc, char **argv) {
    struct {char c1, c2, c2, 4;} t;
    t.c4 = 0x78; t.c3 = 0x56; t.c2 = 0x34; t.c1 = 0x12;
    printf("0x%x\n", *((unsigned long*) &t));
    return 0;
    }

    gives 0x12 with egcs-1.1.2 on i386, instead of 0x78563412.

    Similar code is used in "drivers/isdn/pcbit/layer2.c:pcbit_deliver":
    ---------------------------------------------------
    void
    pcbit_deliver(void *data)
    {
    struct frame_buf *frame;
    unsigned long flags;
    struct msg_fmt msg;
    struct pcbit_dev *dev = (struct pcbit_dev *) data;

    save_flags(flags);
    cli();

    while ((frame = dev->read_queue)) {
    dev->read_queue = frame->next;
    restore_flags(flags);

    msg.cpu = 0;
    msg.proc = 0;
    msg.cmd = frame->skb->data[2];
    msg.scmd = frame->skb->data[3];

    frame->refnum = *((ushort *) frame->skb->data + 4);
    frame->msg = *((ulong *) & msg);

    skb_pull(frame->skb, 6);

    ---------------------------------------------------

    I actually found this comparing the assember output of the unfixed and fixed
    version of egcs.

    Unless you want to wait for gcc-2.9.5, I have a simple patch for egcs-1.1.2,
    that fixes this bug. [http://www.admin.de/~hel/egcs-1.1.2-function.c.patch]

    Lars Heete

    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 13:52    [W:0.021 / U:0.140 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site