Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp703029rwi; Thu, 20 Oct 2022 04:21:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5prnQjlH9Rek/Qq0AagBWPNzWlVZxR9EdbrZ3Hk9iMyHOG+joLrcIvsmWcPyMhveNsBv9g X-Received: by 2002:aa7:c78d:0:b0:454:fe1d:8eb1 with SMTP id n13-20020aa7c78d000000b00454fe1d8eb1mr11598809eds.59.1666264901197; Thu, 20 Oct 2022 04:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666264901; cv=none; d=google.com; s=arc-20160816; b=wOR2rU6RrMWsNZtFZqKsnf7vNAnUytc7ihrQ09SS2F+359l2EVpRHJdNmh72ackkTC u8Fr4erKb8ybK3hmzY+YanHLr3VZV5dZVNz0iLCwBf7Bslrpdnj3hgP4BerK9zy8tFtt IxNlxEZaUaQKUBRPyAMav1jHr46OQwsLrZ9i5Ff2hqij8ZCsdGZkPJSfhvdgCX4IUyaK jnQaCGAhEZHOE0Xd5cMUCkb8UDh8tgv1ggUHBWGwmoOU8U2An2LEOagmhT34/9Z7IfFs EWuHNZCoYWkllObinIYZ4McwzXQXDAeJ+R1+FaNT+hb50E1mcR+gj3gqThObDVefMkXI MQOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=m0/zDB9esedN1FeU0NeS+vO2OMMH7WbilvlrNoZH0qs=; b=IrTSL/7PLZvekpyTwFsCC19BTgx5dOUHK68BRwF61cIi/OKkVs05oMxznRj09gvpYD 277zEqenWyghgm5VROL7XeNGLdggxdbdzcVcdEQa46MKBOoVfdUqMv5skEpHWV7DwgEw 4N6Dq5z7WeH9Mo0RLMZUCHNUmDUvKewXyfc8ItMEruutgQxNmAZgBjaNWYy7HquYVs0j jAIoeKrrOwBtDqzZP86M5CTjg00J9+WSZwtScRfN1EJCZ7d9nTnwqMWzczIr3eYNhk8B FjbWy8ldGhNDWTEhIRQrZ52YdUx9VaxMO036twEdo1aErdnTdzzObbny5/rDwtG5LeBs FxGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QLHcOiT9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a056402281300b0045b5ccda164si18869472ede.596.2022.10.20.04.21.15; Thu, 20 Oct 2022 04:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QLHcOiT9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbiJTLSy (ORCPT + 99 others); Thu, 20 Oct 2022 07:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiJTLSt (ORCPT ); Thu, 20 Oct 2022 07:18:49 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34991ACAAD; Thu, 20 Oct 2022 04:18:48 -0700 (PDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29KBEhqM015308; Thu, 20 Oct 2022 11:18:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=m0/zDB9esedN1FeU0NeS+vO2OMMH7WbilvlrNoZH0qs=; b=QLHcOiT99zePR8dQgIgQ6vEEZzAXVakIevLJo3CS4goC2W2Pq8GaR3o4USXlPI+ANvLr UEW+B9TxpdfWwODw04ZIgO+t2aPqBV/xtXehaa/5HiWc5l9xOQOgo2YRMod7ZJ/7fK3s qYNd8jnpfGfhYrm+JJ3ZYr3Vsk1eM7DfJuwO1SNjmmqQ+vfhNTPiEbdZ0x9U/ZG6kb31 FKiq36GDbNKLL41l4t0f0Xu4PGGM0LUPY3MP9LmN9myUmayZfN1nuretOaUBwgC8oHEq Fcc9mo9mTEVoe5SgrwZjjLuZuY0racxPHSuRFyrFBPevE8FSqfAZ66SKkO6sLeuzIQe7 lg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kb59jg381-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 11:18:43 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29KBICNq031838; Thu, 20 Oct 2022 11:18:43 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kb59jg377-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 11:18:42 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29KB6PB0014031; Thu, 20 Oct 2022 11:18:41 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3kajmrsh0c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 11:18:41 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29KBIcwL1704660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Oct 2022 11:18:38 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EBF495204F; Thu, 20 Oct 2022 11:18:37 +0000 (GMT) Received: from osiris (unknown [9.152.212.239]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 82DCC5204E; Thu, 20 Oct 2022 11:18:37 +0000 (GMT) Date: Thu, 20 Oct 2022 13:18:37 +0200 From: Heiko Carstens To: Janis Schoetterl-Glausch Cc: Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Vasily Gorbik , Alexander Gordeev , David Hildenbrand , Jonathan Corbet , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, Paolo Bonzini , Shuah Khan , Sven Schnelle Subject: Re: [PATCH v2 1/9] s390/uaccess: Add storage key checked cmpxchg access to user space Message-ID: References: <20221012205609.2811294-1-scgl@linux.ibm.com> <20221012205609.2811294-2-scgl@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221012205609.2811294-2-scgl@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: DXiud5lnz0qHz52hmUW7aLhhFFDzz_2e X-Proofpoint-ORIG-GUID: MPFyuwfdOx1UFPeLiaJTnXuSSB6tM1Tf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-20_03,2022-10-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 mlxlogscore=696 lowpriorityscore=0 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 impostorscore=0 spamscore=0 priorityscore=1501 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210200066 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Janis, On Wed, Oct 12, 2022 at 10:56:01PM +0200, Janis Schoetterl-Glausch wrote: > Add cmpxchg functionality similar to that in cmpxchg.h except that the > target is a user space address and that the address' storage key is > matched with the access_key argument in order to honor key-controlled > protection. > The access is performed by changing to the secondary-spaces mode and > setting the PSW key for the duration of the compare and swap. > > Signed-off-by: Janis Schoetterl-Glausch > --- > > > Possible variations: > * check the assumptions made in cmpxchg_user_key_size and error out > * call functions called by copy_to_user > * access_ok? is a nop > * should_fail_usercopy? > * instrument_copy_to_user? doesn't make sense IMO > * don't be overly strict in cmpxchg_user_key > > > arch/s390/include/asm/uaccess.h | 189 ++++++++++++++++++++++++++++++++ > 1 file changed, 189 insertions(+) This not how I would have expected something that would be symmetrical/consistent with what we already have. However instead of spending several iterations I'll send something for this. This might take a bit due to my limited time. So please be patient.