From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id 254E03858C5F for ; Fri, 26 May 2023 21:18:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 254E03858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-19eb0841830so1285847fac.2 for ; Fri, 26 May 2023 14:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685135906; x=1687727906; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tnha7Ym2GG+840VnuR3LUQPHwwNfvZzVCkXb0t4+kV4=; b=m1RZJw7LZjM8JWTh1ZthzKBQZOLprjADK3ZFarck4TwVFU6vBO94MHvAYNvHj6YnG2 wXitrMawqRc3rC6mpRQvBmrtUonSOcysMaF6EnePIbiy2d1BssV6/SKSB3v6VnFzh4Tf RTt3cXTgfwS9/utwKro+VRhdiPjFHh9M5VaC6KgoaMiLSdBNCgd7Xvb66XeeEyGhT8CN jVpeZySqxNAHAshFneYWNRSjuLfw7n+v710IQXC5rz7hYgMVrZB3H9HwOVd2FcBjYOc0 KcEDQcMcwf4FOoVxEg+PMePiFzWUUYYmJ3adb45tVavik3SxU41uOmw6mSSpdEnrwv3N qu6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685135906; x=1687727906; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tnha7Ym2GG+840VnuR3LUQPHwwNfvZzVCkXb0t4+kV4=; b=SEnHUY2NC0e7Y2hbGBUh/zqG3dd8sY9mWHYRKDAiAQU3QUZeL/WyiwhZjscCXM7pqK HrkwdfyZlFJRqVE2JkwPUCafEG6CRdfir5s2nRTwHFycrcuP0SorOCamrxV9vtLR0Cvz TYkEebe54cRxrK4MGoL/8gtOsMVzicDhiIDQq6iHqBqE/YLEubE82OCK0xPX967UHU/G 40RGd932EZKlcN9d5DJ3ICN/Meaz8ZxKsVklgn1qmsKfJAToIRRFQEZA/AGRA49CKgpV jxROUyR3M26IKpVghYB8wFF0oQp+sCcv7EnhUU3DzS+gP+cnORQ+MgYKwtGFNiS8Ftyr KZLQ== X-Gm-Message-State: AC+VfDzWdCVE42b8J2qXKUE+aZHoUh+zYPEKD+lS0n02VeaT6LUl5804 6T2SPbReu6ukkpA5AmvrTszPYEru1X1aOvRPmvk= X-Google-Smtp-Source: ACHHUZ6qFtwIeNFZxG6g1diORpiI6woQdbKdhp7WkD/JnAU7s8P8kju5pKMhLe/kXp0uKJYQznbD/TehUq0jpQXdRs0= X-Received: by 2002:a54:418c:0:b0:396:3860:166f with SMTP id 12-20020a54418c000000b003963860166fmr1748788oiy.29.1685135906360; Fri, 26 May 2023 14:18:26 -0700 (PDT) MIME-Version: 1.0 References: <20230424150353.1469397-1-josimmon@redhat.com> <20230424150353.1469397-2-josimmon@redhat.com> <20230525180743.GN176347@oak> <877csvk1zt.fsf@oldenburg.str.redhat.com> <20230526125947.GP176347@oak> In-Reply-To: <20230526125947.GP176347@oak> From: Noah Goldstein Date: Fri, 26 May 2023 14:18:14 -0700 Message-ID: Subject: Re: [PATCH v6 1/3] x86_64: Set the syscall register right before doing the syscall. To: Joe Simmons-Talbott Cc: Florian Weimer , Noah Goldstein via Libc-alpha Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, May 26, 2023 at 5:59=E2=80=AFAM Joe Simmons-Talbott wrote: > > On Fri, May 26, 2023 at 09:04:06AM +0200, Florian Weimer wrote: > > * Noah Goldstein via Libc-alpha: > > > > > I'm minorly opposed to this patch. Even if GLIBC guarantees all > > > syscalls will set the number the instruction before, that's no guaran= tee > > > for the entire program. Furthermore in the event of: > > > `movl $VAL, %eax; syscall` > > > It's still not safe to *always* assume that `VAL` correspond to the > > > syscall number as a jump (direct or indirect) could still go between > > > the instructions (i.e there is no guarantee in the assembly that the > > > `mov` dominates the `syscall). > > > So at the end of the day, we are bloating the library without, AFAICT= , > > > providing any real guarantee. Maybe I'm missing something? > > > > Joe, is there a size change to libc.so.6 as the result of this change? > > No, the size is the same with and with out this patchset on x86_64. > There aren't many syscalls so it's only a minor cost (hence the only minor opposition), but I don't see the value this provides given that it still won't be safe to assume the syscall number is always set the instruction beforehand for any robust purpose. So it still feels like why take any cost at all? > Thanks, > Joe >