From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22343 invoked from network); 8 May 2022 21:48:36 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 8 May 2022 21:48:36 -0000 Received: from mail-lf1-f42.google.com ([209.85.167.42]) by 9front; Sun May 8 17:45:18 -0400 2022 Received: by mail-lf1-f42.google.com with SMTP id j4so20851197lfh.8 for <9front@9front.org>; Sun, 08 May 2022 14:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ZH5fwMjRrz1FXtV4zrw9EIlj2i43D6K9B2Lqi84mb44=; b=P5HuQ6z1ZIgmcoinZ/JCiQKIkikM3rWS7hZtiJfJVa15mG+dwSr0D4xIw7I4+KdZ3l J+eTeNYG+PQz82Duq41ucgaDF22+QUUhziUSt0eQXsbM/i1uqsrWMJoCeZO4k4NccTAG /UX92ASjxemygCE07Eni28KGw5J/n4NRuhib1myPW9QioMhEXGW6XRJJxPE5ARuSV+MF 3yM7tg1ukP/t41BxEsX+MPd91Lrb8JYje/X5NbDZhGIGnMGNvfjkE1Nr6wxqrEn8NyB9 EY2zl0FApZcF3Ue988hxrciMjMmihpS1qU+hYjFrE42yf7mzCBWGV7PWoP2o9a+zHtes IKZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ZH5fwMjRrz1FXtV4zrw9EIlj2i43D6K9B2Lqi84mb44=; b=lT0fWt2vXur9A0bCnqzfgf7lvAxmHUroE2uQVCRaT47yMvrj3QJl0qUflks40BwAsO MHA6eNO+T0XVYgkgv0V/M5H8yQrcBxNXnX9z87sNf+xGlqlYDBUFKpHFu9GZmRMSrmPD qbvo1Y/9ffjjHOIgJjPDkyfYq++/Ww1gK8zL3fGb/zrS08/bTTUcz+tTjHRnPpN8AwI8 StmcfQCf42oxCgueiLYuvpR20vNUlvslm4up08bUzHAPWcGh4UgnwRZBLoGhcpujyIP1 f/C/YAY95O3FdqI9R9W9vHYNcVi6Rx5lLGjn6P3vOuQ159IfdYNbY6yV4e8vLA8oVN1Q JyVw== X-Gm-Message-State: AOAM530JjOD7lWH6SsTJoeiPG15A+1TNY1wFDfd+WSBvYeo5NnfhOO2u Ym0mIv/P13iVkLuNFRxuB3iBmdTah0WJy7uXWKvXqOpz X-Google-Smtp-Source: ABdhPJyNeEOZUq9jKxaNY/UJDehRs0DKg6yAb3IvEpZZGpuvfyV21WuuuznoBW0obva8T1fXZS10yo//i4OigMzB5ko= X-Received: by 2002:a05:6512:3047:b0:473:cf43:6d8f with SMTP id b7-20020a056512304700b00473cf436d8fmr10920727lfb.380.1652046314682; Sun, 08 May 2022 14:45:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6512:3d87:0:0:0:0 with HTTP; Sun, 8 May 2022 14:45:14 -0700 (PDT) In-Reply-To: <20220508151021.7cc0f0df@spruce.localdomain> References: <20220508151021.7cc0f0df@spruce.localdomain> From: istvan bak Date: Sun, 8 May 2022 21:45:14 +0000 Message-ID: To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: private object-oriented proxy property optimizer Subject: Re: [9front] exec suicide: sys: bad address in syscall Reply-To: 9front@9front.org Precedence: bulk thank you for both answers. i should have figured this out on my own. sorry for the noise. On 08/05/2022, Amavect wrote: > On Sun, 8 May 2022 17:38:27 +0000 > istvan bak wrote: > >> term% 6.red 666: suicide: invalid address 0x7fff00000000/1 in sys call > >> execl("/bin/rc", "/bin/rc", "-c", cmd, 0); > > You have been bitten by varargs. > > The 4 bytes of 0x7fff00000000 is 32 bits. > That 0 is a 32-bit integer. > The 0 is not being converted due to varargs. > Casting to (char*) or (void*) fixes your issue. > > See the warning when compiling this: > print("%p", 0); > warning: red.c:17 format mismatch p INT, arg 2 > This is a problem in every C implementation. > Varargs suck. > > For fun, the disassembly: > without casting (MOVL moves a 32 bit value): > rc+0x42 0x000000000020006a MOVL $0x0,0x20(SP) > rc+0x4a 0x0000000000200072 CALL execl(SB) > > with casting (MOVQ moves a 64 bit value): > rc+0x42 0x000000000020006a MOVQ $0x0,0x20(SP) > rc+0x4b 0x0000000000200073 CALL execl(SB) > > Note that run2() doesn't cast, either. > You got lucky that the higher 32 bits are zero. > > Thanks, > Amavect >