From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bird.elm.relay.mailchannels.net (bird.elm.relay.mailchannels.net [23.83.212.17]) by sourceware.org (Postfix) with ESMTPS id 217DA3858438 for ; Wed, 24 May 2023 11:46:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 217DA3858438 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C0914261E70; Wed, 24 May 2023 11:46:57 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 31107261843; Wed, 24 May 2023 11:46:57 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1684928817; a=rsa-sha256; cv=none; b=zhPFv2drV/M0eEC84NmqdbIBebTBF9seyZv+zEg4itYjkr59XaHmgD3rPwwuNbmXxU7zcM p/YTApvlCLtvqe61BIVEFzG1dRzGVa9MGp3kasd2GiZ8bVozFwePxF/tfnRTo0JJi9bCqG wWjLX3KJORJvwBXHeAOD+is3XoMgUy/YfBTaKFa5KlMCPrbEjLfEPkQYeZlGC02bHHRGCK Qa+Ro6fseA3xNBb0vNbt/+wVjMl2LQb6A26hIhFxki2wrFVxwqaDWuXUgEnWq2JcxnT27o SlwbgWWxEXTiE88DqDm6BoRfsjRnmptd0a9dF5z6+m++OrTlFyko2VBZhzqaqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1684928817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kTyPIaYLP315g7/HvSZHyPp3PHc6yL1fN1zZxF31nPk=; b=6eaB83gQqRL6NQbLjrXH58lxJNpk0tCls6HtChJtQAKUIm8aEZvRz3As3Vadeg2wyGOFp1 CVe4p04l2n8zUsDdYBkhZAruJzpHjhS4HhvwfWSD5/qenqtwawrVG5hRGRSnTTJHS6RLUT dF2DkWBPblpJcOQLu/XkTbI3EKJbLQdHjfaoR31923MKHghcjjJT0CMBaBCdrz2lS0qijS zMzgFnZPzCWV6RKhPgUfetFEU0ZpJDWd1LfFrgdHxRCOen1P9vrKPblKQThpzemJIQ+dg0 KYZLjlh8o/G+R+SkSeE9ylGDGfDfjm+tP/tB/yt2Cgz3dUlVVg06Ly549bzBsg== ARC-Authentication-Results: i=1; rspamd-5cdf8fd7d9-zsblk; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Keen-Ruddy: 7cfdd3731cfa22cc_1684928817482_448749525 X-MC-Loop-Signature: 1684928817482:4101472324 X-MC-Ingress-Time: 1684928817482 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.104.24.179 (trex/6.8.1); Wed, 24 May 2023 11:46:57 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-02-142-113-138-85.dsl.bell.ca [142.113.138.85]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4QR8YD5NZ4zm9; Wed, 24 May 2023 04:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1684928817; bh=kTyPIaYLP315g7/HvSZHyPp3PHc6yL1fN1zZxF31nPk=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=j7VYr6CNd11i6Qgr8x9z/ix01I24YejU3BmCrvSvU4P00YB9Puo/btADXLNFcfQbK AL7ktSTlBpRdkPcHmHW23H3UjmACEzJj1qP87wQTj4+j10e6bWHkQ6BmNtZg6tCB2t 2px/nvPRCLrN+zU4/0fZIDhq9/3rj2bxDZLLGXc0Qotp0xmZr/eefD7wu9Kf4sbIM6 OiHp8FaIDS9HPuaG063yx2yzFJbSUyC2TCC4EkXIFc+DVgdTK6QuibZ1vcaPe9yJx3 A7bQ+5OKU8DaBl1NEuyaG9wCACqXt7E4lxqLfoGun1mtU5QJ07OZ8GHAPXz4aQi4Vr eIAoGTXLqgZfQ== Message-ID: <6831d3d3-786b-2ac3-5abf-dce24aa158a7@gotplt.org> Date: Wed, 24 May 2023 07:46:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments Content-Language: en-US To: Florian Weimer , Sergey Bugaev Cc: libc-alpha@sourceware.org References: <20230519213059.3812385-1-bugaevc@gmail.com> <20230519213059.3812385-2-bugaevc@gmail.com> <871qj6202r.fsf@mid.deneb.enyo.de> <87fs7myvxm.fsf@oldenburg.str.redhat.com> <87zg5uvuyz.fsf@oldenburg.str.redhat.com> From: Siddhesh Poyarekar In-Reply-To: <87zg5uvuyz.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3031.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 2023-05-24 07:18, Florian Weimer via Libc-alpha wrote: >>> IIRC, it doesn't quite work because __builtin_choose_expression only >>> suppresses errors, but not warnings, in the branch that wasn't chosen. 8-( >>> >>> Maybe this is something that could be fixed with _Generic, using >>> __builtin_choose_expression for the __fcntl_is_void check only. >> >> Yes -- I've sketched something up using _Generic and it appears to >> work great: https://godbolt.org/z/8zdzo3T5Y >> >> It does do preprocessor trickery ("friendship ended with >> __builtin_va_arg_pack_len, now __VA_OPT__ is my best friend") and does >> not use __builtin_choose_expr at all, so should be C++-compatible too >> (try with -xc++). > > Right, it doesn't look too bad actually. > >> This, too, is obviously a prototype, and does not do runtime _2 >> checking nor 64-bit handling and so on. >> >> What do you think? Is this direction worth pursuing? > > I think so, yes. Please be sure to make the _Generic bits conditional on __USE_ISOC11. Thanks, Sid