Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4673880rdb; Fri, 29 Dec 2023 09:21:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2178E2vPn4l0nRVOTTCb1Lxag2KmLECNgJ1avku1RnhtdoC33J9YczfiFfDOWwxn2FrTB X-Received: by 2002:a05:6358:6f13:b0:174:f9c6:2a17 with SMTP id r19-20020a0563586f1300b00174f9c62a17mr6511237rwn.8.1703870503807; Fri, 29 Dec 2023 09:21:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703870503; cv=none; d=google.com; s=arc-20160816; b=OvB7Pz4QlTeiaXpGNDGfbIGo9FpI9NPxzHbcB7YHVq8OWusL+UFRx/pTMb2ynCnADv vdbajRn9IauDIGL+wJv50sfe9nUt+8PLR3IMcXAmvk8MiA8+XPGLrPLKZBhSKlhaF1Gg knMrd5z4OzkEcxfzaKveGf2mldTzWc7+5CtLBkSWwt7DsnwqDCV/HBHEIGYANDvGQVUl EB4nWn+SKfhcTEiM96SgVLt1I2LhWOuu8H8CfWytko53h/7w4C+Au3CM/1T2ZHJ4/fuP NcPo6Z11eppNNzaGE5gpH/D5wnVvrFb3LpjkwbNGFu6MHQtT3/bbaA2yygtlpqYMHuij Fdbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=xKoiaN5Ptx5nvAEn7znQLv6cCCZe9EwH3qBzMCtP9vs=; fh=jUwV65NhmkUifrPRcJJ+BRvcFJ2rWWqD+p/LmeSSOb8=; b=O8sp5qfd5x750lRTceu6MXoXWq9pgPI8wMpfianl9dCU4RhrpQiuSAmsP+mre28UmX qIuvIjiRQdyO5sZ9XeZMS4YCYK/O9Gk7Ff6g+ZUj316yfgUbQiIQJH7FYCncvAM0mgJg DhhlzL1H+GttVB6Aby4Db573EIFa/JULZPv5Bz/0eqjmrmfsZke8824tbmXjrvumqi5G W7P2mh9kOB9klS6lHU9oOf+D2VhLSezjVNL+tfirowimUrmofLV3TGuD0xIXlUg8jsBH iCZjCS3yU44M10Uq8lo/DcR4CO1V52zpn0/KVDUo4vcEuXUQ7UrxzktBmDGIDETS9XBk +yOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20230601.gappssmtp.com header.s=20230601 header.b=oF9sd+cO; spf=pass (google.com: domain of linux-kernel+bounces-13178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13178-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=networkplumber.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u25-20020aa78499000000b006d3c35096dcsi2562210pfn.320.2023.12.29.09.21.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 09:21:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20230601.gappssmtp.com header.s=20230601 header.b=oF9sd+cO; spf=pass (google.com: domain of linux-kernel+bounces-13178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13178-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=networkplumber.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 60C25283409 for ; Fri, 29 Dec 2023 17:21:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CE1A12B89; Fri, 29 Dec 2023 17:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="oF9sd+cO" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 424C112B72 for ; Fri, 29 Dec 2023 17:21:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d3e84fded7so35269325ad.1 for ; Fri, 29 Dec 2023 09:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1703870491; x=1704475291; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=xKoiaN5Ptx5nvAEn7znQLv6cCCZe9EwH3qBzMCtP9vs=; b=oF9sd+cOWhWgo/1AyNvSFN0IstkRRWK6CfG3tx6IDMYboN1/FtisJfSvjg5xc7yIAl UKge4w9wPr6wU4noa0KTC00O2UebsFqyN8TbtcVPlpCYevlH1N0c2cW1QKinN8QSt+X1 t9CeD+2R2noED0oQ8/dQGb/otV3ure9+G5mRqK0/DMlhC6tk7rQoYKLlj83FhdryKhHG MynJ7WqZEbWC8UiDV91urQjJkvJvQPikMDlkd/Iq5rMz2/wZKc66wfDSNRbiEhg+9irO lF9kwzlNPKMTSoc9exRozWyS4bOc43A/WUaWt4E2wXLf3aOTGb6YAkRE8ONRM83X1+Dp 6d6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703870491; x=1704475291; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xKoiaN5Ptx5nvAEn7znQLv6cCCZe9EwH3qBzMCtP9vs=; b=V7eInSFDgIHg06TPsEhkt8ET26JE3U0m2qLThHQz2vAY7qEbXghbtabBGGy1NqEyAb 0kpFWyP618j4Q6ZopK2mCTe2djou21XzdU457dRlWGZ7a6aWfcsGSs5w25a0QjOAl94B lMP/r3Sg0TeotyNYoBNWrnRWqJBwwWdBDDrWqpKaeTxPGfuk9HXZlP7zgRUruDBc0sqs 3ef/Tga381LvOSs/w693qPU0OvJqMHf4oJEo6Xm6j7jdh9rAZSERTiYZKhonEX/DbtJJ r2q2ofrxJj7ALg8CPfeU5StFIPKWe/ykZrh5Bh4UCJzVbxnoGZQmKSneBTHLvhWFqGq9 0nlQ== X-Gm-Message-State: AOJu0YzsMGTM1Sea9eFqoBkktxwN3GhLP+QVR3hxvk8BLtV50laW3aVP XDtGb6wt4pam36Fway7llY+MR0cRnHamEQ== X-Received: by 2002:a17:903:2c9:b0:1d4:61da:1384 with SMTP id s9-20020a17090302c900b001d461da1384mr5475666plk.106.1703870491534; Fri, 29 Dec 2023 09:21:31 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id j17-20020a170902c3d100b001d400970b6csm15877720plj.110.2023.12.29.09.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 09:21:31 -0800 (PST) Date: Fri, 29 Dec 2023 09:21:29 -0800 From: Stephen Hemminger To: Junxian Huang Cc: , , , , , , Subject: Re: [PATCH iproute2-rc 1/2] rdma: Fix core dump when pretty is used Message-ID: <20231229092129.25a526c4@hermes.local> In-Reply-To: <20231229065241.554726-2-huangjunxian6@hisilicon.com> References: <20231229065241.554726-1-huangjunxian6@hisilicon.com> <20231229065241.554726-2-huangjunxian6@hisilicon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 29 Dec 2023 14:52:40 +0800 Junxian Huang wrote: > From: Chengchang Tang > > There will be a core dump when pretty is used as the JSON object > hasn't been opened and closed properly. > > Before: > $ rdma res show qp -jp -dd > [ { > "ifindex": 1, > "ifname": "hns_1", > "port": 1, > "lqpn": 1, > "type": "GSI", > "state": "RTS", > "sq-psn": 0, > "comm": "ib_core" > }, > "drv_sq_wqe_cnt": 128, > "drv_sq_max_gs": 2, > "drv_rq_wqe_cnt": 512, > "drv_rq_max_gs": 1, > rdma: json_writer.c:130: jsonw_end: Assertion `self->depth > 0' failed. > Aborted (core dumped) > > After: > $ rdma res show qp -jp -dd > [ { > "ifindex": 2, > "ifname": "hns_2", > "port": 1, > "lqpn": 1, > "type": "GSI", > "state": "RTS", > "sq-psn": 0, > "comm": "ib_core",{ > "drv_sq_wqe_cnt": 128, > "drv_sq_max_gs": 2, > "drv_rq_wqe_cnt": 512, > "drv_rq_max_gs": 1, > "drv_ext_sge_sge_cnt": 256 > } > } ] > > Fixes: 331152752a97 ("rdma: print driver resource attributes") > Signed-off-by: Chengchang Tang > Signed-off-by: Junxian Huang This code in rdma seems to be miking json and newline functionality which creates bug traps. Also the json should have same effective output in pretty and non-pretty mode. It looks like since pretty mode add extra object layer, the nesting of {} would be different. The conversion to json_print() was done but it isn't using same conventions as ip or tc. The correct fix needs to go deeper and hit other things.