From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by sourceware.org (Postfix) with ESMTPS id BB1243858D20 for ; Tue, 30 May 2023 12:16:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BB1243858D20 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-oo1-xc31.google.com with SMTP id 006d021491bc7-5552cbcda35so2151165eaf.1 for ; Tue, 30 May 2023 05:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685448966; x=1688040966; 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=rHXFGr7qiee4AaA+7zHd6m08pfncAgK9A35AqsNxKVo=; b=a2YVwdEY/IfsE57pZ8L6LGr68teAI5rUm+Dvzv72rusocY/x6A9wdjfmHywygxLinL o2pJ/2ZSnPSb6dfi65t8nI9xmrS6TzbmrWurePY/74ywWc73zmo2iUH6KdeJvKTwwpwl 86zge+qV1edNpHnKPiRvShZ2u0LE97ps16pGy/Phb0uEyuwnEqvxXOx2hVH3+aGOMewT ic28HORwjDCmAgUofPdRP636kIFuOZ3ANDkm0qnCYfaGge5yTFTQOFqsNF4EQjt7JYi9 1cv6Oob3MHW6dOGAdDZlG41+dAzku8rK29pZkEjQZtWbtahoQqkAHQRnvSwEFT+MF2V/ W2Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685448966; x=1688040966; 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=rHXFGr7qiee4AaA+7zHd6m08pfncAgK9A35AqsNxKVo=; b=kF+8oJ5jBId4oyz7+nHjQsZslxMxq33RPfiYOtJ/1FJguQbt92G7PIvo4iLshERus0 2mtJUg1BCAwdqRrorMag3aGGskLkq1taTPJ3V3dSAix+olZQuoWBI3lpl6wpbStF7teg GOMWkpgY0ms6T/JYezlQk+96hyiL/21yfUoqDYAT8ZRxUUEv4Pnl4sjsZhS+On77dzrk mkErdOY3HJEYOBghZWA3MHRIWoMnFqtVHAeQbPaenqBf+NkRZiakzYnVxZzzZrl6V92k FaBhpksukq5Pecm38QTy+Z2F9onq/JO2wnLckwZyOzBpO5XRORcdHGUBcf40zLtfoNlx BNdg== X-Gm-Message-State: AC+VfDyXo9Hz5npTRhnNLyA08iUXWGXnmZoGmEXsPJWgbJQjQQGYNvmo 2i3MPEH1v8P6mT4UzNFQfwY2ajNg8V0prq1MIgB1ZEuBpOo= X-Google-Smtp-Source: ACHHUZ4Ces/6VDm+vDrnBNr4XUIBGhjMJylHCFDu7Lu3BEso8ed121WQ15wPO/YxM/xF4ghVJXArgYZ4X5RolWLG3cY= X-Received: by 2002:a4a:4f46:0:b0:555:7d66:552e with SMTP id c67-20020a4a4f46000000b005557d66552emr805599oob.2.1685448965830; Tue, 30 May 2023 05:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20230528172013.73111-1-bugaevc@gmail.com> <87wn0qw88m.fsf@oldenburg.str.redhat.com> <878rd6uleb.fsf@oldenburg.str.redhat.com> <87v8gat4u8.fsf@oldenburg.str.redhat.com> In-Reply-To: <87v8gat4u8.fsf@oldenburg.str.redhat.com> From: Sergey Bugaev Date: Tue, 30 May 2023 15:15:54 +0300 Message-ID: Subject: Re: [PATCH v2 0/3] fcntl fortification To: Florian Weimer Cc: Siddhesh Poyarekar , libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.4 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 Tue, May 30, 2023 at 2:50=E2=80=AFPM Florian Weimer = wrote: > That suggests that we should apply __builtin_constant_p to the result of > the cmd check, and not the cmd value. So something like > > (__builtin_constant_p ((cmd) =3D=3D F_DUPFD || (cmd) =3D=3D F_DUPFD_CLO= EXEC) > && ((cmd) =3D=3D F_DUPFD || (cmd) =3D=3D F_DUPFD_CLOEXEC)) Interesting; we could probably just do __builtin_constant_p (__fcntl_requires_arg (cmd)). I'll see whether that works. Do I understand it right that you don't want there to be any runtime check for this at all? In other words, should I just drop __fcntl_2 and always call __fcntl_alias in case we can't decide statically? Sergey