Message ID | 08f9787b1fd0d552b65c62547f5382d5a5c7dbe4.1679431886.git.lstoakes@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36677C76195 for <linux-mm@archiver.kernel.org>; Tue, 21 Mar 2023 20:54:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C82A56B0078; Tue, 21 Mar 2023 16:54:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C0D2D6B007D; Tue, 21 Mar 2023 16:54:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F1646B0078; Tue, 21 Mar 2023 16:54:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 89EC76B0078 for <linux-mm@kvack.org>; Tue, 21 Mar 2023 16:54:43 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 18A161601F3 for <linux-mm@kvack.org>; Tue, 21 Mar 2023 20:54:43 +0000 (UTC) X-FDA: 80594109246.21.0695D64 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by imf19.hostedemail.com (Postfix) with ESMTP id 356371A000D for <linux-mm@kvack.org>; Tue, 21 Mar 2023 20:54:40 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=WXv44Su+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=lstoakes@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679432081; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cY5q38znnygXEk7MQGfhMNT6fWhXSJdRMwyHM9vnLSQ=; b=tRMIbiqAjFwHuHNdSsH3tBOlHOqZQ+n9JwUbR9cLeK5ZQtOnZ8azknmvyzvWPdDaOvfio6 3/L3BiN7cP8LHL1+8ehtfGDDhQOdXrpghvy2734oH3DPuJ71qE36xZvGat+o0bg8oT5fhI vgLHYC/rRJtQ7hMhxOkeEcmwoAMNsJI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=WXv44Su+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=lstoakes@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679432081; a=rsa-sha256; cv=none; b=lZYHwNxc646KEDP3BRVXlzCs1a1zmu3yd1Y5S9zDVkpAtvQfGnYdQfbP3ebCc4uPVNqGql 77179nCuP4u166HBWnF1c9j2RhFiN9NPtnsWrvEiM2F5CwJT2N/JIv8PngGBWDj5WQeTiv pAbFbmREpNMvBF52elylCKPVqRRohpg= Received: by mail-wr1-f42.google.com with SMTP id v25so11580292wra.12 for <linux-mm@kvack.org>; Tue, 21 Mar 2023 13:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679432079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cY5q38znnygXEk7MQGfhMNT6fWhXSJdRMwyHM9vnLSQ=; b=WXv44Su+m8P4kXKAgctFKpHknepkQ3/lIhDf1dfJsDViOOre129Y7j4Ck5+3x/5pBr jwFY+17jeebTUBg5beyTQI2XmhJvQ9Lb/RmWt+lLNoLw452/VnjezC9HUTAmrKNIHSkt zmTlY/i5G76kkuraE93tLzBXqrKmvaZH5v3blsuow9zYdrEJqT1j8BcpstGTVd2SN9WX DKtYV7pDHdu/3Q9W61A8o5izTsKHNJLCFSvFn2Wfj1fiEBqfApZ2aXKNHl0JSHvH+ENz YpVn5gFll/rCOaUyZF0/TyPtZz2fF3YgDxkSdLKqRmt4RlKE2dRB9uT0EOH/MK7WKOdj 2qTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679432079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cY5q38znnygXEk7MQGfhMNT6fWhXSJdRMwyHM9vnLSQ=; b=Kqz/yucfm+WOVdsBWcL5JljLC2OO4H/rToCclaIrquCvN8mQ7aPiioaEgs3eQIumd3 Z4p5aq/VNXWrPOEAdfFhxHzAGIj1kL0sE8Wh7Vf+SM8rEsj8C8EqRDcpZJ8ujwcnSE1Y 4Vpgyes8sWW413kZ6wobktxVOXxjHzdPmXCjsOVmBiH7OgUNk5eXIO2th/pvxTjjxnC/ jC2+Yl6cJ2hM9mlCXbbVhHFz7dFrG+52dHNClPrKztB8Qk+xBf08t43VQ0XgcLZvQCE+ MmC1gWrw1LwCGQGLRm/0K54V3qWYzLVntFiIqiUXm4vdHL4yz4DcI3zYnpXP/qhUOfQf Hb9Q== X-Gm-Message-State: AO0yUKVATn4ngaig61kvc4drvjDNG7LkLgy7kHh47d6pguMzSk4AK/VP Dmw3u5c66Vh4xDDMNK3nf/Ufv6i7cY4= X-Google-Smtp-Source: AK7set/ERpVemd/vLRdCwAkIy45+Hl+RuG9U/wayryoIiE+n2Qpze3L+1Sf3hOQVwJz0prOr7IANIA== X-Received: by 2002:adf:e481:0:b0:2d1:f705:a602 with SMTP id i1-20020adfe481000000b002d1f705a602mr3193312wrm.22.1679432079310; Tue, 21 Mar 2023 13:54:39 -0700 (PDT) Received: from lucifer.home (host86-146-209-214.range86-146.btcentralplus.com. [86.146.209.214]) by smtp.googlemail.com with ESMTPSA id a8-20020a056000100800b002d8566128e5sm3744575wrx.25.2023.03.21.13.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 13:54:38 -0700 (PDT) From: Lorenzo Stoakes <lstoakes@gmail.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org> Cc: Baoquan He <bhe@redhat.com>, Uladzislau Rezki <urezki@gmail.com>, Matthew Wilcox <willy@infradead.org>, David Hildenbrand <david@redhat.com>, Liu Shixin <liushixin2@huawei.com>, Jiri Olsa <jolsa@kernel.org>, Jens Axboe <axboe@kernel.dk>, Alexander Viro <viro@zeniv.linux.org.uk>, Lorenzo Stoakes <lstoakes@gmail.com> Subject: [PATCH v4 1/4] fs/proc/kcore: avoid bounce buffer for ktext data Date: Tue, 21 Mar 2023 20:54:30 +0000 Message-Id: <08f9787b1fd0d552b65c62547f5382d5a5c7dbe4.1679431886.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <cover.1679431886.git.lstoakes@gmail.com> References: <cover.1679431886.git.lstoakes@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 356371A000D X-Stat-Signature: gmnkz6qt3nkya6bsifmfkxu19rc4wef4 X-HE-Tag: 1679432080-267169 X-HE-Meta: U2FsdGVkX18F0bfcgdmES+cr8ICaKkdjoQm4cGsKhofZpRmv6VuHvQ2CCoAb02FNTTD7fpWXIfmRCaAGEltlu7NjGAKdUJObnq3/skPOpug9K9PWrYDOaOAqeBBagWsIWAtKzIiYV5bzlxogv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gM/+RaOOcSmDDu3HvubRXmBO4u2h5itbQBxb51/3eXeeQQdxyfhfzYbZt1BRCOlOM58w7Ic/VGLaJDfkwO8SsUt2+XImnHqIvmtnhb4cJhv/Eu1pLvApAnGYwpvPDLK1q1SE2NgVq/btyCTlhBu7PbDCKXNuuA4e8G5xuLzyDOfn4IxEHWLXZnU+MIb8rJFUpnijBkbY4je6pLrCskMSyW2oA1b1f+CXHyboipWhTPVyHgV303Z54EkhCXnc/IbScOxdGBMIrd+XE83rgw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
convert read_kcore(), vread() to use iterators
|
expand
|
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 71157ee35c1a..556f310d6aa4 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -541,19 +541,12 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) case KCORE_VMEMMAP: case KCORE_TEXT: /* - * Using bounce buffer to bypass the - * hardened user copy kernel text checks. + * We use _copy_to_user() to bypass usermode hardening + * which would otherwise prevent this operation. */ - if (copy_from_kernel_nofault(buf, (void *)start, tsz)) { - if (clear_user(buffer, tsz)) { - ret = -EFAULT; - goto out; - } - } else { - if (copy_to_user(buffer, buf, tsz)) { - ret = -EFAULT; - goto out; - } + if (_copy_to_user(buffer, (char *)start, tsz)) { + ret = -EFAULT; + goto out; } break; default: