From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by sourceware.org (Postfix) with ESMTPS id 00AE23858D33 for ; Tue, 7 Feb 2023 16:17:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 00AE23858D33 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-io1-xd34.google.com with SMTP id e204so5858382iof.1 for ; Tue, 07 Feb 2023 08:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=skpMxdqp8ewd4qzj9v02XHbxM2MepYLSIzs9GIb0/60=; b=fVCYibq4VpMqDE273TXmSA//WxCwJoCK4XcPcvu3mT0nT+gI70u9cAGrKnXegmR2Kb GfuWIs8eZqIcp7ZmzAQkrjRQmbqf5H9Wr2jrJfpZ8dGHcUhF669Fkzbo5kcS96Mnwi73 VOIfHi5l9wIXizaQMyelpF9H/zSxcPongmKtTx+jzYPfpY2dwlTydC9lCq+h7jLIq3Z3 yjg4ERPK/P+eSGdMA4Fj5jr0OFjcbyhQk8fRpPJJMKMgxjQQCQbk/qSf72JGFhXj7YRn afC47XMOp0yYKi0pkDpTgP8/leNRETzXi4czoK/Zc6BBrlKKDIVZSYgq1X0IEkGxXPYS PHfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=skpMxdqp8ewd4qzj9v02XHbxM2MepYLSIzs9GIb0/60=; b=ebgh/vYA1Yvh26VVLgZEetXyFqcfKePq8dNpBjgVcOm7n+o2NKZYSBdFhEvUJ2LrsP xE0z0unxRAsr626AaiSd7gd5B8+EdH/esb9LUw2xdXV7c7Cc7Q2My9mexlVVRpYteWFN OK91ZTXPnjKz7i3nXGMYCMOGAigliLyXAZEwj9kRSxLomtuMuRGNaECB3bsxSUx7ecU8 I7xZjWoW9NTgO64HVrbf+ZT+Ynj5dPnM/RuLWrQskFZlZJcEVaaHU4jAHyE6pdr5xWn5 in8euWsNJaPeZJ8r0HwRiIb/+H6ADLkwlXVeTVZue1qXOb5n01xGlAfMGQYXDepBBVaZ vdmg== X-Gm-Message-State: AO0yUKWduC2oKf/fye/PWFyuWP8d4aHbuEv7WPYjPyYiL1lcK5nlXV+1 VmqnyV2/kKAC7G5N8vxau3alKveJOwUsBSczwTq70g== X-Google-Smtp-Source: AK7set9OaFJoSyK1MR7TTI8/mrcsUO4thExKUdrCo4Ycano8ng28Amc40b4tG9GdV77lUzfATNAel/kyfEL0J6vgmCU= X-Received: by 2002:a02:cf8d:0:b0:3ae:972:5b5 with SMTP id w13-20020a02cf8d000000b003ae097205b5mr3084652jar.26.1675786643084; Tue, 07 Feb 2023 08:17:23 -0800 (PST) MIME-Version: 1.0 References: <20230125160530.949622-1-vvvvvv@google.com> <20230126210539.GC2781@gnu.wildebeest.org> In-Reply-To: <20230126210539.GC2781@gnu.wildebeest.org> From: Aleksei Vetrov Date: Tue, 7 Feb 2023 16:17:12 +0000 Message-ID: Subject: Re: [PATCH] libdw: check memory access in get_(u|s)leb128 To: Mark Wielaard Cc: elfutils-devel@sourceware.org, kernel-team@android.com, maennich@google.com Content-Type: multipart/alternative; boundary="00000000000094f12405f41e7bea" X-Spam-Status: No, score=-18.7 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,HTML_MESSAGE,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --00000000000094f12405f41e7bea Content-Type: text/plain; charset="UTF-8" Hi Mark, > Did you actually find situations where these functions were called with addrp > >= endp? Yes, for example libdw/libdw_form.c:91:7. > It turns out that get_[su]leb128 dominates some operations and really does > have to be as fast as possible. So I do like to know what the impact is of > this change. This patch just moves __libdw_max_len_uleb128 to the beginning of the function and adds only one new if. So hopefully it shouldn't affect performance at all. --00000000000094f12405f41e7bea--