Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3185538lqp; Tue, 26 Mar 2024 01:56:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXf/Fad05KH1qeW2UUOYk3uhaqfjHOBGtZWSY3Z+PY7PlUtbU5SG1vqqpXpMicCB3rOKRboWMr5FV6XRnZIt9c0V1BR6a9qf3mzsyPy4g== X-Google-Smtp-Source: AGHT+IH8u0HhY56H2VJNakcc6xqRR9Zn5xSO3UP5xkbu53CaNp+0fKS1frdmkCh64HsIw7D4L2L1 X-Received: by 2002:a05:6870:944c:b0:229:eee1:cf0a with SMTP id e12-20020a056870944c00b00229eee1cf0amr601769oal.35.1711443404750; Tue, 26 Mar 2024 01:56:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711443404; cv=pass; d=google.com; s=arc-20160816; b=nblKg3jPS0RTYIYzVKBRuJtmS3mrI/iIy3LtdFrrJNDTUcOeV27h4Nw9J7nZBfZzZ4 x8A3978ntm39bHSUfH9c4DNv6FsRIVRF+10kPNboRcKQJa87BZCTnB23bvI+hDSjXK+l VNtzmSXV58Hs6KCAJUGY3MvaoVT6eemum6svuzjBrK371CeNBBV0pIqHpcidH3hiFG1Q mF6EJCLCMienbORV6rO65WGwZ7D4apuygfHXjhWUx+eoF6jMNFcfIL9FlOPKRLYHPwRk U3x+XWUF+hl2TYuo07CHv6nAqzuVShi4uJHXokztTYNsyvBDYwtDYrKDN9N4q2TYDQij Cycg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=yDYecdUFh7SZDG5N02iSCUpuKUkwu7hUc3Ntyen2lRk=; fh=4jFnFoeEG8oYz7MVBscQWJ6U4tFWYpUOluV2R7dsDZg=; b=IFCTFAZDX6hT6Hlf6l9zPNocMAo4whgh4ccWfvlw1GJXW+tBvFJeKI1VSeZh2Uz66F +C26JM0WGqkAKSie72Wv7vmIDQ2r92jy7mZRHWgptI6rbcJPo50tdng1gat6nptdcJ0Y 55EESUr0j1ryVcAOmLHutGtXKubu6Bk7qIzRd48J17bRgsQRwAC8cpNH7S9KosN3ej4u MVtGT/IU/Tq44LqQNQOgfboMK4d3T7/b3Wo9eN9h19GSNTot/nZZBglXyaDxmyLvgzxt N9eqWdCXVIiP+D9w+p8vzzdXEsg1Q3M1k1HZG6GgFOc0zIjZ8RqVw5FGGjnWxl7GDxSx 1L4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-118586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118586-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a10-20020a63d40a000000b005dcbb9ebe61si8994671pgh.821.2024.03.26.01.56.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 01:56:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-118586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118586-linux.lists.archive=gmail.com@vger.kernel.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 58E872E3F09 for ; Tue, 26 Mar 2024 08:56:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EB7654BCF; Tue, 26 Mar 2024 08:56:20 +0000 (UTC) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3972548F1 for ; Tue, 26 Mar 2024 08:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711443379; cv=none; b=WZ4B8E+UVNX4/eCFfEABsTIQ5azz3NtW9DcJGEZEQGpGliBkj+UT+zgGwscbt2bmU1EmrCBaN23XOQx0lVquy+L4fIUdlHly8wJXxnI/nlSU+9wGSuj8DiNRs/+rXL8gqS3aKJstyHz4q6cPcChk+djZLHnDqOAESolMl9RXmaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711443379; c=relaxed/simple; bh=oBipWs+jXHuItcEl/r2AVi229geZIoTDoOYLGnnDWBo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GPTMMhboZGG7Que8LZ/EYcpGp/ojx/jFcH8FTeO/mpTiYeAX0IQvJjh/FtktwXLJAH9S0AJN5IvfPjJH9Br0W5pbrM+QtcH/NlGtJ6kgCwM/wgBLIKnKyPgzN0w1QUBvgiwzi8dNlSPy11dhE4U054o5hdK6vA8Z3ybkFsuZv7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id 5A8D3C0009; Tue, 26 Mar 2024 08:56:11 +0000 (UTC) Message-ID: Date: Tue, 26 Mar 2024 09:56:10 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] riscv: hwprobe: do not produce frtace relocation Content-Language: en-US To: Vladimir Isaev , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, catalin.marinas@arm.com, evan@rivosinc.com, nicolas@fjasle.eu, tglx@linutronix.de, samitolvanen@google.com, masahiroy@kernel.org, maskray@google.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, guoren@kernel.org Cc: Roman Artemev References: <20240313085843.17661-1-vladimir.isaev@syntacore.com> From: Alexandre Ghiti In-Reply-To: <20240313085843.17661-1-vladimir.isaev@syntacore.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr Hi Vladimir, s/frtace/ftrace On 13/03/2024 08:35, Vladimir Isaev wrote: > Such relocation causes crash of android linker similar to one > described in commit e05d57dcb8c7 > ("riscv: Fixup __vdso_gettimeofday broke dynamic ftrace"). > > Looks like this relocation is added by CONFIG_DYNAMIC_FTRACE which is > disabled in the default android kernel. > > Before: > > readelf -rW arch/riscv/kernel/vdso/vdso.so: > > Relocation section '.rela.dyn' at offset 0xd00 contains 1 entry: > Offset Info Type > 0000000000000d20 0000000000000003 R_RISCV_RELATIVE > > objdump: > 0000000000000c86 <__vdso_riscv_hwprobe@@LINUX_4.15>: > c86: 0001 nop > c88: 0001 nop > c8a: 0001 nop > c8c: 0001 nop > c8e: e211 bnez a2,c92 <__vdso_riscv_hwprobe... > > After: > readelf -rW arch/riscv/kernel/vdso/vdso.so: > > There are no relocations in this file. > > objdump: > 0000000000000c86 <__vdso_riscv_hwprobe@@LINUX_4.15>: > c86: e211 bnez a2,c8a <__vdso_riscv_hwprobe... > c88: c6b9 beqz a3,cd6 <__vdso_riscv_hwprobe... > c8a: e739 bnez a4,cd8 <__vdso_riscv_hwprobe... > c8c: ffffd797 auipc a5,0xffffd > > Also disable SCS since it also should not be available in vdso. > > Fixes: aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data") > Signed-off-by: Roman Artemev > Signed-off-by: Vladimir Isaev > --- > arch/riscv/kernel/vdso/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile > index 9b517fe1b8a8..272c431ac5b9 100644 > --- a/arch/riscv/kernel/vdso/Makefile > +++ b/arch/riscv/kernel/vdso/Makefile > @@ -37,6 +37,7 @@ endif > > # Disable -pg to prevent insert call site > CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) > +CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) I did not find a way to remove those flags for all C files automatically, too bad. But then I noticed that we were the only architecture which does not check for dynamic relocations in vdso, so at least we'll fail loudly. I'll send a patch for that soon. This should go into -fixes. Anyway, you can add: Reviewed-by: Alexandre Ghiti Thanks, Alex > > # Disable profiling and instrumentation for VDSO code > GCOV_PROFILE := n