From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA66AA04DD; Wed, 28 Oct 2020 16:18:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 340ADCBCD; Wed, 28 Oct 2020 16:18:04 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 7B608CBB4 for ; Wed, 28 Oct 2020 16:18:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603898279; 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=FRHt3R4CbHy2atomXUhqa/P5plw1izn7TMer18hlwDo=; b=e50iccTwoKULzedokFXDEOSNVhMhtCoZze5KRATfAjgrrr/9lJ5fct2KkJkyBZOHRYmpSv yjg6ss24jyUEQd4k4FTIv76vU8wW5ZObz1i2aVafjAgFTiOXmkN7YkWUE5upzX1to3t5Nx ZKz2fFmsymnU7FcmQ0CK9KA742LxL8o= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-z7hJu05BPIqXW051Feyl-g-1; Wed, 28 Oct 2020 11:17:55 -0400 X-MC-Unique: z7hJu05BPIqXW051Feyl-g-1 Received: by mail-vs1-f71.google.com with SMTP id z190so1070590vsz.22 for ; Wed, 28 Oct 2020 08:17:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FRHt3R4CbHy2atomXUhqa/P5plw1izn7TMer18hlwDo=; b=ef6SShpvyVHXwBl5BFWncT8H3brNOhBvIG0MLGc9C8aZdcqG8qDNF76/i/d9qvjQLC ZGmt42hgOBTm4mqWW6HHAXtN/XKSgmrDSJmAaq6ppWwZs4+6cSELpuAraN6nFT2d+4Gl 4y9puGYBMeizcjEnRm5+XIPCkLvFtqkAt7a+WTUp6FvDCdw0eTvabBRPWaa2PP4noS31 bIFLctK8hicz2cecAwPSaaNAFKf3T+sQ6j0dWrQMd6vwwdUv7jkOtNLnJTZV4BLf8I0W 2yk56TfzJqyaIkaSDsKbIlPBc4tNS9wdyJkAPfaYeL82RdLbnKKZCsq6Rtd/+qnDzl5k iBSA== X-Gm-Message-State: AOAM532YkP7oinWK9MkOp2FoIv1IKugOdpCOqKJUd2wqlmrjPsAKDaWO wh97XXWwvu9gsWF5uSszvThu+TBSzZ9phI9pyUB5sLLsLUJeOJzE7VWYlhYJFXOoL25m4lhYdfH 0b8BYL22QpSWH/9yZwuY= X-Received: by 2002:a67:fd7a:: with SMTP id h26mr5868103vsa.27.1603898275237; Wed, 28 Oct 2020 08:17:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+BpewrhKyy3uyQOjPWX5kW2mfmoHZZ2X/7YG4aDQCY483fPOcrBO+9w29XJj3p1/Ih9dsnKL2Ta99SBSyaiA= X-Received: by 2002:a67:fd7a:: with SMTP id h26mr5868054vsa.27.1603898274941; Wed, 28 Oct 2020 08:17:54 -0700 (PDT) MIME-Version: 1.0 References: <20201023080058.13335-1-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Wed, 28 Oct 2020 16:17:43 +0100 Message-ID: To: Jerin Jacob Cc: Jerin Jacob Kollanukkaran , Sunil Kumar Kori , dev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 0/3] Rework CTF event description storage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Oct 28, 2020 at 2:09 PM David Marchand wrote: > > echo "trace_autotest" | ./build/app/test/dpdk-test -c 0x3 --trace=.* > > --no-huge --trace=.* > > Err, indeed, thanks for catching. > I did some diff on metadata files, but did not notice this trailing character. > > This is an issue with the metadata string manipulations, that appears > with the last patch... > I ended up rewriting most of _ctf.c (removing intermediate buffers > allocations) and it works but I'll see if I can pinpoint the issue. The problem is in the current HEAD, but it is revealed by my series, maybe because the dynamicity around allocations changed. I see no check on the length of trace->ctf_meta when writing to the metadata file. Did I miss something? int rte_trace_metadata_dump(FILE *f) { ... rc = fprintf(f, "%s", ctf_meta); ... } Breakpoint 1, trace_mkdir () at ../lib/librte_eal/common/eal_common_trace_utils.c:317 317 { (gdb) p strlen(trace_obj_get()->ctf_meta) $2 = 21865 (gdb) p trace_obj_get()->ctf_meta[21865] $3 = 0 '\000' (gdb) set trace_obj_get()->ctf_meta[21865] = 'A' ... $ babeltrace $(ls -1rtd $HOME/dpdk-traces/* |tail -1) [error] at line 1008: token "A": syntax error, unexpected IDENTIFIER [error] Error creating AST ... This fixes it: @@ -37,11 +37,12 @@ meta_copy(char **meta, int *offset, char *str, int rc) if (rc < 0) return rc; - ptr = realloc(ptr, count + rc); + ptr = realloc(ptr, count + rc + 1); if (ptr == NULL) goto free_str; memcpy(RTE_PTR_ADD(ptr, count), str, rc); + ptr[count + rc] = '\0'; count += rc; free(str); -- David Marchand