From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1522169867; cv=none; d=google.com; s=arc-20160816; b=m7jFOzha2lrJ1KjKLN1Qw0JTvtpKltpqvsxiGt0cxDMp4VyBV/sVAV5OvYmVktjFKa HYCmyuvh8QbMzFWBvSGp1wlm9RcAT4sqNhK6VX2Sf59em3dqwX++UdIo/3b8vpdZGfMY mo6B4xDt6tAe5aSeYvOIDaOch8sO9l45lQu4UknpH3QBJn/jZNMQ8UWeBtHSBozRhamI 3Y41roEP7X9N79w9CX3rChdnLZL57GRJROlM1V0zLVtE6nQYdJPkO8al6sc6eJSO4gJ/ wfpugYC+4/UaOeJ2F/s886DIdpcCVC+LFu6THqWjINXsqcj69jVTcv2eksIHSuZxNWlj 6CLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=2unNROHG+8feIGotHXszhTuGPmpRY6bXBkim4UFPTaQ=; b=lkaF2cF5YsViKAD2P3WrJSQV11FU3alLFRu2oKDXWD+awaTxDlQRGj8s1m47TB3EOO xwoOEIRsqyQsCjrV+Tz4eP3CGNAtbg2xn+HsdpRP9GW9VLo8fh2lzwSU8Ggnx1FaKmHh dDxJXdTRLTmvV8g9ClH1AUticEYpJRRJBNRub9yDdAWRZ+YXGVdw8dGU34wWoRQyRbB5 314CPAABZchHWfjOuOkevxuRx0mTq/ZUspjk3laGpJYngdOU/qqbsUd4Bga/OxL2p7Sn qigb16ipSEc3UCx2Md4VfmyPirtqJDeWxqT2xbTxo2zrpGAq2m3+PUezwTDdbJNCZrrx QR5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SXjhznol; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SXjhznol; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Google-Smtp-Source: AIpwx4+SqilrH2teukLBq3OM04gQK/o6scnPl5VTqxM3lBxwZh4twkUP46cBr9jr5WdaxdB1/7zZTw== From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , James Morse , Kees Cook , Bart Van Assche , Kate Stewart , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Dan Williams , "Aneesh Kumar K . V" , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan Subject: [RFC PATCH v2 0/6] arm64: untag user pointers passed to the kernel Date: Tue, 27 Mar 2018 18:57:36 +0200 Message-Id: X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1596110790501719687?= X-GMAIL-MSGID: =?utf-8?q?1596110790501719687?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Hi! arm64 has a feature called Top Byte Ignore, which allows to embed pointer tags into the top byte of each pointer. Userspace programs (such as HWASan, a memory debugging tool [1]) might use this feature and pass tagged user pointers to the kernel through syscalls or other interfaces. This patch makes a few of the kernel interfaces accept tagged user pointers. The kernel is already able to handle user faults with tagged pointers and has the untagged_addr macro, which this patchset reuses. We're not trying to cover all possible ways the kernel accepts user pointers in one patchset, so this one should be considered as a start. Thanks! [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Changes in RFC v2: - Added "#ifndef untagged_addr..." fallback in linux/uaccess.h instead of defining it for each arch individually. - Updated Documentation/arm64/tagged-pointers.txt. - Dropped “mm, arm64: untag user addresses in memory syscalls”. - Rebased onto 3eb2ce82 (4.16-rc7). Andrey Konovalov (6): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64: untag user addresses in copy_from_user and others mm, arm64: untag user addresses in mm/gup.c lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user arm64: update Documentation/arm64/tagged-pointers.txt Documentation/arm64/tagged-pointers.txt | 5 +++-- arch/arm64/include/asm/uaccess.h | 9 +++++++-- include/linux/uaccess.h | 4 ++++ lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ mm/gup.c | 12 ++++++++++++ 6 files changed, 30 insertions(+), 4 deletions(-) -- 2.17.0.rc0.231.g781580f067-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,T_DKIM_INVALID, T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 825A77DE76 for ; Tue, 27 Mar 2018 17:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446AbeC0RBP (ORCPT ); Tue, 27 Mar 2018 13:01:15 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44308 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbeC0Q5s (ORCPT ); Tue, 27 Mar 2018 12:57:48 -0400 Received: by mail-wr0-f194.google.com with SMTP id u46so23109396wrc.11 for ; Tue, 27 Mar 2018 09:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2unNROHG+8feIGotHXszhTuGPmpRY6bXBkim4UFPTaQ=; b=SXjhznolWo1hvxBRtHpKTOT8IY9XixA/kKc+IfwHbe8/lVgq1y2AV4kboGXl4kHBxk nyoqKsfwJUXwGk7PAMzPpGAO6gXLGQaIui2hzXXzgRXwJ/2ve6BuovPgdsTP76XDK+B6 ROO512Wu1uPsfVIS5QzZzMKq+ZFMbEhFW2S4MkFpLDoPvWcsNnBau5SPXgRjV3RRLQc7 Z7zMEp0ijm3LVZcWKI3kn9YqJbPNmQaKv390RnL7+NgPIDNwvdDA7HVAXVV0l21PLoNP 05xXhc/k3Wu4XrlSPtaZ4mlXnQwjalDCe/8Y/drJ2a1rwdPdu5+SOCo27z9I4Tub3/5v /feg== 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:mime-version :content-transfer-encoding; bh=2unNROHG+8feIGotHXszhTuGPmpRY6bXBkim4UFPTaQ=; b=T9/4f1xtcpJyYKHhoIEuMQ75+TSomwAdZiIcB19y9gTqnglJLUGzd/dhYqJlcxKD4j cy9fDrxC+fMDiiYbyCJmhN7hrf9s1R0NG64mcRhU3DnsSg/kOEr704V02rP+Ifti0xhk oRQO+iQfrnrsi8VNo47C93uvOFkIWDPlp5ZUeo5ZA3k53DbcCoKIlVuY7LlphRm0GIUd BB6YrfgZZNY3OoYqPfkEMeVqoA/ipA4E42MU4/qsd8VdXY7MvNqg7WsZ7VWbbG13KXwx Yse54Z5wSFyTzVPJi2mGA6JGm2Lt92RHbUQumJPLOQC4Mit1s7uAO5xQ0UbWI/0ezTyo UXNg== X-Gm-Message-State: AElRT7FqhBntzwWxni9YvMH/HFeKd1qaf60tJaIo3QDl2sTx81hzxfl1 qv0VbgXg2cmGOnckRxw1HkrFsQ== X-Google-Smtp-Source: AIpwx4+SqilrH2teukLBq3OM04gQK/o6scnPl5VTqxM3lBxwZh4twkUP46cBr9jr5WdaxdB1/7zZTw== X-Received: by 10.223.183.75 with SMTP id n11mr135507wre.22.1522169866448; Tue, 27 Mar 2018 09:57:46 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id 93sm1622992wrh.46.2018.03.27.09.57.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 09:57:45 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , James Morse , Kees Cook , Bart Van Assche , Kate Stewart , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Dan Williams , "Aneesh Kumar K . V" , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan Subject: [RFC PATCH v2 0/6] arm64: untag user pointers passed to the kernel Date: Tue, 27 Mar 2018 18:57:36 +0200 Message-Id: X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org Hi! arm64 has a feature called Top Byte Ignore, which allows to embed pointer tags into the top byte of each pointer. Userspace programs (such as HWASan, a memory debugging tool [1]) might use this feature and pass tagged user pointers to the kernel through syscalls or other interfaces. This patch makes a few of the kernel interfaces accept tagged user pointers. The kernel is already able to handle user faults with tagged pointers and has the untagged_addr macro, which this patchset reuses. We're not trying to cover all possible ways the kernel accepts user pointers in one patchset, so this one should be considered as a start. Thanks! [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Changes in RFC v2: - Added "#ifndef untagged_addr..." fallback in linux/uaccess.h instead of defining it for each arch individually. - Updated Documentation/arm64/tagged-pointers.txt. - Dropped “mm, arm64: untag user addresses in memory syscalls”. - Rebased onto 3eb2ce82 (4.16-rc7). Andrey Konovalov (6): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64: untag user addresses in copy_from_user and others mm, arm64: untag user addresses in mm/gup.c lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user arm64: update Documentation/arm64/tagged-pointers.txt Documentation/arm64/tagged-pointers.txt | 5 +++-- arch/arm64/include/asm/uaccess.h | 9 +++++++-- include/linux/uaccess.h | 4 ++++ lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ mm/gup.c | 12 ++++++++++++ 6 files changed, 30 insertions(+), 4 deletions(-) -- 2.17.0.rc0.231.g781580f067-goog -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f197.google.com (mail-wr0-f197.google.com [209.85.128.197]) by kanga.kvack.org (Postfix) with ESMTP id 1DCB06B0012 for ; Tue, 27 Mar 2018 12:57:49 -0400 (EDT) Received: by mail-wr0-f197.google.com with SMTP id c1so11972428wri.22 for ; Tue, 27 Mar 2018 09:57:49 -0700 (PDT) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w19sor864406wrg.71.2018.03.27.09.57.47 for (Google Transport Security); Tue, 27 Mar 2018 09:57:47 -0700 (PDT) From: Andrey Konovalov Subject: [RFC PATCH v2 0/6] arm64: untag user pointers passed to the kernel Date: Tue, 27 Mar 2018 18:57:36 +0200 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: owner-linux-mm@kvack.org List-ID: To: Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , James Morse , Kees Cook , Bart Van Assche , Kate Stewart , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Dan Williams , "Aneesh Kumar K . V" , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan Hi! arm64 has a feature called Top Byte Ignore, which allows to embed pointer tags into the top byte of each pointer. Userspace programs (such as HWASan, a memory debugging tool [1]) might use this feature and pass tagged user pointers to the kernel through syscalls or other interfaces. This patch makes a few of the kernel interfaces accept tagged user pointers. The kernel is already able to handle user faults with tagged pointers and has the untagged_addr macro, which this patchset reuses. We're not trying to cover all possible ways the kernel accepts user pointers in one patchset, so this one should be considered as a start. Thanks! [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Changes in RFC v2: - Added "#ifndef untagged_addr..." fallback in linux/uaccess.h instead of defining it for each arch individually. - Updated Documentation/arm64/tagged-pointers.txt. - Dropped a??mm, arm64: untag user addresses in memory syscallsa??. - Rebased onto 3eb2ce82 (4.16-rc7). Andrey Konovalov (6): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64: untag user addresses in copy_from_user and others mm, arm64: untag user addresses in mm/gup.c lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user arm64: update Documentation/arm64/tagged-pointers.txt Documentation/arm64/tagged-pointers.txt | 5 +++-- arch/arm64/include/asm/uaccess.h | 9 +++++++-- include/linux/uaccess.h | 4 ++++ lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ mm/gup.c | 12 ++++++++++++ 6 files changed, 30 insertions(+), 4 deletions(-) -- 2.17.0.rc0.231.g781580f067-goog From mboxrd@z Thu Jan 1 00:00:00 1970 From: andreyknvl@google.com (Andrey Konovalov) Date: Tue, 27 Mar 2018 18:57:36 +0200 Subject: [RFC PATCH v2 0/6] arm64: untag user pointers passed to the kernel Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi! arm64 has a feature called Top Byte Ignore, which allows to embed pointer tags into the top byte of each pointer. Userspace programs (such as HWASan, a memory debugging tool [1]) might use this feature and pass tagged user pointers to the kernel through syscalls or other interfaces. This patch makes a few of the kernel interfaces accept tagged user pointers. The kernel is already able to handle user faults with tagged pointers and has the untagged_addr macro, which this patchset reuses. We're not trying to cover all possible ways the kernel accepts user pointers in one patchset, so this one should be considered as a start. Thanks! [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Changes in RFC v2: - Added "#ifndef untagged_addr..." fallback in linux/uaccess.h instead of defining it for each arch individually. - Updated Documentation/arm64/tagged-pointers.txt. - Dropped ?mm, arm64: untag user addresses in memory syscalls?. - Rebased onto 3eb2ce82 (4.16-rc7). Andrey Konovalov (6): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64: untag user addresses in copy_from_user and others mm, arm64: untag user addresses in mm/gup.c lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user arm64: update Documentation/arm64/tagged-pointers.txt Documentation/arm64/tagged-pointers.txt | 5 +++-- arch/arm64/include/asm/uaccess.h | 9 +++++++-- include/linux/uaccess.h | 4 ++++ lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ mm/gup.c | 12 ++++++++++++ 6 files changed, 30 insertions(+), 4 deletions(-) -- 2.17.0.rc0.231.g781580f067-goog