Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8616364rwl; Sat, 31 Dec 2022 08:43:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNZOkwiFyejRF5q85fEmiJFUkpZWaPZ39pcGKYrr237Gw77D3i6P2LFVwVoypk0IK3Da3D X-Received: by 2002:aa7:943b:0:b0:582:49d9:688d with SMTP id y27-20020aa7943b000000b0058249d9688dmr981376pfo.3.1672505031776; Sat, 31 Dec 2022 08:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672505031; cv=none; d=google.com; s=arc-20160816; b=VUUWZg69Dqr4STdbUC0n89kNv5sKn5wBxW3hVlw5OffJk9WtKxNDa7LhuUdhC3DrJu BY2fDlY504GDSkHMRwUve9qWi7Bzn5BBge4EJAkDF3raijvWgD4fM81RvZ6LNj0aDGv3 0fFQT8b1Tp+r5ZLUJ5n8qOnhRw2NkSCDDxgFZ6swGOIZx1AKMWQ1ZGfA5I8HyCvUkT6R 6CJuxvFmsGZjvYoYWY9hHzdnSLS5kdFLPfExuglj34robIU5l9uPIXIPKvon8rvji7p0 liK6ty1BXUtzNTmNKbTPN2sd/lkHIEXhsusvTqKQ40R9EabvbzR4qJYZ5QpAMW5BCyGt AhgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=D2f4wF7BjL4TCUPVxe87H7EVxlhVhVbN8y9CopQV/Gc=; b=avohBSpAgnGhob/mBPKmhfMC6edUD+/ieOnw4Ik9yZv2iXV29ehUJ/hG+olG80jVs5 5zZUIWI31XBAw+T2TSMERdzSCLfsg45VvQMwIEGAyJW3DziFJosSt7cFHkeWRBVl+/9/ w6PlKIdyZuDC44vByO8TDsRucmijH9BqA/6dqY2xk6HHg5pyVz2puSECoeoxi13cW6qG xG9DwrC7qeAi9POSJcySvugQmaNeur9zF962DkDyFwTca0m+LzN7Gtwg5Bzq0vCYp/0y YEFec95EhHRmI/cNAbt5NeZ2lzHKdw7sA+husRryNdXFJn06kezMvFp0t+w+PK2xHsP5 ozyQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a056a0022d500b00576916b7127si25224582pfj.181.2022.12.31.08.43.43; Sat, 31 Dec 2022 08:43:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbiLaQbi convert rfc822-to-8bit (ORCPT + 62 others); Sat, 31 Dec 2022 11:31:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbiLaQbh (ORCPT ); Sat, 31 Dec 2022 11:31:37 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0912F558E for ; Sat, 31 Dec 2022 08:31:34 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-213-AHTFuIkIMMqNt7aEoGq0EQ-1; Sat, 31 Dec 2022 16:31:32 +0000 X-MC-Unique: AHTFuIkIMMqNt7aEoGq0EQ-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Sat, 31 Dec 2022 16:31:31 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.044; Sat, 31 Dec 2022 16:31:31 +0000 From: David Laight To: 'Shawn Webb' , "oss-security@lists.openwall.com" CC: Alejandro Colomar , Michael Kerrisk , "linux-kernel@vger.kernel.org" , "linux-man@vger.kernel.org" Subject: RE: [oss-security] [patch] proc.5: tell how to parse /proc/*/stat correctly Thread-Topic: [oss-security] [patch] proc.5: tell how to parse /proc/*/stat correctly Thread-Index: AQHZGtCXw3AZMxRdFEGt4rB+yFX0n66IM7kQ Date: Sat, 31 Dec 2022 16:31:30 +0000 Message-ID: References: <1a1963aa1036ba07@orthanc.ca> <20221228152458.6xyksrxunukjrtzx@mutt-hbsd> In-Reply-To: <20221228152458.6xyksrxunukjrtzx@mutt-hbsd> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 From: Shawn Webb > Sent: 28 December 2022 15:25 > > On Tue, Dec 27, 2022 at 04:44:49PM -0800, Lyndon Nerenberg (VE7TFX/VE6BBM) wrote: > > Dominique Martinet writes: > > > > > But, really, I just don't see how this can practically be said to be parsable... > > > > In its current form it never will be. The solution is to place > > this variable-length field last. Then you can "cut -d ' ' -f 51-" > > to get the command+args part (assuming I counted all those fields > > correctly ...) > > > > Of course, this breaks backwards compatability. > > It would also break forwards compatibility in the case new fields > needed to be added. > > The only solution would be a libxo-style feature wherein a > machine-parseable format is exposed by virtue of a file extension. > > Examples: > > 1. /proc/pid/stats.json > 2. /proc/pid/stats.xml > 3. /proc/pid/stats.yaml_shouldnt_be_a_thing None of those are of any real use if you are trying to parse the data in something like a shell script. Multiple lines formatted as "tag:value" are probably the best bet. Provided something sane is done with embedded \n (and maybe \r). David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)