Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2605476rwb; Fri, 11 Nov 2022 11:47:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf47IO8v6mEfpkH4EUnGESroUCm2Mkhd5bm/YGzFMFYBCfyvLoouM1e7upOpu4nD+t1JSbh9 X-Received: by 2002:a63:fd41:0:b0:42b:68a1:4207 with SMTP id m1-20020a63fd41000000b0042b68a14207mr2943037pgj.326.1668196054435; Fri, 11 Nov 2022 11:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668196054; cv=none; d=google.com; s=arc-20160816; b=Giom5U5hLN7ss5aYD4ZcWum77p8t/gXzE1SNag0TycRkVbxOyqdwa88YVZq1D53ZDL dLuB7LDmvqcsKinBwJAOeuxjoituYsgWA5Vx/qYZ/lM4JBY3YJvtwY9VxpTo9d21YlCF 5a2bHn/l+cUhTqVkn6HxggsJf3bDZgojOIvdE3SjtHpChWp0Fwn2EoPXE7cRpNAh69yS o1iFEqXTT4tsNR8opmuFwr5O26gItLYhXUFm8451qbvDXvdDHJgUTPFx60/HSbh3zLig AvruS6HDngEZ7Fr4K3bbiZYy/FIgTzqHIoCYF3uZFlWOrJBo4I80QMVW2BmSs1CV/f1j 9yjg== 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=wa0u9WjMdfrDtoNQdvxz75RgHs0C3nrrN8jlNPdiCpI=; b=hwYkafbkbwS1exOCbMfzMHlWmnOdoBFqDtFVlqXhg7eKFBwc30CUD4oxDgJyVb3nUL Deo8gyfZ/Z0fDQEJ/L1jUmrrgFFcApjJYWxtSb/keazoDF6o3ZsET2f18k596dv6vqJF jAb9G30D09ArdraoFLS+le5f2VIinTYH1/g8OsGsFOz1Wm93jv23LBKzQ0RS9WENDjgb GmQk8EItcouN9vcxLMUcEESOFUSb/UVDdEDSXdZhWibpucFCNdC2Sa5LzFE2+bxq28cY VYlEYMSSuMl1Bj8qwS1/wZw9f1V2oxkhumNTmxwbS+KXwSTTq9rpH5Gaa3MZRy2+7JgQ YYPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FXRDGik8; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg22-20020a17090326d600b00179faf5c34asi3017684plb.379.2022.11.11.11.47.22; Fri, 11 Nov 2022 11:47:34 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=FXRDGik8; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234080AbiKKTfV (ORCPT + 90 others); Fri, 11 Nov 2022 14:35:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233965AbiKKTfS (ORCPT ); Fri, 11 Nov 2022 14:35:18 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F9BC3E0B6; Fri, 11 Nov 2022 11:35:18 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id 78so5107625pgb.13; Fri, 11 Nov 2022 11:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wa0u9WjMdfrDtoNQdvxz75RgHs0C3nrrN8jlNPdiCpI=; b=FXRDGik8x+lnhkLZYjwd4P2vPsErIfLDnuYSpWOWbmZknmalveMDes7PnK/Z/F7fJE HYfirBSKQCGMigGXGf1eXgjYMh8jWQAxj8E3W/MpPzPIYDDhyVajloLxc24wDK5tya+9 o5XphFDEovZnsOS794ScV8AlAdNZqMyh2H+GgtQexiNhc8AHk4q4FkoemaToCcJb4JLb baJt4YPww1N3rbkK7HGpmsR68byeho5Ygw8VVHz+8BIyVRdEzg5/PwefotZXT/OIql5/ IoEloEY/9SM3ABPOQ0AxTwfAsxRRRR0cnyD3Vtq/Y2qgVQtLJaLx/cIHJXmfI849D9At yWQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wa0u9WjMdfrDtoNQdvxz75RgHs0C3nrrN8jlNPdiCpI=; b=i8Oc0B5YlCS7QL4Leiebv7MiSdVk+1t7u/bP2lf08IqjSA3SpHvFIbJEWx+vprm9MT J+c1wZqwlBMQhKvUDf1xfJe+k1LkzyIX4XvsF9OBjkmDNdo/jnYcqjce4Ow6xwT0vGZs JGzYwv6WB2d7hOo0KqS7jMvGGwnbz7HzOrqUbHQ3Mx4f+qkLY+ftG0klLYGmj5ddSFOf xO32rhj++AzWmbHSJeKF4h0LMMtmAoHU3JP2LkQdyPRq8OMm8SRmrsP3uKjDAhcnzCrY 4Smt8nX0UFWyDJP3+1zejW5+cJLQQnHkhQ6WUYH6x5GIIPZkM0juP5mMPWSimca7Eo46 2Pag== X-Gm-Message-State: ANoB5pmc8P+PSnPWuJCNqQ8Odf/hzVg9j/KXyzzTcqD3zQAide0+MFDP LTs0dhNBeY1pzrOGMLp+we4= X-Received: by 2002:a62:5a07:0:b0:56e:76e2:a375 with SMTP id o7-20020a625a07000000b0056e76e2a375mr4301297pfb.4.1668195317472; Fri, 11 Nov 2022 11:35:17 -0800 (PST) Received: from localhost ([14.96.13.220]) by smtp.gmail.com with ESMTPSA id z27-20020aa7959b000000b00565cf8c52c8sm1988821pfj.174.2022.11.11.11.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 11:35:17 -0800 (PST) Date: Sat, 12 Nov 2022 01:05:09 +0530 From: Kumar Kartikeya Dwivedi To: Xu Kuohai Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa Subject: Re: [PATCH bpf] bpf: Fix offset calculation error in __copy_map_value and zero_map_value Message-ID: <20221111193509.dmklqyxyy3psvgfc@apollo> References: <20221111125620.754855-1-xukuohai@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111125620.754855-1-xukuohai@huaweicloud.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Fri, Nov 11, 2022 at 06:26:20PM IST, Xu Kuohai wrote: > From: Xu Kuohai > > Function __copy_map_value and zero_map_value miscalculated copy offset, > resulting in possible copy of unwanted data to user or kernel. > > Fix it. > > Fixes: cc48755808c6 ("bpf: Add zero_map_value to zero map value with special fields") > Fixes: 4d7d7f69f4b1 ("bpf: Adapt copy_map_value for multiple offset case") > Signed-off-by: Xu Kuohai > --- Acked-by: Kumar Kartikeya Dwivedi I also have a fix here for bpf-next, since this won't apply to it: https://lore.kernel.org/bpf/20221111193224.876706-4-memxor@gmail.com I think it'd be best if this one gets applied to bpf and mine to bpf-next, and any conflicts are resolved when merging both trees (the conflict is trivial), but I'll leave it up to the maintainers to decide.