Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2920412rwd; Fri, 9 Jun 2023 20:51:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jmg5Dh+UE06UpHwLflFD5N06cfvp5rDI5S3AuVzsCxjfz4SBzejCOYVY5LlSE7/yQI1// X-Received: by 2002:a05:6a21:6d90:b0:eb:e2eb:d7ec with SMTP id wl16-20020a056a216d9000b000ebe2ebd7ecmr3142855pzb.17.1686369079236; Fri, 09 Jun 2023 20:51:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686369079; cv=pass; d=google.com; s=arc-20160816; b=zdKcfqBywtjcHuTJ9dvAqU/7jzAulmOtpAEUkJH0SBH8H+g0GfEz8A6/KOUBBSPPzU fg7xg095xuvMWPS47xZd+dRwbfakv76AqXOuLwkV5DASTJV4A31cn+s8k+nksRu8hDmm 9FtBhklfqTtPy5DF+0tl4ff1g9BjZMHBP8/4M0xxppBoJYk1D0zeY4+v3DECFTTKG7Cs T4XV9YeQckzwmfdmQCvBRYJnuzLP/TNTMHPyB4jsP6BpV4CACOILQ9qfnapn6vBcHCjd 7TDYzn+GK68eun58Q9EiriI83uvUN9YfU2EXFXvPdHYXovt1HzuR/PIjFrKWZtam7Dp8 05eA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=wsDA7mmWwkcCq8giUSmoV6+hsyKqga8Opcd2XapAvmE=; b=0TcD6cpH2DR1KJ8OuCP1FF8D+GNMz8ijDLf1JQaHzCH5RG3cgePQauzWKjZBmM1Pg/ MaVgTnqSom892nrjpXX7Tf/76AkF67YbSRFe8TmSF1pKcnRrLcyU5C15ENlbABRf8C2Z Z6x//i6+XnIpEIgbzGxnRnvIcZ/A91FEBwCFqMJ1uw5L6NAN/MF2bdZVQE/9TxrvuGYF 4dJphIUJIouj2Ch142FXXaEYp6rrFYr1icZU0nn8h7ErydANcbZ3qWiPA6wwSbU15GDs kd7P9Vh4uH00HiWSgRiAN45pTdt99U96iRuD8vEK6Pi9xV1xVFXcIIPjUzKz1RxGR4eU mAMw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b="nigBs/Py"; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.com); 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=REJECT sp=REJECT dis=NONE) header.from=meta.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a63b510000000b0053fb85dd81asi3451228pge.325.2023.06.09.20.51.07; Fri, 09 Jun 2023 20:51:19 -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=@meta.com header.s=s2048-2021-q4 header.b="nigBs/Py"; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.com); 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=REJECT sp=REJECT dis=NONE) header.from=meta.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233910AbjFJDVO (ORCPT + 99 others); Fri, 9 Jun 2023 23:21:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233683AbjFJDVE (ORCPT ); Fri, 9 Jun 2023 23:21:04 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61D1F3A91; Fri, 9 Jun 2023 20:21:03 -0700 (PDT) Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 359KLcH5020541; Fri, 9 Jun 2023 20:20:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=s2048-2021-q4; bh=wsDA7mmWwkcCq8giUSmoV6+hsyKqga8Opcd2XapAvmE=; b=nigBs/Pyk2MT3g2phmOHRHjfuo3B1S0DvHMv7Gycgv970rBBrr0p+1HB5bCGz1GyuagA 4Me3UIaZO2Npo8fyM94jZ4wBf5gVRFR+eXYkC48GeFP6fzKWWUMFBQa92SdUvU9J3+6n EUZxykenkn4a3hcdfne4aYLieFvhRht8J+W9e1PtKERXAXeyw/r7ZFq3afVig8qyoeIp 6p4tBgM+J5Yfkx2tV/zO1vK4fzvM9IFbMd9MX9WHXA5+GavGTijQmj08RqpapCVmTSTX SrIWDOdZJ2oTF1IREP1DVXXvgzwEgZmh02YoMW2GHsefzo0DFhUB9fkHFiLCNLA/dOkr YQ== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3r4b1uj4sw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Jun 2023 20:20:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SX9j/hJQ1+KizGNTYXQYZNzZ7bT4UJ8xYcQTEmlPbJRYQZEJMFv/w4PJEBYJke/xlXoshH4l2ouJimDmbSs5pBoGs3OrGt3M06Q/LHXFd6jYpzy4xsD3jC6kQQLXguLrdLYPwGEIuaXppUxtVYfnpYcKmiLVx6M/kiEhyMbxB0mzlt6Kym3r5zqu9XYEdz/uWLMNhCHDk3LGT6kPkusRvt2zmv+6ov61jSgalyhvpmwJirJk7v6I+OD7OmOnaavH+TUBO8mL6EF5y+MD93SOnx9G9kdFnMKH1Thh1UwINluyIMXotHI8EaVvFzXmPYETHsSJF7XMz812fO2ZMGh/xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wsDA7mmWwkcCq8giUSmoV6+hsyKqga8Opcd2XapAvmE=; b=FrP2+seY2PgHT8pmsyVv7Hz6tNCtrTWJd9SbGSQ/r+t4UZOgQ5mYTko9qbq3vjolYOXaIYCuso23fR17rf3I6rb6IDnxNEPrqP0v87EUdStcoi2BSlvIurKpU0Ez3P0JgsqVoUGiOubUz04tmHl43y7QgjAsIV7Kt2sVb+Lv/Tc5Oecb8ZJJrtNJhxFCdWTMjeUwN0sfqJQxwq1X3PhzgqNdOsdDNx0outafoONC9+gNdV51QnBMfwnBmgH9qWhoWvaRdkL3/FsZL6jvEjzfy5hFCht3Hj4hEqUMApvBdI0bs7wsiE58F9RjvkQDpxGBCWnDKOwErGnfY6861mRedg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=meta.com; dmarc=pass action=none header.from=meta.com; dkim=pass header.d=meta.com; arc=none Received: from SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) by PH0PR15MB4149.namprd15.prod.outlook.com (2603:10b6:510:2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.41; Sat, 10 Jun 2023 03:20:13 +0000 Received: from SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::bf7d:a453:b8d9:cf0]) by SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::bf7d:a453:b8d9:cf0%6]) with mapi id 15.20.6455.030; Sat, 10 Jun 2023 03:20:13 +0000 Message-ID: <6c195897-e2c5-f0b8-45b4-83a0e9b71bf8@meta.com> Date: Fri, 9 Jun 2023 20:20:09 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH bpf-next v4 2/3] bpf, x86: clean garbage value in the stack of trampoline Content-Language: en-US To: menglong8.dong@gmail.com, andrii.nakryiko@gmail.com, alan.maguire@oracle.com Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Menglong Dong References: <20230609095653.1406173-1-imagedong@tencent.com> <20230609095653.1406173-3-imagedong@tencent.com> From: Yonghong Song In-Reply-To: <20230609095653.1406173-3-imagedong@tencent.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR06CA0054.namprd06.prod.outlook.com (2603:10b6:a03:14b::31) To SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR1501MB2064:EE_|PH0PR15MB4149:EE_ X-MS-Office365-Filtering-Correlation-Id: e853acfc-e893-4983-5de8-08db69619ad5 X-FB-Source: Internal X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /K4cEYc/icCx2D7mFPo4oIOF8wBrDVwGRup+3rfjT81FpbdpTeRm1a76NMBzTivSqk5ZHcbFScSuXaOiCMOovDtO66jvreHrbvTE8EOE8YvoG8SMmQVrDpQOGj4OqR9kt0kHAC7vm1QlDq+vdxJmG/0PZJpU4fMK7UwSeDryGwAkhmSex3ZUYLhCc/VZXSCxgpibj96BreaX6UkNBNRDVcx0r16ECkKLybvtnAan9++/Hoc6hF+ulVhRcaprYoSSYxzjV7PJV92WLFz/Se8uF5HdKmXQa8ueTAgpnEbUA7t30LehAkfZZjFkDW3YAL+O3ja2tWfcjw8iw1uqES2xObTPrVqoFXVb5LIbxeYjbiaIheZx0XFcPAm0oTmrEVtOfkSVss6+cjnrNuhhNNrHgdciWEJgm1Snk+7Aj0kGGsxFFHueADggkEOJwlwyiaG6hx0r7yQ02tJyOyhvHO9RNO7o6x0GvLvWgnm/I8NCblw7fdNtxNhc9SSL2kKmv9iobL4mIP08jay4HF7bBTHlr7DVa+fWqeZUomdtRQbZDr3hXQ81C/OtcWBg7VI9Yy/h7YE4Hb5uiV/LQIG9s7QV8kDc+Z4abD7cYl6bMd4XD5ESg/YqzJmPSnG1dIehMAC8whU5w7WxaZpYykQSEYHnuA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR1501MB2064.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(376002)(39860400002)(366004)(346002)(451199021)(66476007)(66556008)(66946007)(478600001)(8676002)(8936002)(36756003)(5660300002)(31686004)(4326008)(6666004)(316002)(41300700001)(6486002)(38100700002)(6512007)(6506007)(7416002)(86362001)(2616005)(31696002)(53546011)(186003)(2906002)(83380400001)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZUlxYnoyUURsbXF2OTA2QWVYQzZWejJseEMxSGNtSDNJbERMakdLbnd0R2cz?= =?utf-8?B?Um1CODFFL1VFNE1yelVz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RYY0xH?= =?utf-8?B?cmlSRTM5UDNPaUpUdk9Ccy9wTEIwV3JRSGx4dFllNGRnb0lJeTNWMHRPdXow?= =?utf-8?B?WVRCenh1ZTFheENFbmJ3NGZKK2lWUXFyTFRPYkRKd293Y2xsOHU4VW8vc0hs?= =?utf-8?B?b0Fqa0FIV0g0V2x2bTNkOC9oZmpkTTg2UWU5UTFtNTNlOVAyU05KekV0b2Vt?= =?utf-8?B?V1F5eGhaVy85eU85c1dTL0FYQnRzOTIxMm9lK1pZbVBHK01ycUJKSmx3RWo5?= =?utf-8?B?dXlaN0hEa0RGNVZFTXlEWEkvMzMwL0lYeUV1WnpqMUs2WnRBaFlFWk93a3dW?= =?utf-8?B?Ymc9PQ==?= X-OriginatorOrg: meta.com X-MS-Exchange-CrossTenant-Network-Message-Id: e853acfc-e893-4983-5de8-08db69619ad5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR1501MB2064.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2023 03:20:13.4363 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CsZwm5s/bnmTOhmV/sLjnRtgiKkqj8bK6CfvNMDY2jhBPKaIYb2pzijfP/9MN4f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR15MB4149 X-Proofpoint-ORIG-GUID: Rd89957PtYcSU-wSmLO698quPRovYBd6 X-Proofpoint-GUID: Rd89957PtYcSU-wSmLO698quPRovYBd6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-09_18,2023-06-09_01,2023-05-22_02 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 6/9/23 2:56 AM, menglong8.dong@gmail.com wrote: > From: Menglong Dong > > There are garbage values in upper bytes when we store the arguments > into stack in save_regs() if the size of the argument less then 8. > > As we already reserve 8 byte for the arguments in regs and stack, > it is ok to store/restore the regs in BPF_DW size. Then, the garbage > values in upper bytes will be cleaned. > > Signed-off-by: Menglong Dong > --- > v4: > - clean grabage value when argument count is 7 > --- > arch/x86/net/bpf_jit_comp.c | 45 ++++++++++++++++++++++++++----------- > 1 file changed, 32 insertions(+), 13 deletions(-) > > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > index a767e13c8c85..f6f51a5d14db 100644 > --- a/arch/x86/net/bpf_jit_comp.c > +++ b/arch/x86/net/bpf_jit_comp.c > @@ -1857,6 +1857,28 @@ st: if (is_imm8(insn->off)) > return proglen; > } > > +static inline void clean_garbage(u8 **pprog, int nr_regs, int stack_size, > + int arg_size) > +{ > + u8 *prog; > + > + /* clean potential garbage values in upper 32-bit. 'stack_size' > + * here is the offset of the 7th argument on-stack. Here, we have a huge assumption that if only 7 registers, compiler might just allocate a 8-byte stack space and write the value to it. If the type of the value is <= 32bit, a 32bit store will be on the stack. So in this case, the upper 32bit needs to be cleared. If the number of arguments (in terms of number of registers) is more than 7, the extra arguments will be 'pushed' to the stack, so there is no garbage. This could be true. But please add enough details here so people knows why we special case this particular instance. > + */ > + if (nr_regs == 7 && arg_size <= 4) { > + int off = -(stack_size - 4); > + > + prog = *pprog; > + /* mov DWORD PTR [rbp + off], 0 */ > + if (!is_imm8(off)) > + EMIT2_off32(0xC7, 0x85, off); > + else > + EMIT3(0xC7, 0x45, off); > + EMIT(0, 4); > + *pprog = prog; > + } > +} > + > static void save_regs(const struct btf_func_model *m, u8 **prog, int nr_regs, > int stack_size) > { > @@ -1878,8 +1900,7 @@ static void save_regs(const struct btf_func_model *m, u8 **prog, int nr_regs, > > if (i <= 5) { > /* copy function arguments from regs into stack */ > - emit_stx(prog, bytes_to_bpf_size(arg_size), > - BPF_REG_FP, > + emit_stx(prog, BPF_DW, BPF_REG_FP, > i == 5 ? X86_REG_R9 : BPF_REG_1 + i, > -(stack_size - i * 8)); > } else { > @@ -1893,17 +1914,16 @@ static void save_regs(const struct btf_func_model *m, u8 **prog, int nr_regs, > * 8(return addr of the caller) > * which means: rbp + 24 > */ > - emit_ldx(prog, bytes_to_bpf_size(arg_size), > - BPF_REG_0, BPF_REG_FP, > + emit_ldx(prog, BPF_DW, BPF_REG_0, BPF_REG_FP, > (i - 6) * 8 + 0x18); > - emit_stx(prog, bytes_to_bpf_size(arg_size), > - BPF_REG_FP, > - BPF_REG_0, > + emit_stx(prog, BPF_DW, BPF_REG_FP, BPF_REG_0, > -(stack_size - i * 8)); > } > > j = next_same_struct ? j : j + 1; > } > + > + clean_garbage(prog, nr_regs, stack_size - 6 * 8, arg_size); > } > > static void restore_regs(const struct btf_func_model *m, u8 **prog, int nr_regs, > @@ -1925,7 +1945,7 @@ static void restore_regs(const struct btf_func_model *m, u8 **prog, int nr_regs, > next_same_struct = !next_same_struct; > } > > - emit_ldx(prog, bytes_to_bpf_size(arg_size), > + emit_ldx(prog, BPF_DW, > i == 5 ? X86_REG_R9 : BPF_REG_1 + i, > BPF_REG_FP, > -(stack_size - i * 8)); > @@ -1956,17 +1976,16 @@ static void prepare_origin_stack(const struct btf_func_model *m, u8 **prog, > } > > if (i > 5) { > - emit_ldx(prog, bytes_to_bpf_size(arg_size), > - BPF_REG_0, BPF_REG_FP, > + emit_ldx(prog, BPF_DW, BPF_REG_0, BPF_REG_FP, > (i - 6) * 8 + 0x18); > - emit_stx(prog, bytes_to_bpf_size(arg_size), > - BPF_REG_FP, > - BPF_REG_0, > + emit_stx(prog, BPF_DW, BPF_REG_FP, BPF_REG_0, > -(stack_size - (i - 6) * 8)); > } > > j = next_same_struct ? j : j + 1; > } > + > + clean_garbage(prog, nr_regs, stack_size, arg_size); > } > > static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog,