From patchwork Fri Mar 9 14:01:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 883646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IVn8QpPo"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="EWHcBl6c"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyTbm3X92z9s7T for ; Sat, 10 Mar 2018 01:02:44 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2dmTGvCRRm6G7YQqDxrDcwPKlu0gyqrOdexIAZD4fjM=; b=IVn8QpPofaA5zUeyPe0CYR6JPE Sg1GslILkgMM5qvQ9V0IvsOVbMYVmdA3shxr+TarwRW/9I32r5MGzsJh64zQzacgOdZqV2S/6SvD1 OeJQGTPzt2i2NSXTH4j3bBnYIwOPnbEtrcL+TWh9yGjgADQziDXzHb6Fa0ztkM7w2CNKLWedZl2QE CykE2OJnhAF1Ikv5oULTYaJ7cCKpn+5HgPHlGQweciVk2avdlcEnRJ5lv6uaJ41drk9qDhT5dmnYB StSCZXurusy6VygzyO3Hya+DqSiopPzlU96LPW8T61dWWpcHiNAqpwJwL7lSwjr8a/OhzIbQWoenO Guu/Mu8Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euIbZ-0003Ci-F8; Fri, 09 Mar 2018 14:02:41 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbJ-0002yg-RR for linux-snps-arc@lists.infradead.org; Fri, 09 Mar 2018 14:02:35 +0000 Received: by mail-wm0-x243.google.com with SMTP id 139so4111813wmn.2 for ; Fri, 09 Mar 2018 06:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=nusSvdwVKoXv56ix0mPiQYHDeW7j7+Jt/1J6kOG9y34=; b=EWHcBl6cwmt/CuQZC/5vi4Nlv+EgEJHlwNpfKfKiUAu9mhKOJ/TTHUBfkyafVk9jIy +0HAN0bKLCpk4XQ7a2uY8HDFZW3yvRqnWMUL7nP/RH3Pr56WRPXbSI14/ATIVDz/9M/6 1KyFZi2M0A/d73HaOS2pdzlfrMGdh3WwANLOEFJdJzKsDFmFLY505oTMM66BfSVCY8SB RPo65OQ690ulVVvKjLwKCrkk603rYSm6d3m5Uxf1aJt0ChumVkYyPjLA0uRArPrd4MNw s5xpsoFr7q44VkaGjpip2xQH5wcc7ZJ/kzujizu0YoBWFQSdIjUWaQSjMqeW1fAZ6Jav b1wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=nusSvdwVKoXv56ix0mPiQYHDeW7j7+Jt/1J6kOG9y34=; b=sj/D4pbubmQxN4inO5hIS/Qdr5MQ4cgE7ZtIf9YlsVxIXhzG5CFp9A4eue+devCXU3 vS77d7KJrbJq0/siiDF59SUrSUl3XyQzYx6cLlFn/IowAiect4qCbsTdAuKokqeYw+gE 1p84rzsrGpytpTqpLp/oLaq7hT4IPDiILmY+qICkzvMVzj3KoAoFLFHSnqx2m3+hsZp1 X5i2WRYqQ5HT7XVKCF7vJPiGjiapETQS8zyL3tHofOwvhRc7FEvlm1WnQYBFSqp9qiAD 4a7Iw7APuwoJXyEOyWe4/TGx+cOupti2fPM/99NB3oBxeIyJLCHZa2pgB+vaBME2xDWf AMcQ== X-Gm-Message-State: AElRT7Go3AlmCz61szuV/GTqB0G+pOhkb7RWuWl9IoqnIc/DKkLfQbtV o2R5dunxEP4k6XteLXUgU3Ju1Q== X-Google-Smtp-Source: AG47ELuu/EP0wB2lJhFOhGVfTI1ExYcklSrgDTg5VHq0f2rhTPyhLPefeZ8IWvM721o76C8k9GTV8g== X-Received: by 10.28.139.19 with SMTP id n19mr2285284wmd.40.1520604133337; Fri, 09 Mar 2018 06:02:13 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f3sm994484wre.72.2018.03.09.06.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:02:12 -0800 (PST) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , "Aneesh Kumar K . V" , Minchan Kim , Michal Hocko , Shaohua Li , Andrea Arcangeli , Anshuman Khandual , Mike Rapoport , Vlastimil Babka , Naoya Horiguchi , Shakeel Butt , Joonsoo Kim , Hugh Dickins , Mel Gorman , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Mike Kravetz , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Mark Salter , Aurelien Jacquiot , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , James Hogan , Michal Simek , Ralf Baechle , David Howells , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou , Chen Liqin , Lennox Wu , Yoshinori Sato , Rich Felker , "David S . Miller" , Ingo Molnar , x86@kernel.org, Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, linux-mips@linux-mips.org, linux-am33-list@redhat.com, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: [RFC PATCH 1/6] arm64: add type casts to untagged_addr macro Date: Fri, 9 Mar 2018 15:01:59 +0100 Message-Id: X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_060226_038501_C70546C3 X-CRM114-Status: GOOD ( 14.02 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacob Bramley , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch makes the untagged_addr macro accept all kinds of address types (void *, unsigned long, etc.) and allows not to specify type casts in each place where it is used. This is done by using __typeof__. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index e66b0fca99c2..2d6451cbaa86 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -102,7 +102,8 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si * up with a tagged userland pointer. Clear the tag to get a sane pointer to * pass on to access_ok(), for instance. */ -#define untagged_addr(addr) sign_extend64(addr, 55) +#define untagged_addr(addr) \ + ((__typeof__(addr))sign_extend64((__u64)(addr), 55)) #define access_ok(type, addr, size) __range_ok(addr, size) #define user_addr_max get_fs From patchwork Fri Mar 9 14:02:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 883647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ijk5ADeK"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="aDu8Cfeu"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyTbm5z05z9scP for ; Sat, 10 Mar 2018 01:02:44 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=37z7DL944D3vp4hEngfAC4F+NCMqgHYODCpA7zIJgfc=; b=Ijk5ADeK8H6/uZH6zf4Gk8P187 6DFUsD+yVCAviFlLM/jUHvu8Kp4afrakYR7gWNxy8i7wtHsie3atED38zAxuU/mr+QJGY3bvBACm6 WNqw+cUI1K4K0A/ozSThCPlshzBaQRF6MHjDnD6z2lxj+6IaYAm3MinyzhBYkrA8zFUe/fcz9OJ1m 2Pe+eDiAhI1bo0h51Gmiy6l7yhCGh2M4nq0AMf5Kupnemuhmz/8LNqoejyhyUCvZOzN3Yu4Yz2aEp G+CUrUzNjwBeKjhm1GnLpQBVHvVGl29NJ3Jt8OJAyZQKPipVJatkNavJs/R2p5RIt/Qc1IWs/H1Mr /NaYT+0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euIbZ-0003D3-QU; Fri, 09 Mar 2018 14:02:41 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbJ-0002yq-RA for linux-snps-arc@lists.infradead.org; Fri, 09 Mar 2018 14:02:36 +0000 Received: by mail-wm0-x243.google.com with SMTP id x7so4099336wmc.0 for ; Fri, 09 Mar 2018 06:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=KVsaoUpOD8Si69HtIZnikRY9QoHsK3D77i4tLJbKAhI=; b=aDu8CfeuzLtLKDH52OwLqmGpnQaUScTxMTLiBM3bEoF8WgshpEdBd7fZaQPT7zNzJp ecqXwtqn/6EFriFM3yZPJ/IEwNnJuu2bjCVJxgcvp2gcSLMaXS+2pMZoIvOkWX/E2kyF vvTL9+MX3Y0MebANQRrIER7jazh2bMQ3RUXQafXUTF8HH00lQChy7DRYHpfdux+fHCHe XlFLdPGnUwgUki9f97BCHS18o4l2RHI/+SIFc71YLIZc8kheoN21oZT+apX8MYxucNmS DwSIKVpoRXZwkkvE5ED+ERmySlQOIYlOj+BE3UF/TE4C8JE1Mtm0Kj3wl8V9qpRkcOmH k9vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=KVsaoUpOD8Si69HtIZnikRY9QoHsK3D77i4tLJbKAhI=; b=jO+TZHXxxrVd+JzMVsziNiRkawEh30GjOfYpAS7OodzX3uKUPhexL2bqHbWu0yp6qT Bj6VgoxgrZ6fVr1dyWVQ8wII86lLl3PT1bEzQXSXxkdsOrGyO8+f96Xfmi6JyBmuWwfV o8A0cGk3dbH7ZYGSZ//d+bWlmraQSN0pfvWFyXPobxVXhHE+ViLqLKiqck84NLcRBrFM VJxMZOfcKeLpo4ZZPUzrPwSDklW18oOa+wGCaj5idjsilgQ1m9eCoXOQ0iLGu/tj4h8a z6exmjo32duEMkxHtu2UzgS67Uhlvn3NL7EIMBFjR5M9kgviTWUkZldYE392F/ucawwH 3a1g== X-Gm-Message-State: AElRT7G3qDVys1Qu18EpS3n5KlAAUvtpj7Ws31TU5prBeKk1BY2xgrma izfcq7qWFvcA4OL3m2w9/OIHdw== X-Google-Smtp-Source: AG47ELs2VGB0w/R+8AMN4YxVgPH/BwbGSNE+qDws91MY8GmIgNN/Kw09V1wCr4nFk/gnrhzyj8p//A== X-Received: by 10.28.234.197 with SMTP id g66mr2093174wmi.10.1520604135747; Fri, 09 Mar 2018 06:02:15 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f3sm994484wre.72.2018.03.09.06.02.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:02:15 -0800 (PST) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , "Aneesh Kumar K . V" , Minchan Kim , Michal Hocko , Shaohua Li , Andrea Arcangeli , Anshuman Khandual , Mike Rapoport , Vlastimil Babka , Naoya Horiguchi , Shakeel Butt , Joonsoo Kim , Hugh Dickins , Mel Gorman , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Mike Kravetz , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Mark Salter , Aurelien Jacquiot , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , James Hogan , Michal Simek , Ralf Baechle , David Howells , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou , Chen Liqin , Lennox Wu , Yoshinori Sato , Rich Felker , "David S . Miller" , Ingo Molnar , x86@kernel.org, Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, linux-mips@linux-mips.org, linux-am33-list@redhat.com, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: [RFC PATCH 2/6] arm64: untag user addresses in copy_from_user and others Date: Fri, 9 Mar 2018 15:02:00 +0100 Message-Id: X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_060226_072007_DAC5A260 X-CRM114-Status: GOOD ( 14.14 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacob Bramley , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org copy_from_user (and a few other similar functions) are used to copy data from user memory into the kernel memory or vice versa. Since a user can provided a tagged pointer to one of the syscalls that use copy_from_user, we need to correctly handle such pointers. Do this by untagging user pointers in access_ok and in __uaccess_mask_ptr. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index 2d6451cbaa86..24a221678fe3 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -105,7 +105,8 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si #define untagged_addr(addr) \ ((__typeof__(addr))sign_extend64((__u64)(addr), 55)) -#define access_ok(type, addr, size) __range_ok(addr, size) +#define access_ok(type, addr, size) \ + __range_ok(untagged_addr(addr), size) #define user_addr_max get_fs #define _ASM_EXTABLE(from, to) \ @@ -238,12 +239,15 @@ static inline void uaccess_enable_not_uao(void) /* * Sanitise a uaccess pointer such that it becomes NULL if above the * current addr_limit. + * Also untag user pointers that have the top byte tag set. */ #define uaccess_mask_ptr(ptr) (__typeof__(ptr))__uaccess_mask_ptr(ptr) static inline void __user *__uaccess_mask_ptr(const void __user *ptr) { void __user *safe_ptr; + ptr = untagged_addr(ptr); + asm volatile( " bics xzr, %1, %2\n" " csel %0, %1, xzr, eq\n" From patchwork Fri Mar 9 14:02:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 883645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C+uvCPyZ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="pFAdjRvP"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyTbl5LH0z9sWV for ; Sat, 10 Mar 2018 01:02:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=V5ODRqlY7Kgbs/7EiSY36o3UJm2E8R+2LkaFzzcr38Q=; b=C+uvCPyZK9pxzfov9q8EEZP/Kg nzb88cvUWXNq+pXYWsn0DwqJnDaNvlGjGNqW1VFp3MDrPCcxbQoedWy6epyQJWXx3ZR+zd4fkxiOk D8LexGqrkTSro9Aw6KgkqsV2ELwrFUxc56oKzGsMiAURJNM+0uWcXVVC+cRb1GuF2RLdT+Of0NdzM 8DrxY9wV6gql4AVf1gxkEeMQjq++YJeBVbpvMYVTvtHaH2QW2tRkyglagRtlAjIqPNfqtlmi8NTUe 6Jih31dqaDUNyvJ6NPN7SiiefH1Ok2lvKMwN3uXuqHU/HQVumXLsqUsqBZe7jyk+cOCewmFditq/e Tt9Y2NVg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euIbY-0003CQ-TH; Fri, 09 Mar 2018 14:02:40 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbJ-0002zb-MK for linux-snps-arc@lists.infradead.org; Fri, 09 Mar 2018 14:02:33 +0000 Received: by mail-wm0-x242.google.com with SMTP id e194so4083184wmd.3 for ; Fri, 09 Mar 2018 06:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=DpcZU3q2JkfB8kv1mdnR74RNzNyT/bkV2tCxTLB6/CU=; b=pFAdjRvPTdDBaMK+oKfvueELn1JR71cUCRIfQw/F2hoOKsy/q+Om6vz83nHbTqOMNo 25osMnr0Yst2HYixmN/ITDz0DRcYS5XTRq8qulFav8sM6i1JaNJ1ZXUbWV+dqupJlz4f nNAgB7P2EkoA4uI2ywl0qCpI1p1qUyGu2Pbs7XQNTykMV3D9yMjoBbTP48bwbtoZ8tQy eq3Av3NvURqw/XHWnfJT/mc+HFGvZcbeBPJVX370+ge5QaJCAxEwt3/pINcieeEKBfre RSMKbQ7HGI1RY2O9HMDFLLBZe8Ak6KRNBJnu3eZGAhpJBTYkT94+Tacj0uLjQNALyv0B ledA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=DpcZU3q2JkfB8kv1mdnR74RNzNyT/bkV2tCxTLB6/CU=; b=JRkJ/sgLcJwH+hdM7F10gBudEjZQdIz2PPZeuj9WP3+/NaleP+vq1rDSdJGfC1selk IAnhbYm45CPTuA7OLfrV+fsr/sjo9GjbaNFN8144DHMcgEz465IB0mM3Acc4Y2jqNjUe hPgCcpU76zMQCS0PoITB/4YpIuEOSIwPM6z/INS8y/2rFoaU6TnmLzxaR8EMe3r8J5ui t2Ku7UrIpv43VB994R3rZ+aB/TX2nmeOuvoWrMTnPFmnwpkWAgPh5c8eiudA7KlnbjgR laffXwa3zzWF4cXfmZV8iSpRSKGwOwyzyAbNgV3XIrIUx+/r6Xau/a/0+7Lv2MklxQuw u5qA== X-Gm-Message-State: AElRT7GPMaK0syG9nM0vKjrzgG9sXImTQgG/rxekKctjvq+XO4I/Iqfr cA2uN925aEXb8EXOBt6AalPplw== X-Google-Smtp-Source: AG47ELvJ2FcNzTKSCjm9NC56BYzVrFyEdkyNrQUb5AlMVrQjfQKHWOwJOjS19Kc8SLi/cJMcXLWazQ== X-Received: by 10.28.87.211 with SMTP id l202mr2009696wmb.32.1520604138739; Fri, 09 Mar 2018 06:02:18 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f3sm994484wre.72.2018.03.09.06.02.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:02:17 -0800 (PST) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , "Aneesh Kumar K . V" , Minchan Kim , Michal Hocko , Shaohua Li , Andrea Arcangeli , Anshuman Khandual , Mike Rapoport , Vlastimil Babka , Naoya Horiguchi , Shakeel Butt , Joonsoo Kim , Hugh Dickins , Mel Gorman , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Mike Kravetz , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Mark Salter , Aurelien Jacquiot , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , James Hogan , Michal Simek , Ralf Baechle , David Howells , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou , Chen Liqin , Lennox Wu , Yoshinori Sato , Rich Felker , "David S . Miller" , Ingo Molnar , x86@kernel.org, Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, linux-mips@linux-mips.org, linux-am33-list@redhat.com, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: [RFC PATCH 3/6] mm, arm64: untag user addresses in memory syscalls Date: Fri, 9 Mar 2018 15:02:01 +0100 Message-Id: X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_060225_817139_3D81D403 X-CRM114-Status: GOOD ( 15.46 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacob Bramley , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Memory subsystem syscalls accept user addresses as arguments, but don't use copy_from_user and other similar functions, so we need to handle this case separately. Untag user pointers passed to madvise, mbind, get_mempolicy, mincore, mlock, mlock2, brk, mmap_pgoff, old_mmap, munmap, remap_file_pages, mprotect, pkey_mprotect, mremap and msync. Signed-off-by: Andrey Konovalov --- mm/madvise.c | 2 ++ mm/mempolicy.c | 6 ++++++ mm/mincore.c | 2 ++ mm/mlock.c | 5 +++++ mm/mmap.c | 9 +++++++++ mm/mprotect.c | 2 ++ mm/mremap.c | 2 ++ mm/msync.c | 3 +++ 8 files changed, 31 insertions(+) diff --git a/mm/madvise.c b/mm/madvise.c index 4d3c922ea1a1..909d6ba09031 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -798,6 +798,8 @@ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior) size_t len; struct blk_plug plug; + start = untagged_addr(start); + if (!madvise_behavior_valid(behavior)) return error; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index d879f1d8a44a..79d33a570c60 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1344,6 +1344,8 @@ SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len, int err; unsigned short mode_flags; + start = untagged_addr(start); + mode_flags = mode & MPOL_MODE_FLAGS; mode &= ~MPOL_MODE_FLAGS; if (mode >= MPOL_MAX) @@ -1479,6 +1481,8 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, int uninitialized_var(pval); nodemask_t nodes; + addr = untagged_addr(addr); + if (nmask != NULL && maxnode < MAX_NUMNODES) return -EINVAL; @@ -1557,6 +1561,8 @@ COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len, unsigned long nr_bits, alloc_size; nodemask_t bm; + start = untagged_addr(start); + nr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES); alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8; diff --git a/mm/mincore.c b/mm/mincore.c index fc37afe226e6..b59cf8fa3050 100644 --- a/mm/mincore.c +++ b/mm/mincore.c @@ -228,6 +228,8 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len, unsigned long pages; unsigned char *tmp; + start = untagged_addr(start); + /* Check the start address: needs to be page-aligned.. */ if (start & ~PAGE_MASK) return -EINVAL; diff --git a/mm/mlock.c b/mm/mlock.c index 74e5a6547c3d..2f456a458cac 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -714,6 +714,7 @@ static __must_check int do_mlock(unsigned long start, size_t len, vm_flags_t fla SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len) { + start = untagged_addr(start); return do_mlock(start, len, VM_LOCKED); } @@ -721,6 +722,8 @@ SYSCALL_DEFINE3(mlock2, unsigned long, start, size_t, len, int, flags) { vm_flags_t vm_flags = VM_LOCKED; + start = untagged_addr(start); + if (flags & ~MLOCK_ONFAULT) return -EINVAL; @@ -734,6 +737,8 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) { int ret; + start = untagged_addr(start); + len = PAGE_ALIGN(len + (offset_in_page(start))); start &= PAGE_MASK; diff --git a/mm/mmap.c b/mm/mmap.c index 9efdc021ad22..b63362c45cde 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -189,6 +189,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) bool populate; LIST_HEAD(uf); + brk = untagged_addr(brk); + if (down_write_killable(&mm->mmap_sem)) return -EINTR; @@ -1495,6 +1497,8 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, struct file *file = NULL; unsigned long retval; + addr = untagged_addr(addr); + if (!(flags & MAP_ANONYMOUS)) { audit_mmap_fd(fd, flags); file = fget(fd); @@ -1556,6 +1560,8 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) if (offset_in_page(a.offset)) return -EINVAL; + a.addr = untagged_addr(a.addr); + return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); } @@ -2751,6 +2757,7 @@ EXPORT_SYMBOL(vm_munmap); SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) { + addr = untagged_addr(addr); profile_munmap(addr); return vm_munmap(addr, len); } @@ -2769,6 +2776,8 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, unsigned long ret = -EINVAL; struct file *file; + start = untagged_addr(start); + pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.\n", current->comm, current->pid); diff --git a/mm/mprotect.c b/mm/mprotect.c index e3309fcf586b..73d2a6befcf9 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -519,6 +519,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len, SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, unsigned long, prot) { + start = untagged_addr(start); return do_mprotect_pkey(start, len, prot, -1); } @@ -527,6 +528,7 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, SYSCALL_DEFINE4(pkey_mprotect, unsigned long, start, size_t, len, unsigned long, prot, int, pkey) { + start = untagged_addr(start); return do_mprotect_pkey(start, len, prot, pkey); } diff --git a/mm/mremap.c b/mm/mremap.c index 049470aa1e3e..e42863a135de 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -533,6 +533,8 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, LIST_HEAD(uf_unmap_early); LIST_HEAD(uf_unmap); + addr = untagged_addr(addr); + if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE)) return ret; diff --git a/mm/msync.c b/mm/msync.c index ef30a429623a..03a977558f9f 100644 --- a/mm/msync.c +++ b/mm/msync.c @@ -37,12 +37,15 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) int unmapped_error = 0; int error = -EINVAL; + start = untagged_addr(start); + if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC)) goto out; if (offset_in_page(start)) goto out; if ((flags & MS_ASYNC) && (flags & MS_SYNC)) goto out; + error = -ENOMEM; len = (len + ~PAGE_MASK) & PAGE_MASK; end = start + len; From patchwork Fri Mar 9 14:02:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 883644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u2qusyF6"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="KlhatkzH"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyTbf1BNKz9s7T for ; Sat, 10 Mar 2018 01:02:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=q3wQlXCEPydTZAjaFgnArX0d2ob9XEAbSr4Iqh4Wiq8=; b=u2qusyF6jaeinH4lTdCIwGhYjr zl78gpJNo0dgtRxoCqeyLwP0ZsshOHP/swNOZnMAQSvpjbEXGe5J0i6e9KeUfLPsq3K86PUbEOOf3 LJRgcImSYVigqF92xwGbW8WnvqWijGW+Nx2oaGYN69XIJDRMpRopCOgJzT90g/fiQKVouPxH2Rp0C SIRRadbEwsSqx8a9h43Z/8RN4bon2DZwIsLSs2317FemnjsWnrJKTE4M9qjLhiCz6wLTOhXArWUp5 9UYlQ6RarhZZj2ds6KbAUM3W8glmFf9oNznGrZ89YPc3OxrHtjevmDrZsUXpVs5bSGOEOcYTCiN5Y w3ZkcsJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euIbT-00037o-DU; Fri, 09 Mar 2018 14:02:35 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbJ-00030K-MS for linux-snps-arc@lists.infradead.org; Fri, 09 Mar 2018 14:02:32 +0000 Received: by mail-wm0-x242.google.com with SMTP id x7so4099800wmc.0 for ; Fri, 09 Mar 2018 06:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=bFC+dOL1kofLW/Fz0q3F9Mambpm3ECJQAGpTBpsRBqY=; b=KlhatkzHSpgVRHDvB7Xo8ArpzJdEHpIrp8YwbhdYo36/+atn/MwbTUVLka2ecwucpk zBkNsc/ZMMJC76qRsNG3L0OoPeCXCuFE7Kwg/k6sQTOci9s0Te+5aqQGcaddiMIp8+48 cotuP8JIMQkN1iOw5U/gZASe/hLxJgyCR6kF8N6NJqAioxDCKZAMC5XrY+pSXPTrP1hG ymOU5dlpgdVaUvbvPpc5rS+PJ/C75VxYJYfyyyQFf8mKnfu4cQY9WZaCPo5Cs73J1Qcw jX3tqNstWDM+vhRI5hDVJ//BT12ne/5yFiHKvWzTjTCQMbeyPVZJVe1wN4cmr/5fq4d4 o+nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=bFC+dOL1kofLW/Fz0q3F9Mambpm3ECJQAGpTBpsRBqY=; b=GGVEmEUXTrse9DyV37ri6dxA4LzYiWpU/HJkfrorPN/fSLb1qMxA1NKOk/STiDHCL6 nOGAgNw8jDPZExKbbfrpR9l4HPsPjsRrsNAeGEUIXqLXCGwhYHlX/4NgikmRy4HLirE0 I8HoNyNdRHrQlXCGab5DPMPtccINKN6134jFahIs3HxSvHfNMTWxcE00Tily2mj/qEQZ pgffJHV7SEhGZVpp/x6qoGCDebsA5f4txF/iNcoKwJAc7k9wAzkavJgh8NdeOFBNVlOY QtbgJlraZGvkNCOkcEjL1RvXSO2UOTgB3HXgNTkCcsqdRMSEc7TlW8hMLBnpdni6sKas HppQ== X-Gm-Message-State: AElRT7HmrxWN051zlfZ11doSrC0FPw+PpH/C+ctaytwzfLdgBnEJo9aP xUcXcoTCUvmU/nLbwxGURJ+cfg== X-Google-Smtp-Source: AG47ELur63iUzTcj/SxULK7/n9/IiOYomFoFueFSfoU9XvqGgqC5/NqRiMXXZBMSOAU5srV8yEvX2w== X-Received: by 10.28.230.68 with SMTP id d65mr2300974wmh.13.1520604141250; Fri, 09 Mar 2018 06:02:21 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f3sm994484wre.72.2018.03.09.06.02.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:02:20 -0800 (PST) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , "Aneesh Kumar K . V" , Minchan Kim , Michal Hocko , Shaohua Li , Andrea Arcangeli , Anshuman Khandual , Mike Rapoport , Vlastimil Babka , Naoya Horiguchi , Shakeel Butt , Joonsoo Kim , Hugh Dickins , Mel Gorman , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Mike Kravetz , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Mark Salter , Aurelien Jacquiot , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , James Hogan , Michal Simek , Ralf Baechle , David Howells , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou , Chen Liqin , Lennox Wu , Yoshinori Sato , Rich Felker , "David S . Miller" , Ingo Molnar , x86@kernel.org, Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, linux-mips@linux-mips.org, linux-am33-list@redhat.com, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: [RFC PATCH 4/6] mm, arm64: untag user addresses in mm/gup.c Date: Fri, 9 Mar 2018 15:02:02 +0100 Message-Id: X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_060225_812756_C3400D34 X-CRM114-Status: GOOD ( 15.28 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacob Bramley , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org mm/gup.c provides a kernel interface that accepts user addresses and manipulates user pages directly (for example get_user_pages, that is used by the futex syscall). Here we also need to handle the case of tagged user pointers. Untag addresses passed to this interface. Signed-off-by: Andrey Konovalov --- mm/gup.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 1b46e6e74881..4d820c4792d7 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -386,6 +386,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma, struct page *page; struct mm_struct *mm = vma->vm_mm; + address = untagged_addr(address); + *page_mask = 0; /* make this handle hugepd */ @@ -647,6 +649,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, if (!nr_pages) return 0; + start = untagged_addr(start); + VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET)); /* @@ -801,6 +805,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; int ret, major = 0; + address = untagged_addr(address); + if (unlocked) fault_flags |= FAULT_FLAG_ALLOW_RETRY; @@ -854,6 +860,8 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk, long ret, pages_done; bool lock_dropped; + start = untagged_addr(start); + if (locked) { /* if VM_FAULT_RETRY can be returned, vmas become invalid */ BUG_ON(vmas); @@ -1746,6 +1754,8 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, unsigned long flags; int nr = 0; + start = untagged_addr(start); + start &= PAGE_MASK; addr = start; len = (unsigned long) nr_pages << PAGE_SHIFT; @@ -1798,6 +1808,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, unsigned long addr, len, end; int nr = 0, ret = 0; + start = untagged_addr(start); + start &= PAGE_MASK; addr = start; len = (unsigned long) nr_pages << PAGE_SHIFT; From patchwork Fri Mar 9 14:02:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 883648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CQSk7agV"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="BmeAclrR"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="n28I0cW2"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyTby509kz9scN for ; Sat, 10 Mar 2018 01:02:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ae8b05VuTPV6WzqtW28T2GDV4U1PYEXdUs5EgwjsqYI=; b=CQSk7agVal1UsiJeuSynjlt8xG BsRDdMRP86AypxPIoGdfYU2pBNPk2qIzc/NvUsiEivXZqI+l9D6y5K5oi8rRuICHF75poA7WGdu0A sNBXUAQHz6FA7/nF0O+XKAfyxfiiDvDI6/fuE0P8vU+VBx6rNUMqMOYHtqSt9FXAqa0ba1PO1axSk 1v4diknElDgKHmz0MpQGmkNFqxfa2xr7JMqT1i41mIOx1ryPd335jBan4zSADyGR3aNY1Pb38WmXH 7mk5xDtwgT3gPt5rll8MFv4mNAOYf7cZPPFDyYVDz18vCfFlBFypGHU4zFMbChUhD4LATa+Twtl74 SviD9vtw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euIbj-0003KO-2J; Fri, 09 Mar 2018 14:02:51 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbf-0003Fn-13 for linux-snps-arc@bombadil.infradead.org; Fri, 09 Mar 2018 14:02:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2cZZ6id+x0/wo2ATzm8/IeoYF4xqs5KCdHuahlIxLDo=; b=BmeAclrRUV+DVfvfq5W2HlD8B /bM27s1dG1HMikQycjrFmY7Z0m15XJKXLh03jHEonc22Sa4ml/fQScdNGrG9tS51fxkrvlRIrP3eV xH/s86vLlLJ6vWdYfePbmXPeYIUHZRLie2Pnch/X5Kt4EpYIf0ylt2zPqnE2pf9wDGYLmfqiYS+yp F5jZPGxw/02hbOgLuj67OXTGRwvbTZyr4AuC2GkunxTHK9hc+6aL9hWV5TbgWogPcuqcXnOjtS9Y9 /h3IgAIww31nYUoDOWDtn7AbnVvVo9B461IxOJ8bDyAtbgt8FiORP3r+EMJM5KJXEzpuVYWsKf2xE ssby82s8A==; Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbc-0005J9-8F for linux-snps-arc@lists.infradead.org; Fri, 09 Mar 2018 14:02:44 +0000 Received: by mail-wr0-x244.google.com with SMTP id a63so5511670wrc.10 for ; Fri, 09 Mar 2018 06:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=2cZZ6id+x0/wo2ATzm8/IeoYF4xqs5KCdHuahlIxLDo=; b=n28I0cW2tGIoBIYvHm1SI0XfLgASTd/j+fKufWMhstDQ4Pj7hb6Lp0fKgCIbDNz3br he5XQCd6p9rwPaNTHo4o0Uz+ZcfYVfLFeFwBCFXdC5L/tRjmIC5P7Q/4Cv/qXdIwUc3c KqhKMf/N2RQst7CjSS1svXucH30lNXhNRKyN7+lVhhj3MBjAAWTwfnwTx15mYXnezjsm WZaNzGRqzMTvuewgTuegpJiv5D3QqmaX4WuhSuanxMSU0ZCbsfuf/GgyOPG2o+waXiW7 vKQX1NqjKZfrh1VJD8E5dt0c18OFe3Po9kTmTYxPm1uq5u22ld+8CzuBdiRVepaWhudU FNiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=2cZZ6id+x0/wo2ATzm8/IeoYF4xqs5KCdHuahlIxLDo=; b=lUzZAgKMJi4wIBfEnFLRY7eT9Mirf7kkS4PLsoDi+o/TZ6eTW17CO36D/RFpPlTNsU cp9j9jeXjy9X8mbUd3xYupO5x4tbZjOQnUWBCbPrkj3MpF6VmUQ1F6W3In5j4VBX63zG 4eTqcHCocmFBIJrgdqpDNZOtM+dBGarinQIojK1Cms5/NpypHRT3lfHD0YcqFkDZNpyr jFqZUbijAMgvYXK3+xEg436tjPdYdCFkLAuViriU7q6k4jDIEuCar7BbTG2HaliahkQ7 KFFBpPcyj9/HNFzxJoKaVtUzfCVDYsYRoeWJp6WNMusnWZ7kdT9G7N5cajS423PYCiyj ouBA== X-Gm-Message-State: APf1xPDQxzwE3YmAcY6+k78szjKOUIE19mKJwjYDeL0ommpaiLUBmvGn Y4DyVAPyCbn2+3RQ8uAza2tdBw== X-Google-Smtp-Source: AG47ELvbn6srqv+rO92C9ogiihmsYkHDHVrSlz9idaCoHMrpLnomGUssQTnZ+zDlRwUeFPhJ0hlfTQ== X-Received: by 10.223.191.10 with SMTP id p10mr27628264wrh.160.1520604143784; Fri, 09 Mar 2018 06:02:23 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f3sm994484wre.72.2018.03.09.06.02.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:02:23 -0800 (PST) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , "Aneesh Kumar K . V" , Minchan Kim , Michal Hocko , Shaohua Li , Andrea Arcangeli , Anshuman Khandual , Mike Rapoport , Vlastimil Babka , Naoya Horiguchi , Shakeel Butt , Joonsoo Kim , Hugh Dickins , Mel Gorman , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Mike Kravetz , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Mark Salter , Aurelien Jacquiot , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , James Hogan , Michal Simek , Ralf Baechle , David Howells , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou , Chen Liqin , Lennox Wu , Yoshinori Sato , Rich Felker , "David S . Miller" , Ingo Molnar , x86@kernel.org, Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, linux-mips@linux-mips.org, linux-am33-list@redhat.com, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: [RFC PATCH 5/6] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user Date: Fri, 9 Mar 2018 15:02:03 +0100 Message-Id: X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_090244_305661_71F8EA3D X-CRM114-Status: GOOD ( 14.13 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:244 listed in] [list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacob Bramley , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to separately handle the case of tagged user addresses as well. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov --- lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index b53e1b5d80f4..97467cd2bc59 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -106,6 +106,8 @@ long strncpy_from_user(char *dst, const char __user *src, long count) if (unlikely(count <= 0)) return 0; + src = untagged_addr(src); + max_addr = user_addr_max(); src_addr = (unsigned long)src; if (likely(src_addr < max_addr)) { diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 60d0bbda8f5e..8b5f56466e00 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -108,6 +108,8 @@ long strnlen_user(const char __user *str, long count) if (unlikely(count <= 0)) return 0; + str = untagged_addr(str); + max_addr = user_addr_max(); src_addr = (unsigned long)str; if (likely(src_addr < max_addr)) { From patchwork Fri Mar 9 14:02:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 883649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YEicy9xh"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="DqHv7GBb"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyTcb6L2Wz9s7T for ; Sat, 10 Mar 2018 01:03:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=AINLD9ak6UXlfxaxxjmVWLfGIAnTFT8C7lp7Q4UMz0g=; b=YEicy9xhsn2y60NKRp+riH6XqO senp/9YZ90wLzO35Id8HYQfBXefNa+MzDI4oi/NM37+FV078jvWdj2LB9/LwIxsIH6MZP2lSKbCer A3stiKEsKjr49TerQXkPRSuKKdqs9UKLVsFnDajbw8g8MpxasY3XRg9B1pxttIPK+CX0d3HT4KEqF ZOTc7ewf9Kg0ZVW4ltyh4ZdwUY+VH/OkQDuttQaTU/ikv5j1wFhyFNkKczmyMYH1hH7ikU9dZfYao P4CqKX/A4Knp5ZCcr6uhtBYQmqQjnxZJrnwz2dGFOisfoWUt2vJbMMzRF1QyHWJqWV9ZmO8DFivLN 1WeeNsDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euIcE-0003h6-1O; Fri, 09 Mar 2018 14:03:22 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euIbW-000345-Fb for linux-snps-arc@lists.infradead.org; Fri, 09 Mar 2018 14:02:51 +0000 Received: by mail-wm0-x242.google.com with SMTP id e194so4083945wmd.3 for ; Fri, 09 Mar 2018 06:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=/cbJQ+NWPI9BzNKv1/SE0Xitu2t5NTFP5+jGv8z8aIA=; b=DqHv7GBbfk/Q9DsWYyitRGv+gqtnjeibvGPA3Ryj/pK7VXLRWiTlDw6ibqSkaIpyfy pHB7doqH8NtkA0vKDX6OwKCBYXZd7ypp0f9ubiuWnA4gN7lRM4aOdXI0vIMNBHJMOkms v22tslINsDtwpjmKBEsU1Vl3U7PsTPx1s72n8EXLfT0fr54vTUWYwSy1CvgveFKow0Kp AaYNdExOfgCHG4usgULE8scJfwWFuhIoJGbTAV8lB9+iNCepiCJeMoRXrB+yc213KKga QCuiZqxcIsqMEtN5htTjU1cKLmPExumJoucGgWfkC64rJ5g5xL2fCU5WblwYD0blIFnU BBPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=/cbJQ+NWPI9BzNKv1/SE0Xitu2t5NTFP5+jGv8z8aIA=; b=FBbbGKfQnaGVZLFegKs1greMvz6KZAGFyPyFMES0678m6F/Cl30f8aVBqhOYs16jIO vM+21Mcg4Gew7PtEftQrJW4MuT//jVqMHx89g3iUC1kzmaEO4XKOnr858Wx8QU7KuTz0 2Zx2obm/yxwIaQACZ5XkCZnihqntQnN/AFNT2SamVU3hFoDlsGZWUqqBBZGJ3gjHBeMe cu7CZvUt/VUVyyUTFNV8G2L1sgWCB55jFZmX71xHyU62LHazuiQblUn4PCNmETHweoWD zrq6fLWqI3FtLPMBVkX1pnubCwLOBDHZyQ832giGNcDbTbCUMumZH9G0tn+IrukK3xE7 +IgQ== X-Gm-Message-State: AElRT7EeupBM2cHWW5skKaEI9PRGOfKhK2FXVYRUp1q1VJGtzsva4dA8 5tPVuVnKz4uv2s9ok/r6loDsZg== X-Google-Smtp-Source: AG47ELtA8uiStoJZjd7f9SwfJ8dDjMT+thT2L+pJar2gGlcs9LTTHgRfVoxT12jRdiVBe2AOjtPW8Q== X-Received: by 10.28.71.204 with SMTP id m73mr2060812wmi.111.1520604146305; Fri, 09 Mar 2018 06:02:26 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f3sm994484wre.72.2018.03.09.06.02.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:02:25 -0800 (PST) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , "Aneesh Kumar K . V" , Minchan Kim , Michal Hocko , Shaohua Li , Andrea Arcangeli , Anshuman Khandual , Mike Rapoport , Vlastimil Babka , Naoya Horiguchi , Shakeel Butt , Joonsoo Kim , Hugh Dickins , Mel Gorman , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Mike Kravetz , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Mark Salter , Aurelien Jacquiot , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , James Hogan , Michal Simek , Ralf Baechle , David Howells , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou , Chen Liqin , Lennox Wu , Yoshinori Sato , Rich Felker , "David S . Miller" , Ingo Molnar , x86@kernel.org, Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, linux-mips@linux-mips.org, linux-am33-list@redhat.com, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: [RFC PATCH 6/6] arch: add untagged_addr definition for other arches Date: Fri, 9 Mar 2018 15:02:04 +0100 Message-Id: <89b4bb181a0622d2c581699bb3814fc041078d04.1520600533.git.andreyknvl@google.com> X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_060239_042059_CA57E213 X-CRM114-Status: GOOD ( 15.04 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacob Bramley , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org To allow arm64 syscalls accept tagged pointers from userspace, we must untag them when they are passed to the kernel. Since untagging is done in generic parts of the kernel (like the mm subsystem), the untagged_addr macro should be defined for all architectures. Define it as a noop for all other architectures besides arm64. Signed-off-by: Andrey Konovalov --- arch/alpha/include/asm/uaccess.h | 2 ++ arch/arc/include/asm/uaccess.h | 1 + arch/arm/include/asm/uaccess.h | 2 ++ arch/blackfin/include/asm/uaccess.h | 2 ++ arch/c6x/include/asm/uaccess.h | 2 ++ arch/cris/include/asm/uaccess.h | 2 ++ arch/frv/include/asm/uaccess.h | 2 ++ arch/ia64/include/asm/uaccess.h | 2 ++ arch/m32r/include/asm/uaccess.h | 2 ++ arch/m68k/include/asm/uaccess.h | 2 ++ arch/metag/include/asm/uaccess.h | 2 ++ arch/microblaze/include/asm/uaccess.h | 2 ++ arch/mips/include/asm/uaccess.h | 2 ++ arch/mn10300/include/asm/uaccess.h | 2 ++ arch/nios2/include/asm/uaccess.h | 2 ++ arch/openrisc/include/asm/uaccess.h | 2 ++ arch/parisc/include/asm/uaccess.h | 2 ++ arch/powerpc/include/asm/uaccess.h | 2 ++ arch/riscv/include/asm/uaccess.h | 2 ++ arch/score/include/asm/uaccess.h | 2 ++ arch/sh/include/asm/uaccess.h | 2 ++ arch/sparc/include/asm/uaccess.h | 2 ++ arch/tile/include/asm/uaccess.h | 2 ++ arch/x86/include/asm/uaccess.h | 2 ++ arch/xtensa/include/asm/uaccess.h | 2 ++ include/asm-generic/uaccess.h | 2 ++ 26 files changed, 51 insertions(+) diff --git a/arch/alpha/include/asm/uaccess.h b/arch/alpha/include/asm/uaccess.h index 87d8c4f0307d..09d136bb4ff5 100644 --- a/arch/alpha/include/asm/uaccess.h +++ b/arch/alpha/include/asm/uaccess.h @@ -2,6 +2,8 @@ #ifndef __ALPHA_UACCESS_H #define __ALPHA_UACCESS_H +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index c9173c02081c..2a04b7a4aada 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h @@ -26,6 +26,7 @@ #include /* for generic string functions */ +#define untagged_addr(addr) addr #define __kernel_ok (uaccess_kernel()) diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 0bf2347495f1..7d4f4e4021f2 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -19,6 +19,8 @@ #include +#define untagged_addr(addr) addr + /* * These two functions allow hooking accesses to userspace to increase * system integrity by ensuring that the kernel can not inadvertantly diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h index 45da4bcb050e..fb6bdc54e7bd 100644 --- a/arch/blackfin/include/asm/uaccess.h +++ b/arch/blackfin/include/asm/uaccess.h @@ -18,6 +18,8 @@ #include #include +#define untagged_addr(addr) addr + #define get_ds() (KERNEL_DS) #define get_fs() (current_thread_info()->addr_limit) diff --git a/arch/c6x/include/asm/uaccess.h b/arch/c6x/include/asm/uaccess.h index ba6756879f00..f187696cf440 100644 --- a/arch/c6x/include/asm/uaccess.h +++ b/arch/c6x/include/asm/uaccess.h @@ -9,6 +9,8 @@ #ifndef _ASM_C6X_UACCESS_H #define _ASM_C6X_UACCESS_H +#define untagged_addr(addr) addr + #include #include #include diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h index 3b42ab0cae93..86d8fbd200c4 100644 --- a/arch/cris/include/asm/uaccess.h +++ b/arch/cris/include/asm/uaccess.h @@ -19,6 +19,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h index ff9562dc6825..be21b42bde09 100644 --- a/arch/frv/include/asm/uaccess.h +++ b/arch/frv/include/asm/uaccess.h @@ -12,6 +12,8 @@ #ifndef _ASM_UACCESS_H #define _ASM_UACCESS_H +#define untagged_addr(addr) addr + /* * User space memory access functions */ diff --git a/arch/ia64/include/asm/uaccess.h b/arch/ia64/include/asm/uaccess.h index a74524f2d625..1c46bf1c4f73 100644 --- a/arch/ia64/include/asm/uaccess.h +++ b/arch/ia64/include/asm/uaccess.h @@ -42,6 +42,8 @@ #include #include +#define untagged_addr(addr) addr + /* * For historical reasons, the following macros are grossly misnamed: */ diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h index 9d89bc3d8181..6e0fe6b215be 100644 --- a/arch/m32r/include/asm/uaccess.h +++ b/arch/m32r/include/asm/uaccess.h @@ -16,6 +16,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/m68k/include/asm/uaccess.h b/arch/m68k/include/asm/uaccess.h index e896466a41a4..02e0c5878ad5 100644 --- a/arch/m68k/include/asm/uaccess.h +++ b/arch/m68k/include/asm/uaccess.h @@ -5,3 +5,5 @@ #include #endif #include + +#define untagged_addr(addr) addr diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h index a5311eb36e32..1b2f0478868a 100644 --- a/arch/metag/include/asm/uaccess.h +++ b/arch/metag/include/asm/uaccess.h @@ -14,6 +14,8 @@ * For historical reasons, these macros are grossly misnamed. */ +#define untagged_addr(addr) addr + #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 81f16aadbf9e..a66bc26660c3 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h @@ -20,6 +20,8 @@ #include #include +#define untagged_addr(addr) addr + /* * On Microblaze the fs value is actually the top of the corresponding * address space. diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index b71306947290..2db7606c388b 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h @@ -16,6 +16,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 5af468fd1359..6604699b34b6 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h @@ -17,6 +17,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h index dfa3c7cb30b4..36152a7302a8 100644 --- a/arch/nios2/include/asm/uaccess.h +++ b/arch/nios2/include/asm/uaccess.h @@ -19,6 +19,8 @@ #include +#define untagged_addr(addr) addr + /* * Segment stuff */ diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index bbf5c79cce7a..5b43d13ab363 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h @@ -27,6 +27,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index ea70e36ce6af..b0f3cd529c8d 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -11,6 +11,8 @@ #include #include +#define untagged_addr(addr) addr + #define KERNEL_DS ((mm_segment_t){0}) #define USER_DS ((mm_segment_t){1}) diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 51bfeb8777f0..07ae1c318166 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -8,6 +8,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h index 14b0b22fb578..e774239aac24 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -25,6 +25,8 @@ #include #include +#define untagged_addr(addr) addr + #define __enable_user_access() \ __asm__ __volatile__ ("csrs sstatus, %0" : : "r" (SR_SUM) : "memory") #define __disable_user_access() \ diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h index a233f3236846..fd16c2a71091 100644 --- a/arch/score/include/asm/uaccess.h +++ b/arch/score/include/asm/uaccess.h @@ -5,6 +5,8 @@ #include #include +#define untagged_addr(addr) addr + #define get_ds() (KERNEL_DS) #define get_fs() (current_thread_info()->addr_limit) #define segment_eq(a, b) ((a).seg == (b).seg) diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 32eb56e00c11..31f3ea075190 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h @@ -5,6 +5,8 @@ #include #include +#define untagged_addr(addr) addr + #define __addr_ok(addr) \ ((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg) diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h index dd85bc2c2cad..70c2f5ea09ce 100644 --- a/arch/sparc/include/asm/uaccess.h +++ b/arch/sparc/include/asm/uaccess.h @@ -7,6 +7,8 @@ #include #endif +#define untagged_addr(addr) addr + #define user_addr_max() \ (uaccess_kernel() ? ~0UL : TASK_SIZE) diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h index cb4fbe7e4f88..7d365b087dcb 100644 --- a/arch/tile/include/asm/uaccess.h +++ b/arch/tile/include/asm/uaccess.h @@ -22,6 +22,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index aae77eb8491c..3c233fbdd32b 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -12,6 +12,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h index f1158b4c629c..130e419c4d6e 100644 --- a/arch/xtensa/include/asm/uaccess.h +++ b/arch/xtensa/include/asm/uaccess.h @@ -20,6 +20,8 @@ #include #include +#define untagged_addr(addr) addr + /* * The fs value determines whether argument validity checking should * be performed or not. If get_fs() == USER_DS, checking is diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index 6b2e63df2739..2c46d2253dba 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -35,6 +35,8 @@ static inline void set_fs(mm_segment_t fs) #define segment_eq(a, b) ((a).seg == (b).seg) #endif +#define untagged_addr(addr) addr + #define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size)) /*