Message ID | 08f9787b1fd0d552b65c62547f5382d5a5c7dbe4.1679355227.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 EC68BC6FD1D for <linux-mm@archiver.kernel.org>; Mon, 20 Mar 2023 23:43:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D3D96B0078; Mon, 20 Mar 2023 19:43:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65EE66B007B; Mon, 20 Mar 2023 19:43:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FD576B007D; Mon, 20 Mar 2023 19:43:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3DA676B0078 for <linux-mm@kvack.org>; Mon, 20 Mar 2023 19:43:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1869FA070A for <linux-mm@kvack.org>; Mon, 20 Mar 2023 23:43:01 +0000 (UTC) X-FDA: 80590904562.15.1A2D4CD Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by imf11.hostedemail.com (Postfix) with ESMTP id 3FC7E40016 for <linux-mm@kvack.org>; Mon, 20 Mar 2023 23:42:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="T4eKFt/8"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.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=1679355779; 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=E5pos46GpCyOscmBvaH5d1FP2v3eiL+IpzO/xgshJ1zU9IDeVtQafNpEW/Gu4DmkTIgKEf ocYn7RIZ5Q4jev7UeIO5qG0133xrGGBlY1gsgD8ZTnkqGTz+kfP9H5NhpeiRPdm+ETWv4G 3riawyoZFWmMHB+ChdwZqhzFzbqjAPo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="T4eKFt/8"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.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=1679355779; a=rsa-sha256; cv=none; b=XzuGwzCLbf5tXnbFSO5ITwU44p0GP4wXynXLMo74RhgsHKSkKcpZOJLiVgOrxwX7wlBIHg kiioBADEQVhUfyRijQ/zAUfvE8hG0btaktuTjuUDeD4ZYSh7jdGEHS9TUjxhzmlCAxCKQG u1DqifGKR8tKtT86Tgg+SZUF/YIlSq0= Received: by mail-wr1-f42.google.com with SMTP id h17so11993163wrt.8 for <linux-mm@kvack.org>; Mon, 20 Mar 2023 16:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679355777; 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=T4eKFt/8PJCLdp758DXxE3Vk0DRGyaMCroLjSUQXTEzRpD4/0CYOWkP8UPy0HH9xTK D2YT5geOUrLotf3OYl1OMdAkwMC7w0ZMId2Bg6p6yiqc5/B9ougzR4bmhUqUvKWVMN58 QPsTXHg0EIN5kHbUjtcLcLDCCYBEeLtUHM6JMjHcUDmmaP65jYPnfNvNn4hIQJ6shUsX n3Bc5flv9tNucl6q4s6EewhDEjgwqxzm8Yb/25h0KnuX8YkkPvaD/ua4FPoiF2K4vUYH eiCEn3r0gGSY4uDZhG8EJMHEKVQrNQcLvoQCNi/Yx9T/7okh+2a+rwBioaaXzE8dAaQK 0F5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679355777; 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=RQKRjX69xY3gorUPHF1irL8PFuDVBlYML3/U2CQ2q6GRB4D0cRTAJkWJWXuudIy8Ot AvynAPA/Z5wlFAUI2CTwxWfcv9MgSPtGtEZkSubvWpGvQF1Cl3mArQ1HGRce1UriSsv5 tUd4diDuF4dS+++cq+rSJY1GfcrhYzPL4+aHr7v/Lt5MiXRaCeR76dIigX+oQYz0Wd63 WTMr+o8EBX9juT7Z1ersgbOYx2xb+Ni4i6EAZpGXn51nVXYR89ut8ToZh1+v/bs0XsUX uvowLf9GzpQjnGdwbaLBL/sDThrWGhUKlutI0jTOuZG41zGJsVzD0FPl3k6sX6f2rRGi AU1g== X-Gm-Message-State: AO0yUKU148fT1xIxhUueC1dXtzWbt2HNHrjbzn5pOLjisMThQ5Ukh1TU Vw79ByoHK7i9c3qw6lVJzUQi/e+6p0s= X-Google-Smtp-Source: AK7set/4SLRYEk0+UkeFk1Oiw2Lls+y3KoTMgnJhrqI/l2imylwBOsmTmUlFNVHmyS+Z4+blKnja8A== X-Received: by 2002:a5d:61c9:0:b0:2d4:3f3b:cdb7 with SMTP id q9-20020a5d61c9000000b002d43f3bcdb7mr725746wrv.67.1679355777214; Mon, 20 Mar 2023 16:42:57 -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 u1-20020a05600c440100b003e209186c07sm17504541wmn.19.2023.03.20.16.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 16:42:55 -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 v3 1/4] fs/proc/kcore: avoid bounce buffer for ktext data Date: Mon, 20 Mar 2023 23:42:42 +0000 Message-Id: <08f9787b1fd0d552b65c62547f5382d5a5c7dbe4.1679355227.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <cover.1679355227.git.lstoakes@gmail.com> References: <cover.1679355227.git.lstoakes@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3FC7E40016 X-Stat-Signature: zidcbks1ju16ficu9njfu337phuejybp X-HE-Tag: 1679355779-490064 X-HE-Meta: U2FsdGVkX1+hy3/NfvuvpT0GqCGkWLOx4lkJ+ZV1Cs/dKJen9KH8Sim86wN645YFXhfKPa4nADNoTKGRDVq5WCNS1H2fbDFt2fmX3wjeErvgQKpm4LTBj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y3ruhLMD1wo13VYgq5fF1a8W4k4Uuk4dNfEzpIwlxswnpBtzDYyau04sJVDColSy8T4JXwjVHeiaafwAPze1dLjugyIs5ftCa8F6Upk9vGh8RtVMeIwwPLkg+E2rPZgQDqAHodcL1WAbtC+dKK/yT389XfnSR+E1QfS0keJoPtLD9xEKN1spEJVivscGrB/oynB7kTlYzf1H6M9qdsQeuIL+3Q2hwguqxmpcx1DdVwyjDtGpValHIdjIPSzv0eDlas/vOy4dGOXyXi48QQKurtA/MpWiSmnKM= 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 |
[v3,1/4] fs/proc/kcore: avoid bounce buffer for ktext data
|
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: