From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CCB6C10F1B for ; Wed, 28 Dec 2022 01:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232430AbiL1BzV (ORCPT ); Tue, 27 Dec 2022 20:55:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbiL1BzR (ORCPT ); Tue, 27 Dec 2022 20:55:17 -0500 X-Greylist: delayed 301 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 27 Dec 2022 17:55:16 PST Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 999A710B3 for ; Tue, 27 Dec 2022 17:55:16 -0800 (PST) Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1pALa7-0008of-Pk for linux-kernel@vger.kernel.org; Wed, 28 Dec 2022 02:50:11 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: linux-kernel@vger.kernel.org From: Tavis Ormandy Subject: Re: [oss-security] [patch] proc.5: tell how to parse /proc/*/stat correctly Followup-To: gmane.comp.security.oss.general Date: Wed, 28 Dec 2022 01:50:03 -0000 (UTC) Message-ID: References: <1a1963aa1036ba07@orthanc.ca> User-Agent: slrn/pre1.0.4-5 (Linux) Cc: oss-security@lists.openwall.com, linux-man@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-12-28, 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. > I think that cut command doesn't handle newlines, you probably need cut -z, which looks a bit hacky to me. There already is 'ps -q $$ -o comm=', of course, and that works fine - as well as libprocps. I don't know, I think just adding the strrchr note seems acceptable. Tavis. -- _o) $ lynx lock.cmpxchg8b.com /\\ _o) _o) $ finger taviso@sdf.org _\_V _( ) _( ) @taviso