Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp454778pxb; Wed, 27 Jan 2021 11:51:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEEiG9CDvwyDxlrLfFAxb6nATZMSIuo8OuPmIpu6BfoS3nG+mB5vw7AL86r1AYZzZMBtmV X-Received: by 2002:a17:907:1629:: with SMTP id hb41mr7695527ejc.197.1611777092532; Wed, 27 Jan 2021 11:51:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611777092; cv=none; d=google.com; s=arc-20160816; b=wSusm7ykfQPeVmkz36vEYsBNXzeq0Q0y7XjhyTRPsCHaprIkF6mwg7BtrrVw4XD9vD TmfC5/bVeYkZZHsJUDFj4UZF2RRbJlMnSf7VtgpBHyEy39GjYs6t5zCTl1IQ1QNPeXaJ z8rcQebz8A0nQfIw+KuvzxiMb8TJRe2R7GEqgzUYHxwdYE//SfjwUjtna/JIJ/RDPs68 T+jQR1RjrCiULMoHyeu7DyCfbQGfRHInHRtkqmqjz1/aQQrtk8Y3iathBxf/7LdBLkWM m4BB6CrEy+gztSwyXFjRBqHhbR0yRh8FIscvLF221RunCTZdQa2iDl3EkXS9leekQX/Z T3sw== 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:date:dkim-signature; bh=qNmYQghzyEo5Nu0f80VNhQIBJIqh9/mSmZbgpxpbU6s=; b=JSHWQJRSmMZaZvUHWFxAhYP8oqN+BKi7N/cTk4bLFNoL/9uhm73xdFhj3PBC74HKyf Z4mIWjY7q1ctDhC2kK8Meu53M3vqHnZ1avBvuigjyF8l8uHEAfhjFSXgjs5/g7Xz6oZH BLsWUiXBIViS24EeiS+wRieYGeNcdHg9DVzilGa/jRdFSUgWtWVGwQulX5JVNf2yMXH0 XxzBD9k8VTNum3+5C3bU29Bb0NMAaNWEUphjUFlYYxdJvpKYX7mHi60yjIgSyGvfLsUM Mg0JV4eByWkvA6iir29JpBldHieVaAA6FkWG07hCqgryWBeM1TGFi8+bpkAUlUlDOJJc kaXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IeGwo1ql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg13si1396001ejc.126.2021.01.27.11.51.03; Wed, 27 Jan 2021 11:51:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IeGwo1ql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235594AbhA0DUP (ORCPT + 99 others); Tue, 26 Jan 2021 22:20:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36720 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405693AbhAZUyN (ORCPT ); Tue, 26 Jan 2021 15:54:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611694366; 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=qNmYQghzyEo5Nu0f80VNhQIBJIqh9/mSmZbgpxpbU6s=; b=IeGwo1qlHKuPJVySN6Jumgq7vzMZg0fT7BfO1qV+FNMcTCPxFWZbwKqt4iknaj4IpiSlxj wGVy05I7gyviljrlKlYmuVHfAdY0CUDrpSL08Y/9qX6JyKWwEAwz1fkN95C2jf3Qq7iIS5 gi+IrWTTPRFx51l5LmtkaG42PUlwwCw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-sboSZlTcOw63awkb_eqR8Q-1; Tue, 26 Jan 2021 15:52:43 -0500 X-MC-Unique: sboSZlTcOw63awkb_eqR8Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D899A393AE; Tue, 26 Jan 2021 20:52:40 +0000 (UTC) Received: from krava (unknown [10.40.192.149]) by smtp.corp.redhat.com (Postfix) with SMTP id 248FA10013C0; Tue, 26 Jan 2021 20:52:36 +0000 (UTC) Date: Tue, 26 Jan 2021 21:52:36 +0100 From: Jiri Olsa To: Alexei Starovoitov Cc: Yonghong Song , Jiri Olsa , Arnaldo Carvalho de Melo , Alexei Starovoitov , Song Liu , lkml , bpf , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov , Andi Kleen , Adrian Hunter Subject: Re: [PATCH bpf-next 2/3] bpf: Add size arg to build_id_parse function Message-ID: <20210126205236.GD120879@krava> References: <20210114134044.1418404-1-jolsa@kernel.org> <20210114134044.1418404-3-jolsa@kernel.org> <19f16729-96d6-cc8e-5bd5-c3f5940365d4@fb.com> <20210114200120.GF1416940@krava> <20210114220234.GA1456269@krava> <5043cef5-eda7-4373-dcb5-546f6192e1a9@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 14, 2021 at 07:47:20PM -0800, Alexei Starovoitov wrote: > On Thu, Jan 14, 2021 at 3:44 PM Yonghong Song wrote: > > > > > > > > On 1/14/21 2:02 PM, Jiri Olsa wrote: > > > On Thu, Jan 14, 2021 at 01:05:33PM -0800, Yonghong Song wrote: > > >> > > >> > > >> On 1/14/21 12:01 PM, Jiri Olsa wrote: > > >>> On Thu, Jan 14, 2021 at 10:56:33AM -0800, Yonghong Song wrote: > > >>>> > > >>>> > > >>>> On 1/14/21 5:40 AM, Jiri Olsa wrote: > > >>>>> It's possible to have other build id types (other than default SHA1). > > >>>>> Currently there's also ld support for MD5 build id. > > >>>> > > >>>> Currently, bpf build_id based stackmap does not returns the size of > > >>>> the build_id. Did you see an issue here? I guess user space can check > > >>>> the length of non-zero bits of the build id to decide what kind of > > >>>> type it is, right? > > >>> > > >>> you can have zero bytes in the build id hash, so you need to get the size > > >>> > > >>> I never saw MD5 being used in practise just SHA1, but we added the > > >>> size to be complete and make sure we'll fit with build id, because > > >>> there's only limited space in mmap2 event > > >> > > >> I am asking to check whether we should extend uapi struct > > >> bpf_stack_build_id to include build_id_size as well. I guess > > >> we can delay this until a real use case. > > > > > > right, we can try make some MD5 build id binaries and check if it > > > explodes with some bcc tools, but I don't expect that.. I'll try > > > to find some time for that > > > > Thanks. We may have issues on bcc side. For build_id collected in > > kernel, bcc always generates a length-20 string. But for user > > binaries, the build_id string length is equal to actual size of > > the build_id. They may not match (MD5 length is 16). > > The fix is probably to append '0's (up to length 20) for user > > binary build_id's. > > > > I guess MD5 is very seldom used. I will wait if you can reproduce > > the issue and then we might fix it. > > Indeed. > Jiri, please check whether md5 is really an issue. > Sounds like we have to do something on the kernel side. > Hopefully zero padding will be enough. > I would prefer to avoid extending uapi struct to cover rare case. build_id_parse is already doing the zero padding, so we are ok I tried several bcc tools over perf bench with md5 buildid and the results looked ok jirka