From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Mmx5Wtfl; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 69F0E5A0625 for ; Sat, 25 Apr 2026 23:03:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777150987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YQ+JFbyNEnGQx+JXiLDaM5gJWe5BTiyEwKphupamje0=; b=Mmx5WtflYynnmeE9PRZbmGBByOEJKikK/DCztT2fSW1nXO4fVVA0XVhV7YJzlrpoabU9pJ 0o+pQXjkEayDwvLz4t9bIjuKvBdKHE0gtGryYV2m21G9KTjeqUrC089yuO4ThAnEJ3pyXK ca8nKTEOY+nb0N8t6LCr7NY5jArmYJA= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-284-NhMHLIZKNYaIK8Y8FgOedw-1; Sat, 25 Apr 2026 17:03:06 -0400 X-MC-Unique: NhMHLIZKNYaIK8Y8FgOedw-1 X-Mimecast-MFC-AGG-ID: NhMHLIZKNYaIK8Y8FgOedw_1777150986 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-8acafc224a8so221849686d6.1 for ; Sat, 25 Apr 2026 14:03:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777150986; x=1777755786; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YQ+JFbyNEnGQx+JXiLDaM5gJWe5BTiyEwKphupamje0=; b=XdEJAWUyXxHUgrlH9mA9iSRMm496fJC1UukRTb9+8Bep3ddYHzr4YuS61miwj8uVdu vSg+oJqW2tcIMXcXY/bedygVJyyZY6Si19VOU6F9/sjELun+h/rFuZsNXh4Uy4xVG2Xb N1s3oT1jXby5Hh9a4BPrnxKU5fUl2ONwpNSueYFLTMMGDBNLn1p1XMOzRUgXzkKP9G3a r0NG83deMpkudE9Se1nM2iG6fKheVy4b8usQsHxJBGceqCnuMLVNf4tC6bJf0O1F8kp6 RaxjWw6mUW8BVGGQ+8yazwDqd2VDFkwGb+Cd3cehaISwCCD+USgtDAovs0B4fz+xMeja g3oA== X-Forwarded-Encrypted: i=1; AFNElJ86X0kqNM1wvo+A9avx6KjndI4R62Ot4t2MqqcM0t4AB/byX018CwwZxsvnzbT1Qr9ld1I8ZpBsbUE=@passt.top X-Gm-Message-State: AOJu0YzXYa6VPVGHCDPdtW8n8M+7nqzjchAw+7bUo4JO9GPU4p+tjyzA ig3SLq4bQd7r4QuvirEXEyUGUsi7CDvEU7edEN9n/exlkDVXWDRtlW0LiaaxuBEXO4h1+90dG3r Q3xPuyOPF7dNO0Vsg1jtWXOiZRRvjIB9dzcWR0rZQLhL/SCd536dmGA== X-Gm-Gg: AeBDietuRbUm+Uk5Rje1JOS4L36ptWjQyZoleBETXtHlxL6CmS4HxBHJBB9y0Q2nGtm 6kvFajJV8+IHEbaqECrrn9xmITvFrQVH9Pl08uIPdZRF9CntiK76sbb+irqMN4TMTCWHNcHarol s43BxUgcA22owAEJ1cOqpb+i8D5lewKrFbw/6yoTsi5TWEA1tx0K4k/QLqfsLd0GPfA/tuvBUfF XmogCLpZ5xV9MfF12GsJW8iT2OKRb95no1DJRw/GyfIKFrlBFTqPDAKtDim6Zcr3qcLshR3TeUZ 3up7n6XzqKdtjpMKtK3vBb5TrrLTUcwSjJMdpCO5j+RPusykYmMzzvwHA6IOhJtRSkqqreZTqcQ XzytJZbUrylgkCu7Bs37OwWUAwhKiUwVif6roxHShXUwt1qSosa+1LvnNWMiUePkDzcILAy72AK lgsebRF/LsMY26B9SVKC05ris= X-Received: by 2002:a05:6214:2a45:b0:8b1:f2f6:33b with SMTP id 6a1803df08f44-8b1f2f60555mr341659026d6.22.1777150985995; Sat, 25 Apr 2026 14:03:05 -0700 (PDT) X-Received: by 2002:a05:6214:2a45:b0:8b1:f2f6:33b with SMTP id 6a1803df08f44-8b1f2f60555mr341658656d6.22.1777150985511; Sat, 25 Apr 2026 14:03:05 -0700 (PDT) Received: from [192.168.2.15] (lnsm4-toronto63-142-116-28-118.internet.virginmobile.ca. [142.116.28.118]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8b02ac72915sm223566106d6.15.2026.04.25.14.03.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Apr 2026 14:03:04 -0700 (PDT) Message-ID: <8fe5123e-2594-48cd-a94e-62f4c03a4dab@redhat.com> MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 06/17] pif: Limit pif names to 128 bytes To: David Gibson , passt-dev@passt.top, Stefano Brivio References: <20260421044217.2500314-1-david@gibson.dropbear.id.au> <20260421044217.2500314-7-david@gibson.dropbear.id.au> From: Jon Maloy In-Reply-To: <20260421044217.2500314-7-david@gibson.dropbear.id.au> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8rG2g7LA6eFkyiEXaYsP5Xz--fuobrGIYV-tzEVSXKk_1777150986 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MailFrom: jmaloy@redhat.com X-Mailman-Rule-Hits: emergency X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved Message-ID-Hash: BGKI5OIDWZAJEYTNXUY2FJDXAQ3QMNRQ X-Message-ID-Hash: BGKI5OIDWZAJEYTNXUY2FJDXAQ3QMNRQ X-Mailman-Approved-At: Mon, 27 Apr 2026 09:47:04 +0200 X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Date: Sat, 25 Apr 2026 21:03:09 X-Original-Date: Sat, 25 Apr 2026 17:03:03 -0400 On 2026-04-21 00:42, David Gibson wrote: > All current pif names are quite short, and we expect them to remain short > when/if we allow arbitrary pifs. However, because of the structure of > the current code we don't enforce any limit on the length. > > This will become more important with dynamic configuration updates, so > start enforcing a length limit. Specifically we allow pif names to be up > to 128 bytes (PIF_NAME_SIZE), including the terminating \0. This is > more or less arbitrary, but seems like it should be comfortably enough for > all the cases we have in mind. > > Signed-off-by: David Gibson Reviewed-by: Jon Maloy If you fix a typo below. > --- > pif.c | 2 +- > pif.h | 5 ++++- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/pif.c b/pif.c > index 1e807247..d5e31613 100644 > --- a/pif.c > +++ b/pif.c > @@ -17,7 +17,7 @@ > #include "inany.h" > #include "epoll_ctl.h" > > -const char *pif_type_str[] = { > +const char pif_type_str[][PIF_NAME_SIZE] = { > [PIF_NONE] = "", > [PIF_HOST] = "HOST", > [PIF_TAP] = "TAP", > diff --git a/pif.h b/pif.h > index 7bb58e5c..90dd3a32 100644 > --- a/pif.h > +++ b/pif.h > @@ -35,7 +35,9 @@ enum pif_type { > PIF_NUM_TYPES, > }; > > -extern const char *pif_type_str[]; > +/* Maxmimum size of a pif name, including \0 */ s/Maxmimum/Maximum/g > +#define PIF_NAME_SIZE (128) > +extern const char pif_type_str[][PIF_NAME_SIZE]; > > static inline const char *pif_type(enum pif_type pt) > { > @@ -43,6 +45,7 @@ static inline const char *pif_type(enum pif_type pt) > return pif_type_str[pt]; > else > return "?"; > + static_assert(sizeof("?") <= PIF_NAME_SIZE); > } > > static inline const char *pif_name(uint8_t pif)