From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96EA0C4167B for ; Fri, 1 Dec 2023 01:52:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376441AbjLABwf (ORCPT ); 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-Google-Smtp-Source: AGHT+IEFnK9rSPjSkAn46Nn/t6rQBkPoX0sBJ20OTRSbHUu03F9XcWeU9PActP7gt9A8pR2PCANU8Fv1ej4= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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