Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp2892797pxb; Sun, 20 Feb 2022 03:50:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyA/P7CeCC7UIvqTp95lz9R837K/E22Oz85F4e+pJgIOBjswg7+eGDFx0eeYVncVYsDdU4J X-Received: by 2002:a05:6a00:2313:b0:4e0:ffa7:bbe0 with SMTP id h19-20020a056a00231300b004e0ffa7bbe0mr15508852pfh.53.1645357837338; Sun, 20 Feb 2022 03:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645357837; cv=none; d=google.com; s=arc-20160816; b=szPfRzt2miV7pFyEHYYICOJ/RQt0xyGt//5jyqy9sR6rGUJJ4bpMy6ktNVpNdOdrBN 39PaLW0JHYCq3mcPfAYw+3yzC3ZZkNDly9gzXXrUMSArAeRb0WYooXIumjBO751yo4Yn Hd56mSaDHAo3WSTAxWDr3QVcY333S46I14X26NcUJfwtcXc0mMQODQH/W+DcmDkbg8q7 F7Ov92MPVgrYA8lPgElCjxV9cWvffPa0+/f8+/wQd2tHSotU4z/cn+K/vQbL5m+ojvWz ghUI1JyKdK6V4NakdDfnYQLSZFisVPPVtG09eGAyImV0yq0kpq00KAAommHvFF+S/b+Z A4sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=e48rbRghZ1DHjEo5oAQPObeUfspj3j2bBv68xgwxZDg=; b=dfgZt0KlidnTPhn1LAwIqMLWvLLAiMI5B5KbOx97ibuXSjG3UfAkdTHA2gv6Uc6XKB +3iLPJWjnposlKGUVjYdKGy21ebwa32tuYZrvUTXHq7tuzeMdKc9fcVPkXmgLPei9Jkl 4xQRbTC6txCeAnRYE3E5wTIMIxCsq4XWhc41sVz4OYXqB2xnjy/XDXLQLLBKo/6rUkF3 mA0h2ym66VKxRI9gyTlq4QEm0RTBdeyOQpyMBo7cVLtj7zBQywn+jJpx9xGC970ArKH2 7zfq+M4SbAPikqgDkvnZgvBoDN3380cU1h8ge9SZoaDKZrTlJePWAPAom6hamP5E0I6j RkpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=B6b07vv9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot12si4496977pjb.66.2022.02.20.03.50.21; Sun, 20 Feb 2022 03:50:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=B6b07vv9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238474AbiBRRZK (ORCPT + 99 others); Fri, 18 Feb 2022 12:25:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236548AbiBRRZI (ORCPT ); Fri, 18 Feb 2022 12:25:08 -0500 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90B9C2B5B8A for ; Fri, 18 Feb 2022 09:24:51 -0800 (PST) Received: by mail-oo1-xc29.google.com with SMTP id o128-20020a4a4486000000b003181707ed40so4259307ooa.11 for ; Fri, 18 Feb 2022 09:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=e48rbRghZ1DHjEo5oAQPObeUfspj3j2bBv68xgwxZDg=; b=B6b07vv9/aGPNg6S485OaHdVCheTvWziFVBg71SY0DOhjK7WDiRUJjBrnomP+yCPKi beF4zz1XqIgM7q5h2UVDA+K8EpzE3Sl+CMTCJsteOe3Uff1qUlw2cMEnQbQdzGIJxrky h5S4rMM94onJIbUS4+dMB/YhGIoP9j4x5M9nwUrrPXfqWDeBDAMIELL3VvvxGvWgqMyN 2sDxR/EXKyqEFQuyCKBLH5dt6DZfY+nJuWLYklzfI6v5JzlhIXSdACTerkZmhXouMGIK Sr3GDvB6hVLLANmcqhh1hmdwzXn9Dh8nOcvYbLVllThUGCpHBQn80TLrYsdpNN2UshO2 C4WA== 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:content-transfer-encoding; bh=e48rbRghZ1DHjEo5oAQPObeUfspj3j2bBv68xgwxZDg=; b=D+ndWlFU3Erck1MEDLFtdOcaH0ux3vTpmMNGZ/O0Febseah3WG5bCFflbYUIgaqpKz AIbd6n127WdH+430NrB98wIsSmy9p+odfOnw3OnGMgSSgCxKQpN03+eRvaWHKZi3qEpT XcJf+K8lHYw+7q7e9GVEJcBoWZsaq53VZmzS332W+Kdmp7hW/PIPtpTtqs1IrX5y99GK iXY/q59kE56Rd9KHnhRnbE8pOeVqalLlugq93StiFFtigbfCdKUeBkoqIANTLh8tq935 H5Zg32NOf0hh+QumSbQv6AjfNSFqYQyaIBs0YKVMOIHnHc4wuwLqNUruVp1fyxP/oY5Q oSIQ== X-Gm-Message-State: AOAM533c2Bdn57yz7SPsVys4IOy0QgdqHwtCx9KvdRgyeEcXgmhAkxYq 6dvJi67yvtAfnHNq+ATDx0bjs5qPkZdt22kkwk8gzQ== X-Received: by 2002:a05:6870:3491:b0:d2:48b5:7a4c with SMTP id n17-20020a056870349100b000d248b57a4cmr4553827oah.288.1645205090740; Fri, 18 Feb 2022 09:24:50 -0800 (PST) MIME-Version: 1.0 References: <20220217142133.72205-1-cgzones@googlemail.com> <20220217142133.72205-3-cgzones@googlemail.com> In-Reply-To: From: Nick Desaulniers Date: Fri, 18 Feb 2022 09:24:39 -0800 Message-ID: Subject: Re: [PATCH 4/5] selinux: declare data arrays const To: Paul Moore Cc: =?UTF-8?Q?Christian_G=C3=B6ttsche?= , selinux@vger.kernel.org, Stephen Smalley , Eric Paris , Nathan Chancellor , Ondrej Mosnacek , Jeremy Kerr , "David S. Miller" , Lakshmi Ramasubramanian , Yang Li , Austin Kim , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 18, 2022 at 8:13 AM Paul Moore wrote: > > On Thu, Feb 17, 2022 at 9:21 AM Christian G=C3=B6ttsche > wrote: > > > > diff --git a/security/selinux/include/initial_sid_to_string.h b/securit= y/selinux/include/initial_sid_to_string.h > > index 5d332aeb8b6c..915283cd89bd 100644 > > --- a/security/selinux/include/initial_sid_to_string.h > > +++ b/security/selinux/include/initial_sid_to_string.h > > @@ -1,5 +1,12 @@ > > /* SPDX-License-Identifier: GPL-2.0 */ > > -static const char *initial_sid_to_string[] =3D > > + > > +#ifdef __SELINUX_GENHEADERS__ > > +# define const_qual > > +#else > > +# define const_qual const > > +#endif > > + > > +static const char *const_qual initial_sid_to_string[] =3D > > { > > NULL, > > "kernel", > > Thanks for this Christian. I generally like when we can const'ify > things like this, but I'm not excited about the const_qual hack on > core SELinux kernel code to satisfy genheaders.c. I understand why it > is needed, but I would rather clutter the genheaders.c code than the > core SELinux kernel code. If we can't cast away the const'ification > in genheaders.c could we simply allocate duplicate arrays in > genheaders.c and store the transformed strings into the new arrays? Note: casting off const is UB. I've had to fix multiple bugs where clang will drop writes to variables declared const but had const'ness casted away. --=20 Thanks, ~Nick Desaulniers