Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5207866rwb; Tue, 17 Jan 2023 10:29:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXsCTY7lLZWgx5ZQx4SNjsW/C1Bk2YwbnzRxXuaehgOAI9M2CLynj2KDO0IG8udx62xYQli4 X-Received: by 2002:a17:906:d0c8:b0:84d:855:dd02 with SMTP id bq8-20020a170906d0c800b0084d0855dd02mr4146993ejb.46.1673980196347; Tue, 17 Jan 2023 10:29:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673980196; cv=pass; d=google.com; s=arc-20160816; b=p3YgjpAH7QFO0gA6kqNmgeTQLhC10z/ze2uFzmCu3Hgl9xWfKwVazZlBmE/GBVuOR6 0+knSEj/nC/mLzYLPqEEbeDW1Mb29KLuCY+oJChsUfTbRHQ3Nz5TPi4KRvLoRMK9QsLO U6JBuBGROy9z9NyU6eh2WylHoNnR25qQyAoQ1xt1+RhGxiPeRAfKb3h7+a0MeVb1cBEa anyc1k3TAYNE0Ewpk+Gas0E82kkSbM+JbLfnSbtYVn7bdfRAhLmJkCcoOGLuVsZ6jj07 9OdS+d9Jcje+eaHjqKp2vKu42k9wuQjpgHlVrLAxqLjjHDYL+zywoxqu1e50GOXCYD0/ 9/YA== 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=jHGdlh0adxogGlQqAv5TcIJ1DkMj0v0QZu1rJhm3YMc=; b=be/g3NLeiJeqify1rLUq8S1kjfX22Hvd4wp2qBnvptxQm7ilyJcL5u91+hDfij5D41 bms9vJLVdSocRxQDqUisaNt+aAy3p+9yS0KcFZOjsLFJUaXcLHMMDEclXl22xKT09Eil tYvtIU0kqZHh4cZpKxZHSQR7xn1wA+mpNsfxj0CZ2SuhWpf2f1zWde19UwzrwSRvR6oz /BTWS0FdhhtI8xvQjQZOLQCkAzOmh2lc3qDVvTj2BvDgReoKZqWSYh4JLWrcVrKfA/6b brbHMe/GDFKxdJdu9wItynQamB/Jrra6O2/XDVLfZA89QYanm6p32C1U5sNEtbmIFwJm o16Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b=dxGhcXGi; 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 qw2-20020a1709066a0200b0087045ec47b0si8035270ejc.980.2023.01.17.10.29.44; Tue, 17 Jan 2023 10:29:56 -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=@meta.com header.s=s2048-2021-q4 header.b=dxGhcXGi; 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 S234882AbjAQROE (ORCPT + 48 others); Tue, 17 Jan 2023 12:14:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235071AbjAQRNg (ORCPT ); Tue, 17 Jan 2023 12:13:36 -0500 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E111C4994D; Tue, 17 Jan 2023 09:12:02 -0800 (PST) Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30HGB8d3031105; Tue, 17 Jan 2023 09:11:11 -0800 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=jHGdlh0adxogGlQqAv5TcIJ1DkMj0v0QZu1rJhm3YMc=; b=dxGhcXGikqx5GB1DeBLj+v4wtnGDb3NRMqvT547NB2PEdtL504neULf+R1WCFeRVaK48 vpXjGl1BxVTIKNf2SSQoNQ61sjRSoFjyW4YuTtEH03L4GDp3ZOP2iIjlq1PNolzEMhI5 utu+oXhhOPs29XSaxisdyHE7VxJBYZ5XwHVpmJ+gGbMwVKsSSfjEpZQSZTqziV90xya7 NkqhmkWu1AKwioCYLxOFBvAYN4bs8rDFt2wKQNAZHKk7AigLPCNtQhTxUxxkbv2kWEBk 5+f+nRX6chMcYIEpTorbZI40CvvoSXN/joL0XLqWlvrZMXm01U7IwZIxydJrGP5udkjs Yg== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2048.outbound.protection.outlook.com [104.47.56.48]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3n5x0e8xy3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Jan 2023 09:11:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kBQfZOihvstA17iDFcAxem9Gr9GCjwQju7Lxp3QOQyEulTZHcSesxT9cv63RFoqTGLLcFf2mY4ml0REtDhbMq92n/PLNSFLmJXBKNR7zSKc8QKEvps4QKXKXjtrUAydjYVh9cuqmoD2gKbAQj6gOSFwQdEvZsZAjvsBBJB/q8MMiHeOAT9u4oNHtbmGFKz2WZ0KvkTa6IZOMU95lYBm+V+fpsFD9sEXDlrrUPI9tqfykB6xUPBDHCYq5aPMbyoyRI48PWP8jc6ZfmK4MuGQIqhrH/s3QO8O2JVMRDfKe3N/da+L/WAMoSMiCa7kMh+wsv/uJld45W3mk7krIKZUj5A== 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=jHGdlh0adxogGlQqAv5TcIJ1DkMj0v0QZu1rJhm3YMc=; b=dgMsaDNzOkNrsh+PYP6nJY3uESxNmwzX5/achCrSkebMZP2MkyN0eDoafPozFYbjBUn9v3IUAtAOmhrLwL/UtWKpr4D3BM/RIA028B5R+I6MhFQ+ZDY5OXMLL0y+VTx2wgePgWO5Vi/etvLjokEODvl1dXLOvDZLl9f1AVsvwfJglAv9oHZGvtfZNu90kqRD/t/fSzF68Js6+j8H5R395miffEcrE2T7gC9YpmR0x3uwL+ie43JzhTIm/12dsWocLs++/xC5pMn8az/hmDdnL7DSyQtBTQXbeG0lcd/sD0Wa1WUc/hKZHx93ZPhmatLFa2esc7ACwTnBvNpQlAHsnQ== 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 MW4PR15MB5181.namprd15.prod.outlook.com (2603:10b6:303:185::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Tue, 17 Jan 2023 17:11:07 +0000 Received: from SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::3cc9:4d23:d516:59f0]) by SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::3cc9:4d23:d516:59f0%4]) with mapi id 15.20.5986.023; Tue, 17 Jan 2023 17:11:07 +0000 Message-ID: <389997bc-c7a9-4d17-1cd3-9d389c80e887@meta.com> Date: Tue, 17 Jan 2023 09:11:04 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] tools: bpf: Disable stack protector Content-Language: en-US To: "Jose E. Marchesi" Cc: Peter Foley , Eduard Zingerman , Quentin Monnet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Nathan Chancellor , Nick Desaulniers , Tom Rix , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, david.faust@oracle.com, elena.zannoni@oracle.com References: <20230114-bpf-v1-1-f836695a8b62@pefoley.com> <194f38f2dc7d521375e5a660baaf1be31536be9a.camel@gmail.com> <1135125e-6b8a-7b75-5f0b-3208f6b6e8ae@meta.com> <87bkmx9tw8.fsf@oracle.com> From: Yonghong Song In-Reply-To: <87bkmx9tw8.fsf@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BY5PR17CA0010.namprd17.prod.outlook.com (2603:10b6:a03:1b8::23) To SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR1501MB2064:EE_|MW4PR15MB5181:EE_ X-MS-Office365-Filtering-Correlation-Id: 510b7801-266d-4da6-c99e-08daf8add2d1 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: xqzOUs4nc26dttQqAcQtmRemDmdI4p0RHKIaQB8shnw/6hf2o2sAfegkfaou8/NrKsYMwbhP7gFQ4TkGg5eDiB8hRYo1UoI35pEKVsqocamg06dZsUH4O6H8CF2okQ3+lp12JasGwy4UtL1FYrpZOyW1WaREWp98Bb4GQnOL0JXyWL9dyL7UCF+GOMPR5J1QNqNif7ux7DT4X2SegQXrPeLyFPUg0uX3etVy2WbvOQuQgQc1ZDGWOapSupZ14L29zboLq5jR0LDGCytxu15b1/tDuj9KnMV30BSInxTogPtNbsnWXImw/k2YJWwW4ke6+3OnyPWHjyHdLf98xBB8Wk6pT7IVqrvgnUlQnyh/D4LXhUXfsXuLL3VjmDx/FcgndkpIzkEggZT3wryeCDBLcDTrEpZqvvNpj2S6cNZUfWqzlDM89nAjRu6z+gmok0InABsAU01lXNiKWpIIieyNeyIzIqH3VLlO4szUc1cA4Uv6rjlg0hj7mGUbYLvJ/qlB7CfFnyEGm8k+qhomhXkpwDmKQrUYKT/4S9rVtNWnMbBqx3a5sjE3SYN0Q2+KTI+dROE3iRspPUvbbHsX5HbyOfArUWtpGwdZ1aUyV4RFkPUE1Ya4hoWGZsRvQrQwrNxnswH8bcD2XnTPyzVnwsRjv6ET62vDJjK+jPbjnXIcvuL4siTO7gkqmWalBF+DZGB99VI/aeAYJ4IFtg/I6HcyUPEXn0qdKVA3vor7NWEOT3w= 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:(13230022)(4636009)(396003)(346002)(136003)(39860400002)(376002)(366004)(451199015)(31696002)(86362001)(36756003)(6512007)(186003)(53546011)(6916009)(8676002)(4326008)(66556008)(2616005)(41300700001)(66476007)(66946007)(54906003)(6506007)(316002)(478600001)(38100700002)(2906002)(6486002)(83380400001)(7416002)(5660300002)(8936002)(6666004)(31686004)(45980500001)(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wa0JiVldoUlU1NkM5c1d1OUk0djk1KzBDdFIxNVpx?= =?utf-8?B?ZEkyWFVtbmtCVG5TVUFYOU9yYTVKMzhEUmFwTm0vUi9obEszam44dzlndG1J?= =?utf-8?B?WkUvRDRCNmhXdnkxODVlOExUR0t1ajJacTdtV3pTQkdqaXkya1ZJeVFxTlNZ?= =?utf-8?B?UTlXVjIwMTZnUThIUXRuRXVVaGJtYUFtMmVFa1lZcHFlTXNtWVBTQnZKME9E?= =?utf-8?B?SGFuNE1QYnNUd2ErSmEyenpiUEhjeTFKU0pUeVp3d25yY2JHcG54eGtRVndK?= =?utf-8?B?Vm1XUFJ2SWxzRUNlREJwN2o1NXZVdDFYcVY0RlI1RlI5YnZYOU1lUm54cHNj?= =?utf-8?B?QnU5c3NGcHFZVHNITjI4UjdPdURkbzhZcTN0OU5jYzFmL0RwVjduZ3haUm93?= =?utf-8?B?ZFpLZytONjhjWEk2ZWhrcE1lcGpGdUZSSVRmRjlMY25Ydlpqd2VFWDdwWnZN?= =?utf-8?B?S2c9PQ==?= X-OriginatorOrg: meta.com X-MS-Exchange-CrossTenant-Network-Message-Id: 510b7801-266d-4da6-c99e-08daf8add2d1 X-MS-Exchange-CrossTenant-AuthSource: SN6PR1501MB2064.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 17:11:07.8372 (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: Lkkw+muBpefyUH5aRe2CYx66wkX3d0IXuSsdiAOWgGb/BiIdroh4Qw8KVwkzUaiR X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR15MB5181 X-Proofpoint-GUID: _pgWdmndgpiAHgxbZfGopQ159fzZmLtW X-Proofpoint-ORIG-GUID: _pgWdmndgpiAHgxbZfGopQ159fzZmLtW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-17_08,2023-01-17_01,2022-06-22_01 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_NONE 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 1/17/23 5:23 AM, Jose E. Marchesi wrote: > >> On 1/16/23 2:49 PM, Peter Foley wrote: >>> On Mon, Jan 16, 2023 at 4:59 AM Eduard Zingerman wrote: >>>> >>>> A bit tangential, but since BPF LLVM backend does not support the >>>> stack protector (should it?) there is also an option to adjust LLVM >>>> to avoid this instrumentation, WDYT? >>>> >>> That would probably be worth doing, yes. >>> But given that won't help already released versions of clang, it >>> should probably happen in addition to this patch. >> >> Peter, >> >> If I understand correctly (by inspecting clang code), the stack >> protector is off by default. Do you have link to Gentoo build >> page to show how they enable stack protector? cmake config or >> a private patch? >> >> Jose, >> >> How gcc-bpf handle stack protector? The compiler just disables >> stack protector for bpf target? > > It doesn't. -fstack-protector is disabled by default in GCC. When you > use it you get something like: > > $ echo 'int foo() { char s[256]; return s[3]; }' | bpf-unknown-none-gcc \ > -fstack-protector -S -o foo.s -O2 -xc - > $ cat foo.s > .file "" > .text > .align 3 > .global foo > .type foo, @function > foo: > lddw %r1,__stack_chk_guard > ldxdw %r0,[%r1+0] > stxdw [%fp+-8],%r0 > ldxb %r0,[%fp+-261] > lsh %r0,56 > arsh %r0,56 > ldxdw %r2,[%fp+-8] > ldxdw %r3,[%r1+0] > jne %r2,%r3,.L4 > exit > .L4: > call __stack_chk_fail > .size foo, .-foo > .ident "GCC: (GNU) 12.0.0 20211206 (experimental)" > > i.e. it pushes a stack canary and checks it upon function exit, calling > __stack_chk_fail. > > If clang has -fstack-protector ON by default and you change the BPF > backend in order to ignore the flag, I think we should do the same in > GCC. clang itself does not have -fstack-protector on by default. It is hardened gentoo distribution unconditionally added -fstack-protector to its clang distribution. In clang/lib/Driver/ToolChains/Clang.cpp, we have ... // NVPTX doesn't support stack protectors; from the compiler's perspective, it // doesn't even have a stack! if (EffectiveTriple.isNVPTX()) return; and -fstack-protector is not effective for NVPTX. I guess we could make it noop for BPF target as well.