From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 4F098C43334 for ; Thu, 16 Jun 2022 14:51:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9EF6F6B0071; Thu, 16 Jun 2022 10:51:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99F7E6B0072; Thu, 16 Jun 2022 10:51:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8681C6B0074; Thu, 16 Jun 2022 10:51:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 76A916B0071 for ; Thu, 16 Jun 2022 10:51:18 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 42A1372E for ; Thu, 16 Jun 2022 14:51:18 +0000 (UTC) X-FDA: 79584387036.17.4CEA909 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf04.hostedemail.com (Postfix) with ESMTP id B924E40025 for ; Thu, 16 Jun 2022 14:51:17 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EFA5A61D9B; Thu, 16 Jun 2022 14:51:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2779DC341C5; Thu, 16 Jun 2022 14:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1655391073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ps2YC2wCwycvBi10ctMxDm81xYyrKyFftv5PAXfyRM=; b=PkGsblFifbNC4pQDmVpsVWLuHGpuZK31ARFnApYM49FnnXRVq9LhfwtjV2KELKgjZ0HAy3 M9mMzbYDNJJArBQb2UHqq4q6PIdPu0t+uiW0GfO5dHvZdp/bYb1iEoOh2+tK9dNrLrope/ YBW28VC6mFClNsSvLLZ6x/d/E6ZTDF4= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id c527be78 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 16 Jun 2022 14:51:12 +0000 (UTC) Date: Thu, 16 Jun 2022 16:51:08 +0200 From: "Jason A. Donenfeld" To: Matthew Wilcox Cc: linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Uladzislau Rezki , Kees Cook , Greg Kroah-Hartman , Linus Torvalds , Joe Perches Subject: Re: [PATCH] usercopy: use unsigned long instead of uintptr_t Message-ID: References: <20220616143617.449094-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655391078; a=rsa-sha256; cv=none; b=o0MXST0te47Ip+8ozX+KR/2AjIie7Z01b1P5asFl4F7lYlrX6g0/w4cw6rKIYvsVt1a1Rr i4AFxMFgHezP0ZUNPuAdUF48RvWcRWjpekuqzauvoFV5p5LmtqVRkMDXi8vn1G5hjgQpJz 16jw9Wj63mVapVcKA3fa9A2s0Mq5zCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655391078; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/Ps2YC2wCwycvBi10ctMxDm81xYyrKyFftv5PAXfyRM=; b=xDLhxUcez3ypAF5L98mAA90y/pkIghVnj4Qr+Spn0a06ZzNxVGHMJZX9L4cwX1e2rU3nha Ih66SwGICazFKbMmT7Cib3lcbgfCgNePkTFJf9sZ34vXuStJAeAr3G9+YkOmGonlEcc93g 36cAujk4PWB8t/9+VH260naYwC2IrOw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=PkGsblFi; dmarc=pass (policy=none) header.from=zx2c4.com; spf=pass (imf04.hostedemail.com: domain of "SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=PkGsblFi; dmarc=pass (policy=none) header.from=zx2c4.com; spf=pass (imf04.hostedemail.com: domain of "SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B924E40025 X-Stat-Signature: ta3uaedaghyuzpb78kpygp7cmzt69ihs X-HE-Tag: 1655391077-584605 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: Hi Matthew, On Thu, Jun 16, 2022 at 03:38:02PM +0100, Matthew Wilcox wrote: > On Thu, Jun 16, 2022 at 04:36:17PM +0200, Jason A. Donenfeld wrote: > > A recent commit factored out a series of annoying (unsigned long) casts > > into a single variable declaration, but made the pointer type a > > `uintptr_t` rather than the usual `unsigned long`. This patch changes it > > to be the integer type more typically used by the kernel to represent > > addresses. > > No. I did this on purpose. uintptr_t is the correct type to represent > a pointer that's being used as an integer. This dinosaur approach of > using unsigned long has to stop. For better or for worse, I've always assumed that the kernel had its reasons -- legitimate reasons, even -- for preferring `unsigned long` to a userspace type like `uintptr_t`, so I've always tried to code that way. If that's a "dinosaur approach" that "has to stop", it'd certainly be news to me (and I'm guessing others on the list too). I've never really seen anybody question the kernel's `unsigned long` usage before. So hopefully some outcome of this discussion will make it clear, and then either this patch will go in, or I'll get to work on carefully adjusting my code that uses `unsigned long` at the moment. Jason