Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5214193rwd; Sun, 18 Jun 2023 07:21:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ydlJpgvus4QiE0YmBrUmXEf44QwNIRzZVarjfp/l7fpYTo7+hjhpGPJxBm4Za6DK1VhZ3 X-Received: by 2002:a05:6a00:2308:b0:661:237d:6c1f with SMTP id h8-20020a056a00230800b00661237d6c1fmr8330084pfh.3.1687098108562; Sun, 18 Jun 2023 07:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687098108; cv=none; d=google.com; s=arc-20160816; b=jqUVMoYhu7//jLTgWI2BzVLLbZzYhpfcRKfwh6j6NrTv0uux5kZPeZ21pfnlP+YRcI 1rBSD66WH6owRc7CTLxWbAOlq4OEuG+CdKMGajlbo/Ptp0gR6klqiTz+dZfG3eIYe6SF HvAPJGR0Thu2aaahGxvpxViOU/L7O/ViEqMoK0vDvx3ncxM+B2wnYhUcW4UaUj2aOgko yh2b2b44EoByFCHYElOm6ChW0D0D3LbxO00q9coKxLhjsj4iSyLu9F7zyimxlqww4ZdG EBp0KEPK7dTnwMxH9DCVB53FCWsv0uQLS7kwqtEGRmMlNnEzBOVJqRDRiHxAw1lh0JIv LxTw== 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=UKngzCbi/z0YczLfmgJ8G+89JRu+Tx99q0y6rf+xc3g=; b=qVB3T4vSierXORyhVhHDILGjveoWtXXmpGlmGz6uBp50wB5dAjFRkn9ONoDMs+4Fkc lLtLXd0IlZRwsH8scYFZ5OiINtF0S8kCm3Vyf/XWeHvvlpqddNBZ+9tusIiGL0xiFHIR z8x/sHfd/gjcz0hFCFBo2SNIAIzCkWYto2C8QBlOr/jnaAUyydvPaOMJigL9CR21ZfnN pgm6mo450mr3LyUb8ZRQIW1klJoAhoyjIWJRyQqpyQfWHeDOP45YtHgc9DiYnKOPDer/ sHUuPfFvdGJjGhPvdkgx88kDQSLwyvdb5yQ4/DvI/wqhBZu8oxOUer38fPo7vmU0GoD0 xnyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VaAic+1r; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v127-20020a626185000000b0065bbe39e1b3si15990713pfb.146.2023.06.18.07.21.29; Sun, 18 Jun 2023 07:21:48 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=VaAic+1r; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbjFROU2 (ORCPT + 99 others); Sun, 18 Jun 2023 10:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjFROU1 (ORCPT ); Sun, 18 Jun 2023 10:20:27 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 508D9E71; Sun, 18 Jun 2023 07:20:26 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-bc4f89f0f2fso2770040276.3; Sun, 18 Jun 2023 07:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687098025; x=1689690025; 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=UKngzCbi/z0YczLfmgJ8G+89JRu+Tx99q0y6rf+xc3g=; b=VaAic+1rlhUTFVg7WGWjD/PM++B/69nK3R1DcgWj7rqNxpw4yV9fuUWKfpqgtW/K7I Jku2fodUUoezlMprvokwNK49VRwuEDr/JdcXT2eyuPymQU/KU44RR6E4F/VCjvAoxDk1 KrGyx51eGhHP3KY8eiarxseURUuPzQcRrZnqyy8Wh1wskYRfipZKy11JzbyD16UzaKvC nsVkqLniY3F1bfuJP/l8ILPUL5tUoOJ/pHmFBOxEGlZGVPMIk7aUfKcOWy+M2DZ9RWfc Y3uvvy4nQTH4yi9lyWQ0OCifbD4zzFYRwWNQVmJHCU+m8tyCaeCz/eCA8ppT0z0pCwT+ +7NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687098025; x=1689690025; 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=UKngzCbi/z0YczLfmgJ8G+89JRu+Tx99q0y6rf+xc3g=; b=D0kaFF39C+VFt5VI7fqDkIluUMvHoPbYRHYeKLXblpj/np29WrQ/fpac4AnnH5t8Qf B6LzI/gDJluKcGrJlnT80r6peVaYdXeypMsV7mLI0eILLfDbG+a7U/9JsLnU3TyRSdaP ZcPIXRJxwUb51OK0jv/UzzuGgryZjQ4s7JjUwO5wH6Sge9b2ZnZiXRAkaJW5brQelWod dF5elm39xFCKqY3CyBKUd1YDANMXgEZ8BP1WP9ia5Z34NSDqhygG5SeXyLf/uVF6kTuk tu91+29utLSVvrZW5+T3CYlQnwnD/Z6fowYFwSqejHoN6K/FCOyILfOmQq1gnHo+rsOp x8CA== X-Gm-Message-State: AC+VfDy/4iYq571isZ7AYP8qHYNwKk0iYqna6UTb1pd0cLeVjcTLEe+8 zPxwBNliZRAd/WzE24CzwqbURpXiVTWWO4wecxw= X-Received: by 2002:a0d:eb93:0:b0:56d:805:1507 with SMTP id u141-20020a0deb93000000b0056d08051507mr7753300ywe.16.1687098025485; Sun, 18 Jun 2023 07:20:25 -0700 (PDT) MIME-Version: 1.0 References: <20230529052821.58175-1-maninder1.s@samsung.com> <20230529105707epcms5p1418eac680ebe1736196706b0db80dd39@epcms5p1> <202305301611.34F0A680A2@keescook> In-Reply-To: <202305301611.34F0A680A2@keescook> From: Miguel Ojeda Date: Sun, 18 Jun 2023 16:20:14 +0200 Message-ID: Subject: Re: [PATCH 1/1] arch:hexagon/powerpc: use KSYM_NAME_LEN in array size To: Kees Cook Cc: maninder1.s@samsung.com, Steven Rostedt , Masami Hiramatsu , "bcain@quicinc.com" , "mpe@ellerman.id.au" , "npiggin@gmail.com" , "christophe.leroy@csgroup.eu" , "nathanl@linux.ibm.com" , "ustavoars@kernel.org" , "alex.gaynor@gmail.com" , "gary@garyguo.net" , "ojeda@kernel.org" , "pmladek@suse.com" , "linux-hexagon@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Onkarnath , Wedson Almeida Filho Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 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,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 31, 2023 at 1:14=E2=80=AFAM Kees Cook w= rote: > > On Mon, May 29, 2023 at 04:50:45PM +0200, Miguel Ojeda wrote: > > Kees: what is the current stance on `[static N]` parameters? Something = like: > > > > const char *kallsyms_lookup(unsigned long addr, > > unsigned long *symbolsize, > > unsigned long *offset, > > - char **modname, char *namebuf); > > + char **modname, char namebuf[static KSY= M_NAME_LEN]); > > > > makes the compiler complain about cases like these (even if trivial): > > > > arch/powerpc/xmon/xmon.c:1711:10: error: array argument is too smal= l; > > contains 128 elements, callee requires at least 512 > > [-Werror,-Warray-bounds] > > name =3D kallsyms_lookup(pc, &size, &offset, NULL, tmpstr); > > ^ ~~~~~~ > > ./include/linux/kallsyms.h:86:29: note: callee declares array > > parameter as static here > > char **modname, char namebuf[static KSYM_NAME_LEN]); > > ^ ~~~~~~~~~~~~~~~~~~~~~~ > > Wouldn't that be a good thing? (I.e. complain about the size mismatch?) Yeah, I would say so (i.e. I meant it as a good thing). > > But I only see 2 files in the kernel using `[static N]` (from 2020 and > > 2021). Should something else be used instead (e.g. `__counted_by`), > > even if constexpr-sized?. > > Yeah, it seems pretty uncommon. I'd say traditionally arrays aren't > based too often, rather structs containing them. > > But ultimately, yeah, everything could gain __counted_by and friends in > the future. That would be nice! Cheers, Miguel