Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1256320ioo; Fri, 27 May 2022 05:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtaoyHkXujb1RCO+1YWEC9kndKCWwz+TqaomMtf+MMyz4wIWHPLFzre6zD3tK8FBvFDP0L X-Received: by 2002:a05:6402:401b:b0:42b:5bbf:4b88 with SMTP id d27-20020a056402401b00b0042b5bbf4b88mr28932753eda.238.1653653285969; Fri, 27 May 2022 05:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653653285; cv=none; d=google.com; s=arc-20160816; b=UTcDaPBLVLpXOi3erIg/iSInVP/oN+pM4A/wsvyv8nniTRA+gtr9UmzbtoO1vlXjba lURQRPLGnWp+jjI4n4xtgrDLcFUvDqeY0a9sDWO5hF6FZ9IhU6Tru2xKo91+2FiK9GiL GlOgcHi0k8kLV6IkU3yvUZDdQA0LVbxxcuqME5pWbkyQnOG5qO3BuMLQPuBt8PPOj84T VoxXoLulwis8DLb1g8ZiuVMF1noSpwiQynnjkkjVyifYnrgxgekcSDqbFWKGbpUlTW8K 4XadHzanEWDJuJPyGI5YMTRsqoF4EvGQKLhf44nHmuk+M4evrjfYXo+vcHhN5GXaZEg2 1YEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sVJwOhSTSKfzqMReChSMAo5QFDaEc6svdWK2kMQJ9eU=; b=w2Z3ot20E8nFvPBTAW9MqYJ+w2dfHszRB7oH9SHhJwGAz1A60A9eqcP/aURe2bx1Jo xpXdN/bUKItiyuC6OPQ06v+lY37Ngpq7VRExUkJcbAcm4/EwK0buMbF9Zz5C9UmBkoM1 1QjIndSDl6TQMeGa91keEhvdw52qNw0mF59J7NKD21zeiFHXs6jTSepx7APKPkrKuwli ULBj2cSVJRiugqSwDBbkNtpr6Ee71f7Ie2Tb8ZmC/grXIh8ur92WEGtyMlbg+lCYDuIs CRCOj5qBQWL6sOLKUKVwNuLMFa2/GZgN4sHpL8Z7MmL0co60Dmvq63AmhepdAWbzK/Uj ClXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cVT6qx8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a056402425400b0042b4bd763a0si4797068edb.11.2022.05.27.05.07.40; Fri, 27 May 2022 05:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cVT6qx8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239459AbiEZB0J (ORCPT + 99 others); Wed, 25 May 2022 21:26:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiEZB0H (ORCPT ); Wed, 25 May 2022 21:26:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD8A26EC4F; Wed, 25 May 2022 18:26:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62FEDB81E9F; Thu, 26 May 2022 01:26:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16C54C34118; Thu, 26 May 2022 01:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653528364; bh=lDpTSVw2M6hQDO6YVoSC7pj8BgxtHOakbMzZN1/oTg4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cVT6qx8eghDEbiqGn3ntsfv83va7M2f5npYS/UgcGcI7W5YAaTW9loYv8DitShO7b ez9HWS9lOwtUxbFILfXhVe66N93BUJ83pQYUYgms7O8IVuGjIgqugQQlQtjELDAAVQ B9D3bIoWlJUegwBx9uVPs9UMQEZytEPoK3CbAKSuUqa5H0Rergd4duutj3CzClk84c YUK/WBfAR1kM7CPfqh6Ke6qkivO6ZHZ5yxGb/MIv5KrCBM/dVlN7Gya+QL69GnArMa 3j/kD6j6Ln9EdYFxmSU259MpzVy6nmvVFhjxU5n+21G4Ivk/08sCNaBYwa5Dt7F6lr UR9fPIrJAMbMw== Received: by mail-vs1-f54.google.com with SMTP id h4so99944vsr.13; Wed, 25 May 2022 18:26:04 -0700 (PDT) X-Gm-Message-State: AOAM532OsV/h/fHrA0P4J8+AEsb2ya6ATXv8w9q28n1tAjrz4o+/6QcD 40STFvCESHmbYfc4GnHNsVAA2LT42rrRaRJ0b2M= X-Received: by 2002:a67:c89c:0:b0:335:d83b:df76 with SMTP id v28-20020a67c89c000000b00335d83bdf76mr13037783vsk.51.1653528362997; Wed, 25 May 2022 18:26:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Guo Ren Date: Thu, 26 May 2022 09:25:51 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] riscv: compat: Using seperated vdso_maps for compat_vdso_info To: Palmer Dabbelt Cc: Guenter Roeck , Arnd Bergmann , =?UTF-8?Q?Heiko_St=C3=BCbner?= , linux-riscv , linux-arch , Linux Kernel Mailing List , Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 26, 2022 at 8:43 AM Palmer Dabbelt wrote: > > On Wed, 25 May 2022 17:39:39 PDT (-0700), Palmer Dabbelt wrote: > > On Wed, 25 May 2022 15:56:07 PDT (-0700), linux@roeck-us.net wrote: > >> On 5/25/22 14:34, Palmer Dabbelt wrote: > >>> On Wed, 25 May 2022 14:15:03 PDT (-0700), linux@roeck-us.net wrote: > >>>> On 5/25/22 09:04, guoren@kernel.org wrote: > >>>>> From: Guo Ren > >>>>> > >>>>> This is a fixup for vdso implementation which caused musl to > >>>>> fail. > >>>>> > >>>>> [ 11.600082] Run /sbin/init as init process > >>>>> [ 11.628561] init[1]: unhandled signal 11 code 0x1 at > >>>>> 0x0000000000000000 in libc.so[ffffff8ad39000+a4000] > >>>>> [ 11.629398] CPU: 0 PID: 1 Comm: init Not tainted > >>>>> 5.18.0-rc7-next-20220520 #1 > >>>>> [ 11.629462] Hardware name: riscv-virtio,qemu (DT) > >>>>> [ 11.629546] epc : 00ffffff8ada1100 ra : 00ffffff8ada13c8 sp : > >>>>> 00ffffffc58199f0 > >>>>> [ 11.629586] gp : 00ffffff8ad39000 tp : 00ffffff8ade0998 t0 : > >>>>> ffffffffffffffff > >>>>> [ 11.629598] t1 : 00ffffffc5819fd0 t2 : 0000000000000000 s0 : > >>>>> 00ffffff8ade0cc0 > >>>>> [ 11.629610] s1 : 00ffffff8ade0cc0 a0 : 0000000000000000 a1 : > >>>>> 00ffffffc5819a00 > >>>>> [ 11.629622] a2 : 0000000000000001 a3 : 000000000000001e a4 : > >>>>> 00ffffffc5819b00 > >>>>> [ 11.629634] a5 : 00ffffffc5819b00 a6 : 0000000000000000 a7 : > >>>>> 0000000000000000 > >>>>> [ 11.629645] s2 : 00ffffff8ade0ac8 s3 : 00ffffff8ade0ec8 s4 : > >>>>> 00ffffff8ade0728 > >>>>> [ 11.629656] s5 : 00ffffff8ade0a90 s6 : 0000000000000000 s7 : > >>>>> 00ffffffc5819e40 > >>>>> [ 11.629667] s8 : 00ffffff8ade0ca0 s9 : 00ffffff8addba50 s10: > >>>>> 0000000000000000 > >>>>> [ 11.629678] s11: 0000000000000000 t3 : 0000000000000002 t4 : > >>>>> 0000000000000001 > >>>>> [ 11.629688] t5 : 0000000000020000 t6 : ffffffffffffffff > >>>>> [ 11.629699] status: 0000000000004020 badaddr: 0000000000000000 > >>>>> cause: 000000000000000d > >>>>> > >>>>> The last __vdso_init(&compat_vdso_info) replaces the data in normal > >>>>> vdso_info. This is an obvious bug. > >>>>> > >>>>> Reported-by: Guenter Roeck > >>>>> Signed-off-by: Guo Ren > >>>>> Signed-off-by: Guo Ren > >>>>> Cc: Palmer Dabbelt > >>>>> Cc: Heiko St=C3=BCbner > >>>> > >>>> Tested-by: Guenter Roeck > >>> > >>> Sorry I'm a bit buried right now, this is fixing the issue you pointe= d out earlier? > >>> > >> Yes. > > > > Awosome, I think that was the only big blocker so far. > > > > I added a musl-based userspace to my test setup, which is rv64-only > > (buildroot doesn't have rv32 musl, I thought upstream had it but maybe > > i'm misremembering). This patch fixes the bug, so I've added it to > > for-next with > > Just saw the v2, so I'm using that instead. Sorry, v2 should be abandoned. Just adding Tested-by is enough. > > > > > Fixes: 3092eb456375 ("riscv: compat: vdso: Add setup additional pages i= mplementation") > > > > which I think is correct, but LMK if there's an issue. > > > > Thanks! > > > > (and also sorry I poked Geert instead of you about this one, oops ;)) > > > >> > >> Thanks, > >> Guenter > >> > >>>> > >>>>> --- > >>>>> arch/riscv/kernel/vdso.c | 15 +++++++++++++-- > >>>>> 1 file changed, 13 insertions(+), 2 deletions(-) > >>>>> > >>>>> diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c > >>>>> index 50fe4c877603..69b05b6c181b 100644 > >>>>> --- a/arch/riscv/kernel/vdso.c > >>>>> +++ b/arch/riscv/kernel/vdso.c > >>>>> @@ -206,12 +206,23 @@ static struct __vdso_info vdso_info __ro_afte= r_init =3D { > >>>>> }; > >>>>> > >>>>> #ifdef CONFIG_COMPAT > >>>>> +static struct vm_special_mapping rv_compat_vdso_maps[] __ro_after_= init =3D { > >>>>> + [RV_VDSO_MAP_VVAR] =3D { > >>>>> + .name =3D "[vvar]", > >>>>> + .fault =3D vvar_fault, > >>>>> + }, > >>>>> + [RV_VDSO_MAP_VDSO] =3D { > >>>>> + .name =3D "[vdso]", > >>>>> + .mremap =3D vdso_mremap, > >>>>> + }, > >>>>> +}; > >>>>> + > >>>>> static struct __vdso_info compat_vdso_info __ro_after_init =3D { > >>>>> .name =3D "compat_vdso", > >>>>> .vdso_code_start =3D compat_vdso_start, > >>>>> .vdso_code_end =3D compat_vdso_end, > >>>>> - .dm =3D &rv_vdso_maps[RV_VDSO_MAP_VVAR], > >>>>> - .cm =3D &rv_vdso_maps[RV_VDSO_MAP_VDSO], > >>>>> + .dm =3D &rv_compat_vdso_maps[RV_VDSO_MAP_VVAR], > >>>>> + .cm =3D &rv_compat_vdso_maps[RV_VDSO_MAP_VDSO], > >>>>> }; > >>>>> #endif > >>>>> --=20 Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/