Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp329557pxu; Wed, 14 Oct 2020 02:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUmnjZ+CUA0IkAVzYFiVurIU/yYRhfk0XVzPvPgV2haZTY7XfYkmfEYkBGQN3KIbA+2JjU X-Received: by 2002:a17:906:453:: with SMTP id e19mr4417818eja.391.1602667526239; Wed, 14 Oct 2020 02:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602667526; cv=none; d=google.com; s=arc-20160816; b=S1Fy6jyv0gVF3CFYTFOwSkRvWeGy0QVUtQhbQHnFS7Tlo9oP7UZVhddk1XY4EJ5Yoj mzQDriHRbHWSEoSA2YuIrzUB1989mRnBySvDlLwxfjHkVgjeioSbIUUrtsF/5J81Rdv4 QIqHPQEYqe6VlEgrZz4BF+fcxhxczdXMXBSvdQdS5oVvACdEAr0iISoCmWiMvHscp9vS HfRTAgleN+anQtBRUdyX63yXMg9t6aENZIpAcdegiJDZCUsYFCch5iazzy+dvF8y25cX uQJserm0iGki3vTslYy6ykbGvf6rA6S1lUiRUltZ4R9LnexBwYxuGVVfi+Zc3htry+6l DNzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WXuyKKLXCqER0qiq8dEKjvLqiC2JwcKFo8wUFhLVXXU=; b=fNckHfD37YYUG7gex+j+9l/AXxpuYHeAwurc5YlFiHzkLBj1sxh8vV766nsLpJRoR7 Op47KEIoHoGIZjBUjvZBG5PcfOEIX/tOiG2pazNNgDOd4HZbJGl5QJYhBosNutCWeZ7y yo1Zik/JZtpzlT9TqhFvF6pP0PDYO9KndyxueTLFy+Q/0BXC2dTuKq8r7MdxEZUzp4R4 fuTvck5cru1+lkckgczBOvNXURPn/JKsOErswQ/luXJ+3RPcobPAVF8bhI8/8Ng46j4U O/DXLABhxN1TBp1i+Clf5sC8qc0cWN71tk4Q0YikzLU0mqxOjXsbCtntr+LOn1Kf63lv AP8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=OlSx2JyL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si1685785eje.670.2020.10.14.02.25.04; Wed, 14 Oct 2020 02:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=OlSx2JyL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729790AbgJNJWv (ORCPT + 99 others); Wed, 14 Oct 2020 05:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731175AbgJNJV4 (ORCPT ); Wed, 14 Oct 2020 05:21:56 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA4DC014B23 for ; Tue, 13 Oct 2020 18:21:01 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id e22so2451640ejr.4 for ; Tue, 13 Oct 2020 18:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WXuyKKLXCqER0qiq8dEKjvLqiC2JwcKFo8wUFhLVXXU=; b=OlSx2JyLc3ZRSaS4Ush40RMl6iu1oAuZL44sPnos7VI6GgTpIlVBcu4SeP04Wb00iP fjmZElvM54tmZk76lQJRvczhdM9Ynjtx+kdckBXgqP0tGfLDsdkXMM45PsJWyh3GZA0E Ee3o/wZP1eWqCAXlOdn9kDOOVqLYYxtPiROehkrcCsPAAm09cZutlXA9BwpCPEkZtSVL MIBilxrb4v4MR5ExbSAdNrTMNw/Mv5Y3+lEHaAuT7uUprXPRq1QjzTfv91klKRsesQjF SYFI/UkKVWDwYSY2zms4LlEdsutRZjgb0VB5hZnN4m7RNQFTuq6wBmhdD2DZ18FiG4PA UMOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WXuyKKLXCqER0qiq8dEKjvLqiC2JwcKFo8wUFhLVXXU=; b=MdP18dQntqfU7sO/P+3tf4E3o9+9yv+WQRW2z/Ey/0soyR0UPi33pZTzfX2/wEiBn5 6Cw35ZLiPJ65Wv4AJKiwZLZKtbcxK4a+/3Ty0IvXCaN5vyfxGkoRbIajJuCHjB0JLBdt lpNRjJN4W0Zjsz75/8PdSb01PRZ9Mw8MBfk8lR+eXl88UoYlASmRYsewo0Qb9+Yk7Qke 6hzfjfarIkgyA16Ct5oc3+8IGU97/fGH7ANaYPLF0JmRpj+eT+vw7ifAiOqtfaZqor0X fn1wSEahcTyUeX4L2fRyJNi79HXMz0Dfcvy1ntOEVXM93U0+JKdSJIvkT9mzj2j9cBfa Jvdg== X-Gm-Message-State: AOAM531BbpPr7JZpXz7qQSy812slFu9rhveiJutSaIAHo/IE17qNIg5y QJ74QG1QulaQNXGl432CFzdAb6UwwaKxQKuyi1bVGg== X-Received: by 2002:a17:906:9396:: with SMTP id l22mr2751325ejx.36.1602638460222; Tue, 13 Oct 2020 18:21:00 -0700 (PDT) MIME-Version: 1.0 References: <20201009211344.2358688-1-atish.patra@wdc.com> <20201009211344.2358688-5-atish.patra@wdc.com> In-Reply-To: From: Jim Wilson Date: Tue, 13 Oct 2020 18:20:49 -0700 Message-ID: Subject: Re: [PATCH 4/5] RISC-V: Protect .init.text & .init.data To: Atish Patra Cc: Greentime Hu , Kito Cheng , Palmer Dabbelt , Atish Patra , Albert Ou , Kees Cook , Anup Patel , Linux Kernel Mailing List , linux-riscv , Guo Ren , Zong Li , Paul Walmsley , Andrew Morton , Borislav Petkov , Michel Lespinasse , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 3:25 PM Atish Patra wrote: > This happens only when copy_from_user is called from function that is > annotated with __init. > Adding Kito & Jim for their input > > @kito, @Jim: Please let me know if I should create a issue in > riscv-gnu-toolchain repo or somewhere else. I can't do anything useful without a testcase that I can use to reproduce the problem. The interactions here are complex, so pointing at lines of code or kernel config options doesn't give me any useful info. Relaxation can convert calls to a jal. I don't know of any open bugs in this area that can generate relocation errors. if it is a relaxation error then turning off relaxation should work around the problem as you suggested. A kernel build problem is serious. I think this is worth a bug report. FSF binutils or riscv-gnu-toolchain is fine. Jim