From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by sourceware.org (Postfix) with ESMTPS id 4E4303858D35 for ; Sun, 17 Oct 2021 23:35:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E4303858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=moxielogic.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=moxielogic.com Received: by mail-io1-xd2b.google.com with SMTP id y67so14133174iof.10 for ; Sun, 17 Oct 2021 16:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=moxielogic-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Wx79dvA4HScUbmw7fRoXwVukth6twLvgLlEzuco49Cc=; b=YEGjsqrHAjWqPzNEdDhw9JnuilLpQEutw7Z7K8eWqy0+4iQ1BULpMCoTQWbTHQ30Ku GFTmZf4s04BAEWxsvFUsC+d3jcV+ZVx1hhOcNiqdE9UkGF+YlniL+mMrZezOVYHT+tOp cRjS22X61JvfIpJuMW92uab9KYcmJ5HN4R1Ik84XXfLFqaaJWXsgIUKLnKETklSVOsY4 GEJVE2NKNXzsTpO1j0mhT7apobKfZfN7utMVtF3GSouODvuKGJVa9UQBcdLyx6kXEd2E OpRRzxqqQphnShoRBN7norAgj6wYUzoX+F6CPpdqZYAiIrQIlFCZR2X+ky5cUC/Zxa+U rAkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wx79dvA4HScUbmw7fRoXwVukth6twLvgLlEzuco49Cc=; b=4LdkwilYM5vrVrS0xnwtYQ27Sf2PMBYGA8XPLfCtsvuu1fOPLwWAWCGvwmSVeCyjyn LSJ4/MuOcqrLozgNaN8jlLbfD67GwBAUBgwzaumXlM5lnp6CdiD7+setE1qLYM93u98b cKmiTS4GK/mS4tcYnz48zVPqNrHl2XfguhrLA92ylZzd7qoymUNJeWLMQA2jBNK9HGpO M4bVG4XP+5WQBoAQsQw5Np9zxyn5M5WiTil0Gj8MewPClsEldAxZ6GijTJkRy2hkaQAD l7nmj0cF1mrK0ifm76QgVCFYeOrhTOJcw1+BHYOMIWChTmJkpePusgpyNuKK5zbmaK56 FacA== X-Gm-Message-State: AOAM531CWJzR6Vbd31HOhJwXxtLCbzzCIMsKz9hdOAbbde2oS5ve/l7y xd2DTOF94Fld3TEMrOlCE5eAQVR0aaamTEp2S8EziGyIo0qvISy9 X-Google-Smtp-Source: ABdhPJw93rkVRSCitlzQtJj99pnRmkqXWtDw65jJO/eWI7vkGtI2TIjGVy+Idj7aYEuYZAenpruzJpc0gfWU9118Uf8= X-Received: by 2002:a05:6602:1410:: with SMTP id t16mr12080373iov.160.1634513739718; Sun, 17 Oct 2021 16:35:39 -0700 (PDT) MIME-Version: 1.0 References: <9362563f8803f575d00c03835d2897b3836a7645.camel@gmail.com> In-Reply-To: <9362563f8803f575d00c03835d2897b3836a7645.camel@gmail.com> From: Anthony Green Date: Sun, 17 Oct 2021 19:35:29 -0400 Message-ID: Subject: Re: wide function pointer type To: Martin Uecker Cc: libffi-discuss Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libffi-discuss@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libffi-discuss mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2021 23:35:41 -0000 Hi Martin, I haven't read the whole proposal yet, but I'll try to this week. I did, however, read the first paragraph, and it says: "Trying to use regular function pointers for callbacks with data requires run-time code generation (e.g. nested functions in GCC or XL C, and closures in libffi [1]) but this is complex, inefficient, and problematic from a security point of view." This is no longer true for libffi on the important Linux platforms. We use static code templates that are placed in memory at a fixed, predetermined distance from the data they reference. There is no runtime code generation. Well, to be fair, perhaps it is still complex, but it's far more secure than before. Thanks for sharing. I'm not a language expert, but I know others here are. AG On Sun, Oct 10, 2021 at 7:32 AM Martin Uecker via Libffi-discuss wrote: > > > > Hi all, > > I will propose a wide function pointer type (actually > a wide function type) to WG14 for C23 as a common > type for callbacks, closures, which now require an > additional void pointer argument in C APIs. This > is intended to be compatible with ABIs with now > use a static chain register. > > An early draft can be found here: > > http://wwwuser.gwdg.de/~muecker1/wide_v4.pdf > > > I thought you might be interested and I would love > to hear your feedback. > > Martin > > >