Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1479052lqh; Mon, 6 May 2024 08:51:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBb0wW5y7yhxE565GscrneZC8aiP9kI0ns9SBxQj617SuCe7YDrYwGEyu0QCPQh63foUwmfHRXimAPDuMcPODmaDyDOE/9IdhDK8vS1g== X-Google-Smtp-Source: AGHT+IF05PkhhtwIa8pp4bNv+uWUzBBP9nB/XLYj46uM9bp8ygtEqBdF4Fs13slVC5S70fPe0GCT X-Received: by 2002:a05:620a:1919:b0:790:f929:ceb4 with SMTP id bj25-20020a05620a191900b00790f929ceb4mr13762914qkb.41.1715010697523; Mon, 06 May 2024 08:51:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715010697; cv=pass; d=google.com; s=arc-20160816; b=hYI5APbyXEKe12JzwxIa8AmCfbAIqdbdezdJHlmxUpVQ8wJL0JNMAlPOu11oFkeIzy NV0/LSsRm8PS3AflqSJvsQEHAXljNvlp+TjC85T2OYLRM82+V/mRVg6HWR7D413ML0fX 0KYJqu4KBROvn1kmAB5fsCj3astuUVNKLmUqwhBEl9U/7zl2bbIoQi1FrUUh0HQUYMHm fmIeNZl2GxfKtfG5Eg1hIum/43YrSslniSsyBs8EVlODEBHb2HJDvaOzmC0r9O53pNFE GfRZcv9WpK7nj3Lzkkaea+oonnilJtjjL9zTV/IoC8C/4XQaFLtkXjoMSIH3OZI32KXQ 6oJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HZT0SnIs/02MaTW5fVT9bWl8NEc4i33rHG9BmlMKJ30=; fh=/Ixnu1/fJB7knQPT6fpBbfM5OmfUX4P0f9j+lH8Uy+I=; b=JGcHJfGlUVwoZgkw822YxBMO71mVe+qVVZnOU7NS3D08DjfLniFfEHhPPnIzAA02f5 brrR2GBuU3za785p34xGTr7+Afgel08I3mcm3V8Fj7ClhcnZlkWV2dvszBpj72QBLgiL vyD+CUU1qYCfjJQX5q+kPU6ls9XKOCYc5PtXSYxWPsGXRcqtJ2hl6Y3/PkhVvSMC3gvV KXaFLw+jVo/XOrecB6CP3pxFwNrp7U9Z/jFgc2/vjJGDCkpR8QdZ9zlDSOJMt3aSQ17Z D2tgW6tsA7ltxR0OtGDhbHWIRITfptRJkf6N6+XmhnNNiRUK4qPw9dk56WfA4ohc7wet rxPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IPaGlfry; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-170096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q19-20020a05620a0d9300b00790f7d5b3c8si8311573qkl.495.2024.05.06.08.51.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 08:51:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IPaGlfry; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-170096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3B9A91C21C7C for ; Mon, 6 May 2024 15:51:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0A5615622E; Mon, 6 May 2024 15:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="IPaGlfry" Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 CE6BD155752 for ; Mon, 6 May 2024 15:51:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715010677; cv=none; b=KT9aVNuuHvh7CfxIqJ0HI0na/lQZkP3t+qWNjrVItPQ994aUThcN3wZujgpvNbYzrOxv8VWF/9yPxoOe0Tm2u9j3GgbFJ6Kg+C0hjrmgEHZui37mzaDuoWYfwTBKPIiL1D1JCh+/dmBXT6627an05zwJOTZz+Nkiz483OJenV94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715010677; c=relaxed/simple; bh=fmEi8zy2BYzKQV1pUEcAJYNE1lGiyqt68S/HH8iGNRA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UVwA8hdQICOFkvL3Le5vyhomribgjAdVztvBWIEt2p3AqS5F6d900NXdpylBFgxEJkSudWL4Bi8aZbz4zWpeb5iP37Di5qp8QloF4uenqGYCojWdkksrJgJipY95v0jX/MQX27DmlOdCbjoqQXAB/ZEq0+7cDPhmSfJQrjYdSZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=IPaGlfry; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6f467fb2e66so1462699b3a.1 for ; Mon, 06 May 2024 08:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715010675; x=1715615475; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HZT0SnIs/02MaTW5fVT9bWl8NEc4i33rHG9BmlMKJ30=; b=IPaGlfryY4sMe6LVrfg/j2Omt18j/Wq9+68aZQmqiK6585g7gtdcYfZLE+oaItT6EA z0Rc4BtW7P89j4dZ18sGgQXdP1LxhCzZb3BI9Eu9sN3Gvr4zpPx4AocYCucbZaSsiAPQ /WC9gs9PBqNais7yaaoxuFJsvhpTvWNzWLB+Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715010675; x=1715615475; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HZT0SnIs/02MaTW5fVT9bWl8NEc4i33rHG9BmlMKJ30=; b=hIaQfHTV+alHdjadEMGqXlj7TaukhXPfJA0+3PFIeL0g+DsUByNOgbxCNg1xcW8h74 /OgrqE6Q3CN46NcGsVvpFCifc0kd8LCDC0bBeqciB0AeL+nDq5tivqJ1yKj5iSoTZSak bjqzXvf+I8NM9hqT7qFgd4Ge8DsXM8cmZiD3/c2T09m745KWRMSuZYGTe5g/ZxatjX/N VaQFaT8PRs1iK0ZxIUzwNnQRlTa7EBD/wtyzmivVm8/lNi4m1VDY6liNL6A8zf4C/WqL Fpt8vKFKwtnhK37+NKi+65fi2Xik6dck+Q9qgmOItlgNX7U9KZSP5TuBpR/tzZxHfEgj G7xA== X-Forwarded-Encrypted: i=1; AJvYcCU+wOQj6l1cTD5/jS69xZ1mnhofOsl9cFhXB7bp5eZhPBxJTsdJGvRK3x0j8JhFFQvW0s2v/1L3Uf+CrcBTyu2NQ7xmXa+Gn1NNVeHz X-Gm-Message-State: AOJu0Ywqny1BJDLwi+hnQEYCwjx5Btb8WxH3/DoGXLzFDeYeWbIB8CWX fQSi1h5dSGwV/P67S83bZGLcoURlyMbLtfAdWHSybWBwW1SQzGWMe8PeldW48Q== X-Received: by 2002:a05:6a20:c704:b0:1af:8bc4:c7b6 with SMTP id hi4-20020a056a20c70400b001af8bc4c7b6mr10767852pzb.53.1715010674988; Mon, 06 May 2024 08:51:14 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id f24-20020a056a000b1800b006ed0f719a5fsm7888759pfu.81.2024.05.06.08.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 08:51:14 -0700 (PDT) Date: Mon, 6 May 2024 08:51:13 -0700 From: Kees Cook To: Josh Poimboeuf Cc: Peter Zijlstra , Youling Tang , Jinyang He , Huacai Chen , Tiezhu Yang , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] objtool: Provide origin hint for elf_init_reloc_text_sym() errors Message-ID: <202405060831.089E820@keescook> References: <20240430235106.work.680-kees@kernel.org> <20240504222402.p24zt6dc2zkyxqti@treble> 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-Disposition: inline In-Reply-To: <20240504222402.p24zt6dc2zkyxqti@treble> On Sat, May 04, 2024 at 03:24:02PM -0700, Josh Poimboeuf wrote: > On Tue, Apr 30, 2024 at 04:51:07PM -0700, Kees Cook wrote: > > @@ -891,8 +892,8 @@ struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec, > > int addend = insn_off; > > > > if (!(insn_sec->sh.sh_flags & SHF_EXECINSTR)) { > > - WARN("bad call to %s() for data symbol %s", > > - __func__, sym->name); > > + WARN("bad call to %s() for %s symbol %s", > > + __func__, origin, sym->name); > > return NULL; > > Thanks for the patch. > > That warning was already phrased pretty awkwardly which was probably > part of the confusion. It could be rephrased to make it a little > clearer: > > Something like: > > .cfi_sites: unexpected reference to non-executable symbol 'execute_location' > > And ".cfi_sites" is already in 'sec->name', so you wouldn't need to add > the new 'origin' arg. What's so odd is that "execute_location" wasn't being reported at all. Just ".rodata": vmlinux.o: warning: objtool: bad call to elf_init_reloc_text_sym() for data symbol .rodata But yes, sec->name has what I want, so I can do this easily: - WARN("bad call to %s() for data symbol %s", - __func__, sym->name); + WARN("bad call to %s() for %s symbol %s", + __func__, sec->name, sym->name); vmlinux.o: warning: objtool: bad call to elf_init_reloc_text_sym() for .cfi_sites symbol .rodata I think the symbol is missing because this is coming from create_cfi_sections()/elf_create_section_pair(). Regardless, I'll send a v2... Thanks! -- Kees Cook