Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp735038rdb; Thu, 30 Nov 2023 17:52:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7YjxIojQ1pKSRwyiLEgGLaciOPIhOIIk0Ej62YqJelepUUZFzC2ldNIB3ALcsqhOVXR40 X-Received: by 2002:a17:90b:1c8b:b0:27c:f309:f381 with SMTP id oo11-20020a17090b1c8b00b0027cf309f381mr24262652pjb.6.1701395570914; Thu, 30 Nov 2023 17:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701395570; cv=none; d=google.com; s=arc-20160816; b=o8t28accEtgoU6UJ8rYI/so88oxImpxHFx2lCKEg5kPJ7anwbyuYz913oQNFVxdd2b vZERvKqE6z5hqi5jyPAAY4g141z2tO19oDglW+67LNMhWuK2YC5LBjg44XP/l2EG1suc rx53iNX5RJEyAs8FldpoUZdFMqvo1KLshODISJveFUKLNmo6Etpd+qM4xLwEwyMT4J9g 3A7wj7O3Tkk4OPBdudGECvXYn+8gonZQlBUO/JM+Sf7D2h1g0ePBXoNw3wna+JsCxbx+ Y0Cc2BFbECXLezbbcyyylzRPYc7qnflj+kllfzB6NjXq11LfmbslDRPwFYRzT4aypmO2 zZhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=jDAo7xcaTB61zqktCfZGe7MT3u57tuHVzlhp9HQUcu0=; fh=YZ8dRRR9BPnIVZD1fFhgLwWmxgLxfL0B/py1KXmJ6pc=; b=TYgSYc+XPQONruC6zKkyvDuItCFHnABz3h3fU+qKL5M7LnmxTP2JTzJsMA126734zc kBILv/xZ1vExWiOrltLZEwt00nZ8+KmR3u8NCp+5uUJrswHfislwtt7j/2HbRQmAU5J4 Jb1GqQIQEkQMTDoMkm8omWfvwwl2PpY0qcHgYGp/FsPHbk1mwE9vrxPYGVLSphlQMEZb wlzO6ROAp9VROySHiM+CWgo3mAFY3kGzkIFmForS7OvJO4Y23VuFrhUBJuQJDyCzO18i k+zbAWAUjcsY/8GyAjkX6xnC5lQshTAC4gzP2jzb8SbTpvF5p9j5SihTLowpRDmCM8wN Fp8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=boT7pveg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id h17-20020a17090aa89100b00285d591d93fsi4584167pjq.182.2023.11.30.17.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 17:52:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=boT7pveg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 77A5780F6D21; Thu, 30 Nov 2023 17:52:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376422AbjLABwf (ORCPT + 99 others); Thu, 30 Nov 2023 20:52:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbjLABwe (ORCPT ); Thu, 30 Nov 2023 20:52:34 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C2293 for ; Thu, 30 Nov 2023 17:52:40 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id 98e67ed59e1d1-2859052aed9so1826296a91.3 for ; Thu, 30 Nov 2023 17:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701395560; x=1702000360; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=jDAo7xcaTB61zqktCfZGe7MT3u57tuHVzlhp9HQUcu0=; b=boT7pvegiLKGSOyot5VpydIoDnTrvslBe3SilXkVSDVar4Z6FRP+Qi0VNOzkjTQhEf ZOQ8/HniHu7QLU4RRsPT4bF09fhZOD1F/yvwUWHuBpR/lqFJu0X1irXsBxIhrpchZX7i hOooRFkOBjt8sIMGSeVLBrY33HKp4jY2wTl9tfq1VWsnFIh31h4uVKLIFeGMa5z41S1g 7o7Cswl8pP/MlnaPX9ipx8c1Rhy1Hp8C0Fg8+xPdMHimQbuekEqDySOiIcEceAHe16UT 1aB43CsT03I25QewZaxBAdI3t05hXJklt57jT2Q89OZ6I4zGxFUbcVT1wouPu6f5hhB9 /qTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701395560; x=1702000360; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jDAo7xcaTB61zqktCfZGe7MT3u57tuHVzlhp9HQUcu0=; b=IIqWwVeanJXGUgr/NK7sYpIwoNBTMB11Yo546Gbd0EvYejn5YVDj8XyQHR9Dzf41SR HFw2Nz3qykrm2P6cUB4rsdSrzT+fkM0KB2cetH3mjaAh4RzIK/ZbdrBiTWRkc8Gsqn7e w4QAqnGikUYNC21C87MsyWNVN9eLIwGIuagjjp6IN9Ci2qnPM0F0ggLM7oOZI3q92Euz gUK3v1Io6uJF5T851BbyxMRrcI6xi2w0W6PiMRlTQJcqrVS9e8Tr0/RkHy1bVTXyvAMq 0KpVEVzLuPcsk0sVSeP2ifTpm9OVASarK2rv5GUpJWVo75mvxa/4/EBRg1V28p/XjLaa q5zg== X-Gm-Message-State: AOJu0YzajLimxkP5kR6Cs2m4EILAC1D8CO4/aHB+HVSiqxa9b2F8DSB1 t0BSjbF8LX7A6RdcLxNQVx4JAMWy8Ms= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:143:b0:281:37ae:df69 with SMTP id em3-20020a17090b014300b0028137aedf69mr4741858pjb.4.1701395560050; Thu, 30 Nov 2023 17:52:40 -0800 (PST) Date: Thu, 30 Nov 2023 17:52:06 -0800 In-Reply-To: <20231102181526.43279-1-pstanner@redhat.com> Mime-Version: 1.0 References: <20231102181526.43279-1-pstanner@redhat.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <170137909771.669092.7450781639631347445.b4-ty@google.com> Subject: Re: [PATCH 0/3] Use new wrappers to copy userspace arrays From: Sean Christopherson To: Sean Christopherson , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sven Schnelle , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Philipp Stanner Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Content-Type: text/plain; charset="utf-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 17:52:48 -0800 (PST) On Thu, 02 Nov 2023 19:15:23 +0100, Philipp Stanner wrote: > Linus recently merged [1] the wrapper functions memdup_array_user() and > vmemdup_array_user() in include/linux/string.h for Kernel v6.7 > > I am currently adding them to all places where (v)memdup_user() had been > used to copy arrays. > > The wrapper is different to the wrapped functions only in that it might > return -EOVERFLOW. So this new error code might get pushed up to > userspace. I hope this is fine. > > [...] Applied to kvm-x86 generic. Claudio (or anyone else from s390), holler if you want to take the s390 patch through the s390 tree. I massaged the shortlogs to use KVM's standard scopes, and to make it clear that these are hardening patches, i.e. that there is no unsafe/buggy behavior that is being fixed. I also added a note at the end of each changelog to call out that KVM pre-checks the sizes before copying, again to make it clear that using the safer helper isn't expected to actually change KVM's behavior. [1/3] KVM: x86: Harden copying of userspace-array against overflow https://github.com/kvm-x86/linux/commit/573cc0e5cf14 [2/3] KVM: s390: Harden copying of userspace-array against overflow https://github.com/kvm-x86/linux/commit/8b81a8d7c6b7 [3/3] KVM: Harden copying of userspace-array against overflow https://github.com/kvm-x86/linux/commit/bc2cad56094c -- https://github.com/kvm-x86/linux/tree/next