Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp924060ioo; Thu, 26 May 2022 19:16:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD875QbcE6DbZGqGF6ZP2F0Jok7f2MLF0iLQs9nmOWXpmGuYr3CoRfMW2UIOhsDkxbiHh4 X-Received: by 2002:a17:902:d501:b0:163:7f87:d96e with SMTP id b1-20020a170902d50100b001637f87d96emr4877941plg.160.1653617804859; Thu, 26 May 2022 19:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653617804; cv=none; d=google.com; s=arc-20160816; b=RMPLMMwNO90V24okzPEy33cG5ch/zm+HPwJTWcMSDB9gfXyEBjvjq9lxOl7EMV7hKH Nkeip5/TX5ykizlMp1HTfyP9WHJ3uSfTtSI7ThbwtofO0MHrtmv+DWnaUJ1hFgZ3QFkP OW9wdIFPXw5Y3y/EwAJ4IgdJmes6oDV/ACtLGrUzbahZWtpSTjIMdf6oN+XK3vznzQmF Hbu2LfLKuUWFzw6B1Xx/17tCIH9/GUeM+WjcAOfB5IvcacxIMIodKSmAfsWwpEFnZqYw ouCMOaMupitdN5ccsuuHjrdC+jM0PSMjMSuEW66rd+ddtsbXpx3FSXypRh7ZktKKqijC jjSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=IJTqDFjqCzxzT9sNGwb8smwhndUIJK3si2+NAvjLPes=; b=yy+Qqqk2VDDv9mfhfYrVPcEW5m0DSdr1r9hLH7dH0zBTMzkIqgccxK5YRM3VeK4GYY /5592kR9sbCUtcVkaaqzOg4KGIFwHdzDHia+7oFf6KmWn9S9WVMMPiip/qeptK6Qa4p9 yPT2OczhU7q3cFIizHi8/AyuK2iow10D3NAFVFwlvS+Aj2QMCLpd6UGjxMtrBNE76TxV 6+J2CK4gkHbt1nnZ7icfPn+Nj11ImRsxLPH3iJ/2Xfkx4PqKdCZfpYbbM7Xfq617y/Hv XCgNsO+IL33+YVjkjxHcfVBQbqBrzxCkw4hmsBtLhKfOYrYvRXvCx4v17J1MiDEjIPf0 Ifwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=Fo56R9QS; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a170902a70100b0015d44b29005si3615475plq.413.2022.05.26.19.16.30; Thu, 26 May 2022 19:16:44 -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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=Fo56R9QS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345294AbiEZB1G (ORCPT + 99 others); Wed, 25 May 2022 21:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345018AbiEZB07 (ORCPT ); Wed, 25 May 2022 21:26:59 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E22109D4E3 for ; Wed, 25 May 2022 18:26:56 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id f21so481003pfa.3 for ; Wed, 25 May 2022 18:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=IJTqDFjqCzxzT9sNGwb8smwhndUIJK3si2+NAvjLPes=; b=Fo56R9QSrSXqfV05MSzzv7c9rMI/iX8H4AGbweLENhxpW5nawqk8y+LqBTCmNg/4i+ PhXsfFO5c2nBs6fmgjNmwkm+l+iPglwQplWAFk31l2ERXQSR+O8CS83VxWDKHreBauXZ C+tIF31wEw/+dWjT+ZrNsjeJafF81tZHuvLMYl2o87d8VzeDw/ei3kuAdkSOYZY6szYf /cpcSCkjZrMPdcHw8DAxQ8TdyoZqFlv155nOz1bEHxRW2aRtYt4OLf9v5ZlVNxGt8FTQ Ad3jAt5arJXGF/YwYauIPTunz82O+JznzJ+J9Gg2wxJBWktLH8WUbpNHfUT5nZDvCh0n B5Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=IJTqDFjqCzxzT9sNGwb8smwhndUIJK3si2+NAvjLPes=; b=BtTMswCf10DAacRWxfAzopwhX2t9JbAARhhfVIG14AVdkQ82Q8xB6QS1l62C9pveY8 htBdie+dUQ1rCal99YqulxXZ51YIQPhDUjGj9577ifugM97dc/j1EP1P33BE2o/NO/Mo OQhP37tbIEcgtPvbEbpmuJfzIIfOAGnmX7dNA2MLJwvjItN0eQyXiQdpH+P6Me7qGYvd bQLhmPKBFCVZrbrubhC2D6ie7ijpsF19PTYyKmh1WPV1Xk8/znj8fq62+AVTMfJgzUtt XqA96u50TqyRgEfS8cBAVzEc2dPprO+n88cZiP6hdLVV19UG4edYPnv++Tlu6YxhG23t eGhg== X-Gm-Message-State: AOAM530SroI4VReugWgxDj/4XcAZJ/k2WXhlLjxNCv9lI4yR9yd9s6a7 jSrP0MU5KPOGqEObFcUpNQbzNA== X-Received: by 2002:a65:6cc3:0:b0:3f6:26e9:5c1 with SMTP id g3-20020a656cc3000000b003f626e905c1mr30607276pgw.28.1653528416310; Wed, 25 May 2022 18:26:56 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id r5-20020a1709028bc500b001608bceb092sm51637plo.124.2022.05.25.18.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 18:26:55 -0700 (PDT) Date: Wed, 25 May 2022 18:26:55 -0700 (PDT) X-Google-Original-Date: Wed, 25 May 2022 18:26:54 PDT (-0700) Subject: Re: [PATCH V2] riscv: compat: Using seperated vdso_maps for compat_vdso_info In-Reply-To: CC: jrtc27@jrtc27.com, Arnd Bergmann , linux@roeck-us.net, heiko@sntech.de, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, guoren@linux.alibaba.com From: Palmer Dabbelt To: guoren@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no 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 Wed, 25 May 2022 18:24:01 PDT (-0700), guoren@kernel.org wrote: > On Thu, May 26, 2022 at 9:00 AM Jessica Clarke wrote: >> >> On 26 May 2022, at 01:33, 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 >> > Tested-by: Guenter Roeck >> > Tested-by: Heiko Stübner >> > Signed-off-by: Guo Ren >> > Signed-off-by: Guo Ren >> > Cc: Palmer Dabbelt >> > --- >> > Changes in V2: >> > - Add Tested-by >> > - Rename vvar & vdso in /proc//maps. >> >> Why? No other architecture renames it to that, and various pieces of >> software look for the magic [vdso] name, including GDB and LLDB, though >> by my count there are 57 source packages in Debian that contain the >> string literal "[vdso]" (including quotes), including Firefox, >> Android's ART, lvm2 and elfutils. > Opps, Thx for pointing this out. Abandon the version of the patch. @Palmer OK, I'll stick with the v1 I had -- everything was still in staging anyway, though the tests probably wouldn't have found this one as I don't run any of those (I'm just running buildroot's defaults). > >> >> Jess >> >> > --- >> > 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..957f164c9778 100644 >> > --- a/arch/riscv/kernel/vdso.c >> > +++ b/arch/riscv/kernel/vdso.c >> > @@ -206,12 +206,23 @@ static struct __vdso_info vdso_info __ro_after_init = { >> > }; >> > >> > #ifdef CONFIG_COMPAT >> > +static struct vm_special_mapping rv_compat_vdso_maps[] __ro_after_init = { >> > + [RV_VDSO_MAP_VVAR] = { >> > + .name = "[compat vvar]", >> > + .fault = vvar_fault, >> > + }, >> > + [RV_VDSO_MAP_VDSO] = { >> > + .name = "[compat vdso]", >> > + .mremap = vdso_mremap, >> > + }, >> > +}; >> > + >> > static struct __vdso_info compat_vdso_info __ro_after_init = { >> > .name = "compat_vdso", >> > .vdso_code_start = compat_vdso_start, >> > .vdso_code_end = compat_vdso_end, >> > - .dm = &rv_vdso_maps[RV_VDSO_MAP_VVAR], >> > - .cm = &rv_vdso_maps[RV_VDSO_MAP_VDSO], >> > + .dm = &rv_compat_vdso_maps[RV_VDSO_MAP_VVAR], >> > + .cm = &rv_compat_vdso_maps[RV_VDSO_MAP_VDSO], >> > }; >> > #endif >> > >> > -- >> > 2.36.1 >> > >> > >> > _______________________________________________ >> > linux-riscv mailing list >> > linux-riscv@lists.infradead.org >> > http://lists.infradead.org/mailman/listinfo/linux-riscv >> > > > -- > Best Regards > Guo Ren > > ML: https://lore.kernel.org/linux-csky/