Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp75798ybh; Mon, 20 Jul 2020 10:42:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD6I43Rr8hOdGGL6KZXFy/59S/NS5iurZen+HkaQzlqrx3UeTc6rLpyuE0zo7vffOYHSQV X-Received: by 2002:a17:906:8601:: with SMTP id o1mr22372024ejx.326.1595266973717; Mon, 20 Jul 2020 10:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595266973; cv=none; d=google.com; s=arc-20160816; b=CvujzIN7pJvmlgeplFpDblY0LhakGacupTTHM06on/tzTQMQY+668iN5ia+Tt2WACl 1xBzkELmPuFOXrIYlxnlxkP3R/oMGWeEyizL/Mjpj3HNstr+3k5TNTxwo2604oukOiYr XolGiuthYDR2/WkpD59DfhIcxt2cqWfXF5ln8zOHhlt2XrSRqzFrxwO6ArY3U7HEdy9m rWgJ1RPD2wo8RY+jzeRFmCUXPRUxTdfkYYeNrSOd4/ScS3Nj3ZhtdDNm+6rpaCgosxjW LiV79W78puH20JIMchqYfeGw+3CEJ9nT6rxmbEWkSR9DcDdGu8xrEM4Zu21VHOn6QNr9 yiLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+UphPDJl+kRrCVRabYY8RnE2th0stWf+j9IyyIzXzz4=; b=rAKVeOildVWJ7l565Snu3x7k9qMn+xQs1kixL01BBWifJEwp55/yD9mHpFbDBqLRsY a9FQq2+7S8NR/mTZpdpOd2w9TrEB2dC9UhjKwG8QeHOhv/qAyrPBVPyRaPYCER04List TnYqbOSxz3Cp9SohXZ6wPItac3/iVRVguHiN7k185f2Gow3e/v0MtBzGP4AqToezjLqP npJhBdloeR8eJ5HJVlI1WNDm9QrjoYmWh8JXYD6aeIx1eb3v4Dmgm7+sBogk18vKapMQ DL072RMTUXnAyf/SUnxQRVMxocS94QU02CrkQLztsoilj5FFsTdnt3rOhBM00gWbbpZ7 MeiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gr3amyWe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de9si11516859edb.404.2020.07.20.10.42.29; Mon, 20 Jul 2020 10:42:53 -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=@linaro.org header.s=google header.b=Gr3amyWe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732924AbgGTRlf (ORCPT + 99 others); Mon, 20 Jul 2020 13:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730633AbgGTRle (ORCPT ); Mon, 20 Jul 2020 13:41:34 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22822C0619D2 for ; Mon, 20 Jul 2020 10:41:34 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id j21so10191823lfe.6 for ; Mon, 20 Jul 2020 10:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+UphPDJl+kRrCVRabYY8RnE2th0stWf+j9IyyIzXzz4=; b=Gr3amyWeN8CJm9nhgL8Q+ANXLLF30j6WnHckJ2NBMsFmlAJtjt3a4TNCA3VrgBNnTS EU7fQOi/aSO1yXCDgazjyRaHvBKyfUsES0BTlnaoABW12LwZKN4gV3wNeuPpjm1o48Bc 7fnMJgZLX8qCXK54U79GuGSoMxYoTaddVXOqRxyTa3niyIuN3HtW41b/LTtlT7dfwjCz MuChCtDTVSdM9OJVRe7S3qzO59qEMjk+dvI3LruPpqHgzfjc5Gm8aQ/+5p+7NI0Ciam5 A31TT4WudQt+w+zCsFRnplHhQiIn+O3VnOKEW33PVc7GWAgzdmg20XvIpCdNRzbXfrBx o2ZQ== 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:content-transfer-encoding; bh=+UphPDJl+kRrCVRabYY8RnE2th0stWf+j9IyyIzXzz4=; b=oeJ+Kw+/ELdarvNi2cOgpa6nAOaE9C8vc8ewHYoMoV7CwIQZ51mbYim+OMqz2WaGK/ OTCVd6KL7ksD7+Mbt+t9BhuxyyGetBMQycX09w0ibSefHVyn1VNqjxsSZHfQjdwlemxe zwjUUw20BCNlzysxeKH0fcg9EsaFEuBXfSunaiZu8yMzglNsNmtAFK+L+SFlMJLOn8Ac 9gySmk7dHHArUSuNmthv+R+bK2RSVqW9YxMywVHvhF+DEvXyU7GPWqrT3Wk5pfgx5GDW W2HVN7u5Nk5JjgfJd0kn/u3kVzn1LJ3l2q8GlRFqS5wkSk0yBLaY3+wnNC5r25BNTRV9 zj5A== X-Gm-Message-State: AOAM533g85W4F5gqmQMGXq6pFbQFQM1ZLiupGripnWTWpdFWF2sV4deo O1hWJ2oJ3UXNebPNLcKF7Bq6YqJtiH9DlFXVHEdMBQ47uD/0uQ== X-Received: by 2002:a19:6715:: with SMTP id b21mr3045875lfc.55.1595266892447; Mon, 20 Jul 2020 10:41:32 -0700 (PDT) MIME-Version: 1.0 References: <20200720152825.863040590@linuxfoundation.org> <20200720152836.926007002@linuxfoundation.org> In-Reply-To: <20200720152836.926007002@linuxfoundation.org> From: Naresh Kamboju Date: Mon, 20 Jul 2020 23:11:20 +0530 Message-ID: Subject: Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range To: Greg Kroah-Hartman , linux- stable Cc: open list , Atish Patra , Michel Lespinasse , Zong Li , Palmer Dabbelt , lkft-triage@lists.linaro.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RISC-V build breaks on stable-rc 5.7 branch. build failed with gcc-8, gcc-9 and gcc-9. On Mon, 20 Jul 2020 at 21:46, Greg Kroah-Hartman wrote: > > From: Atish Patra > > commit 0e2c09011d4de4161f615ff860a605a9186cf62a upstream. > > As per walk_page_range documentation, mmap lock should be acquired by the > caller before invoking walk_page_range. mmap_assert_locked gets triggered > without that. The details can be found here. > > http://lists.infradead.org/pipermail/linux-riscv/2020-June/010335.html > > Fixes: 395a21ff859c(riscv: add ARCH_HAS_SET_DIRECT_MAP support) > Signed-off-by: Atish Patra > Reviewed-by: Michel Lespinasse > Reviewed-by: Zong Li > Signed-off-by: Palmer Dabbelt > Signed-off-by: Greg Kroah-Hartman > > --- > arch/riscv/mm/pageattr.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > --- a/arch/riscv/mm/pageattr.c > +++ b/arch/riscv/mm/pageattr.c > @@ -151,6 +151,7 @@ int set_memory_nx(unsigned long addr, in > > int set_direct_map_invalid_noflush(struct page *page) > { > + int ret; > unsigned long start =3D (unsigned long)page_address(page); > unsigned long end =3D start + PAGE_SIZE; > struct pageattr_masks masks =3D { > @@ -158,11 +159,16 @@ int set_direct_map_invalid_noflush(struc > .clear_mask =3D __pgprot(_PAGE_PRESENT) > }; > > - return walk_page_range(&init_mm, start, end, &pageattr_ops, &mask= s); > + mmap_read_lock(&init_mm); > + ret =3D walk_page_range(&init_mm, start, end, &pageattr_ops, &mas= ks); > + mmap_read_unlock(&init_mm); make -sk KBUILD_BUILD_USER=3DTuxBuild -C/linux ARCH=3Driscv CROSS_COMPILE=3Driscv64-linux-gnu- HOSTCC=3Dgcc CC=3D"sccache riscv64-linux-gnu-gcc" O=3Dbuild defconfig # # make -sk KBUILD_BUILD_USER=3DTuxBuild -C/linux -j32 ARCH=3Driscv CROSS_COMPILE=3Driscv64-linux-gnu- HOSTCC=3Dgcc CC=3D"sccache riscv64-linux-gnu-gcc" O=3Dbuild # ../arch/riscv/mm/pageattr.c: In function =E2=80=98set_direct_map_invalid_no= flush=E2=80=99: ../arch/riscv/mm/pageattr.c:162:2: error: implicit declaration of function =E2=80=98mmap_read_lock=E2=80=99; did you mean =E2=80=98_raw_read_= lock=E2=80=99? [-Werror=3Dimplicit-function-declaration] 162 | mmap_read_lock(&init_mm); | ^~~~~~~~~~~~~~ | _raw_read_lock ../arch/riscv/mm/pageattr.c:164:2: error: implicit declaration of function =E2=80=98mmap_read_unlock=E2=80=99; did you mean =E2=80=98_raw_rea= d_unlock=E2=80=99? [-Werror=3Dimplicit-function-declaration] 164 | mmap_read_unlock(&init_mm); | ^~~~~~~~~~~~~~~~ | _raw_read_unlock cc1: some warnings being treated as errors > + > + return ret; > } > > int set_direct_map_default_noflush(struct page *page) > { > + int ret; > unsigned long start =3D (unsigned long)page_address(page); > unsigned long end =3D start + PAGE_SIZE; > struct pageattr_masks masks =3D { > @@ -170,7 +176,11 @@ int set_direct_map_default_noflush(struc > .clear_mask =3D __pgprot(0) > }; > > - return walk_page_range(&init_mm, start, end, &pageattr_ops, &mask= s); > + mmap_read_lock(&init_mm); > + ret =3D walk_page_range(&init_mm, start, end, &pageattr_ops, &mas= ks); > + mmap_read_unlock(&init_mm); > + > + return ret; > } > > void __kernel_map_pages(struct page *page, int numpages, int enable) > ref: full build log with default config. https://gitlab.com/Linaro/lkft/kernel-runs/-/jobs/647154950 --=20 Linaro LKFT https://lkft.linaro.org