Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp482585rwp; Wed, 12 Jul 2023 17:07:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlHLK5oldvKvMBOqOm2OiR63i50MPRB3Dg57arRB/Sv7KLlu1zZEbwGoZQvS/dAOo3NIzYvx X-Received: by 2002:a05:6512:409:b0:4f7:3ee8:eede with SMTP id u9-20020a056512040900b004f73ee8eedemr18966661lfk.61.1689206821105; Wed, 12 Jul 2023 17:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689206821; cv=none; d=google.com; s=arc-20160816; b=JygdaLpSYiWwGTap8nlhnjjL3eGLKGks6cb0KTahC6Oc5RvqSXnLis4rnwspkldjb6 ZDh/fWLEOMMPZa/uXW9aI4S2UmqzVH3xJxsCd2IjWf/lbFfdZ9cCWmkn24rpahaFTFL2 tICDJrTGfVl2JbrPHR8rHMc1QqSaJK3vU2ig3ysPaqRHmPEBUJKWHh5dYDI90mHnWRs9 SVFm1pYr8UITGQhuFJc6kJE/4LSgBGRhK7luLlRY4SWHxS0oWFymcaoM3MHAgpaSNvbz h1f/gvZm1UmMMLO+18Xpt6H87EnD/BztsOfsDof2W10El7PYnzU25w018a7fluKFstl7 wxsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=yBbiZPgu2/j2Fa+PQjjTa+JWWHeCQ+gb4zvd8fQ/O2U=; fh=jj7Exx1G2j+BtVmuqG+29cxdB6KC9LNpaUf38Yun7Kw=; b=SpkS+nqHobRcBPwmLVXRc+1NZua+Iruyrg+xLfl0AP3YqYATqtHyKK+YJqbeZSUDk+ YtVwnDHViOOCiET36sCR8r6V4UgrPD9GCykt6l1KT9fW2PuR98pkOorJfPoiQsn3T7H5 r9D0Ceg/Uwc5xHIKPWn5Y5IIM89EjOPFYOxpDgisRMu0myvUzSWCKgf28chW2fF/6LWh Zwqj6oTCvQdru8hqq6HouSzTiK0B6JLf0ZJUSFJn4t/2zMPSZO3KXsiz/X0M0Dmmuys+ WbnjHp0v9okh+WRQ4rS6JoN1kidh+2yc7ZlZJ7y3tfN/YFqN74BFZpHVo94XSBoD7H9h iA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="X4/F4DWK"; 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=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n25-20020aa7db59000000b0051da5fd4a05si5849837edt.607.2023.07.12.17.06.37; Wed, 12 Jul 2023 17:07:01 -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=@linux.dev header.s=key1 header.b="X4/F4DWK"; 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=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbjGLXxy (ORCPT + 99 others); Wed, 12 Jul 2023 19:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231786AbjGLXxw (ORCPT ); Wed, 12 Jul 2023 19:53:52 -0400 Received: from out-61.mta1.migadu.com (out-61.mta1.migadu.com [95.215.58.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3D121FC7 for ; Wed, 12 Jul 2023 16:53:50 -0700 (PDT) Date: Wed, 12 Jul 2023 19:53:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689206027; 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: in-reply-to:in-reply-to:references:references; bh=yBbiZPgu2/j2Fa+PQjjTa+JWWHeCQ+gb4zvd8fQ/O2U=; b=X4/F4DWKUS7YK0Qkv05Gy9bs8fZ3ey/D5SMQwRXeN/aPm7A2jz+s0lPZtdOHgg6ajtCHRd hkyFyZ84fnVDDijHzp73tdR8QNsIpthNS+C1DwKth71R002qNzsSMVjGXlXDtNtMDweWHu jmWBbBEgnYcx3tPWNep+nNzI7CI4uuI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Kees Cook Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, Kent Overstreet , linux-hardening@vger.kernel.org Subject: Re: [PATCH 29/32] lib/string_helpers: string_get_size() now returns characters wrote Message-ID: <20230712235343.wi5fryoqmqj333qo@moria.home.lan> References: <20230509165657.1735798-1-kent.overstreet@linux.dev> <20230509165657.1735798-30-kent.overstreet@linux.dev> <202307121248.36919B223@keescook> <20230712201931.kuksw5zmuwah7tqs@moria.home.lan> <202307121525.B3B6153D8@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202307121525.B3B6153D8@keescook> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, Jul 12, 2023 at 03:38:44PM -0700, Kees Cook wrote: > Heh, yeah, I've been trying to aim people at using seq_buf instead of > a long series of snprintf/strlcat/etc calls. Where can I look at how > you wired this up to seq_buf/printbuf? I had trouble finding it when I > looked before. I'd really like to find a way to do it without leaving > around foot-guns for future callers of string_get_size(). :) > > I found the printbuf series: > https://lore.kernel.org/lkml/20220808024128.3219082-1-willy@infradead.org/ > It seems there are some nice improvements in there. It'd be really nice > if seq_buf could just grow those changes. Adding a static version of > seq_buf_init to be used like you have PRINTBUF_EXTERN would be nice > (or even a statically sized initializer). And much of the conversions > is just changing types and functions. If we can leave all that alone, > things become MUCH easier to review, etc, etc. I'd *love* to see an > incremental improvement for seq_buf, especially the heap-allocation > part. Well, I raised that with Steve way back when I was starting on the conversions of existing code, and I couldn't get any communication out him regarding making those changes to seq_buf. So, I'd _love_ to resurrect that patch series and get it in after the bcachefs merger, but don't expect me to go back and redo everything :) the amount of code in existing seq_buf users is fairly small compared to bcachef's printbuf usage, and what that patch series does in the rest of the kernel anyways. I'd rather save that energy for ditching the seq_file interface and making that just use a printbuf - clean up that bit of API fragmentation.