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 X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D42EFC31E46 for ; Wed, 12 Jun 2019 11:14:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5223208C2 for ; Wed, 12 Jun 2019 11:14:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Nj7E5cU9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="QkhZMvI8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5223208C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+Ay3Mzl/o171fQxDTMZ+x+swZB2n6ntFYOWnX0E+wPg=; b=Nj7E5cU9OHA5/i zOohaK79pj15KjFgq83NsQvQCmh/3kUNu0w7KeOYngH9a1ASHAuCsAkjb1Qd0HJFJ8/9/plloQhpU 436v7j7G4sfxDQO0yO95jGbMfcmzs0J+klt1kl4ieyg6v4k5FjfNLi9wb9ayvU8GR/wIKZ4QE2W92 gLlVqdNNjnOkTEFuf0pW+LORk3vGTrXPNxsnmNSvqtr0WkfMvjbYXJNZ4Nu51KgicTknlQJIe/I80 xbzkCy6RI0ToDIw9lAJ9ghQU96F2ydTDtWiff9i3th173T0NeRDmfOE5lb2KU8QdBmQGnAg0ceF3v msbT0CeeV8oMvI709Wnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hb1DK-00060s-Dq; Wed, 12 Jun 2019 11:14:46 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hb1DG-0005zl-SN for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2019 11:14:44 +0000 Received: by mail-pl1-x643.google.com with SMTP id bi6so6107464plb.12 for ; Wed, 12 Jun 2019 04:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ICAcqmNM80YqXGU9u0yKcUq/onm/SsQo2SDs/l3f+hY=; b=QkhZMvI8xgho9eMFZ7w6J/3duhWcdGLEkVVUAU2qSaxNfXU+GXLc+PdiUdCpUn61iY 0xCUxQ9wiA1Jj7ZnvEwSzmljdVe71a10tK0t/VIk6vJ6KuoIESh9plrNP00oJ9EUV9CE 7ZXKJL/NmCDrLh5D1fRV3U/5XcSqnaFIYrJ7IhnmnWDC1y2ZQhZMwMFDrVZ4wkPjj2PR KjnNxVxOeNHsZ1yb6hgnM2H6TbZTzWPz9Cffq6e0f9rEpBuiI2bynmdfsgpQFhae4y5r LLRsk0MnIrY8OwbkGOOGkhYBEu+P7mFEBBswTcH9Mhn9r0qq9AEF/SsRyiNTxER5NtY3 eTUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ICAcqmNM80YqXGU9u0yKcUq/onm/SsQo2SDs/l3f+hY=; b=NihHxGylI23qm0GlE0OPP19KOhAB+RUxU9QarJ1OytxXD+kF/rixda7M1WX8f1bojc +X5903zaIESJEA/+8RN+Lueqw81ASchIxR1d+9BMhD76YwGuSisWWiKh/CQ5KC+71owQ dn3NmLKGW0roM7Cg5Q3zqlyZtbmLkItVBXntTlfGLAyzJ4Et6KaA160e0RjxoPXwwfd6 I879yzjjubT/JjkjJ1tDwm9XiuZIz7xR3LyMDWuLLmp6krD2OOj3d1yR8+Ugc3Ojoelc hbyD1wh7FD9HYIqcL33WfcHISPFc5Cze6fqFDeoM8Hy/wsFVPo/Fy5TTM1z7kk7D0ZzN UTsA== X-Gm-Message-State: APjAAAUEHcayx9XF/kceX9WspwnVPA6J4ABSTXbhgr/7ApPEZwdNFW0l hwMew0elcRBA9Xc/XcaqpIx8iYLKW5bXrlGDWxGP8w== X-Google-Smtp-Source: APXvYqygEZ27HGfNqszCpdSgojAf7S6ru14/DaT8Or0Syv3FL9sWDfZ+9LXBU0/5Hxbzx8tkSmaHaZjTcL+f/jghf7s= X-Received: by 2002:a17:902:8609:: with SMTP id f9mr75570344plo.252.1560338081704; Wed, 12 Jun 2019 04:14:41 -0700 (PDT) MIME-Version: 1.0 References: <9e1b5998a28f82b16076fc85ab4f88af5381cf74.1559580831.git.andreyknvl@google.com> <20190611150122.GB63588@arrakis.emea.arm.com> <20190611175037.pflr6q6ob67zjj25@mbp> In-Reply-To: <20190611175037.pflr6q6ob67zjj25@mbp> From: Andrey Konovalov Date: Wed, 12 Jun 2019 13:14:30 +0200 Message-ID: Subject: Re: [PATCH v16 16/16] selftests, arm64: add a selftest for passing tagged pointers to kernel To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190612_041442_946181_727EA385 X-CRM114-Status: GOOD ( 14.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, Szabolcs Nagy , Will Deacon , dri-devel@lists.freedesktop.org, Linux Memory Management List , Khalid Aziz , "open list:KERNEL SELFTEST FRAMEWORK" , Felix Kuehling , Vincenzo Frascino , Jacob Bramley , Leon Romanovsky , linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Jason Gunthorpe , Dmitry Vyukov , Dave Martin , Evgeniy Stepanov , linux-media@vger.kernel.org, Kevin Brodsky , Kees Cook , Ruben Ayrapetyan , Ramana Radhakrishnan , Alex Williamson , Mauro Carvalho Chehab , Linux ARM , Kostya Serebryany , Greg Kroah-Hartman , Yishai Hadas , LKML , Jens Wiklander , Lee Smith , Alexander Deucher , Andrew Morton , enh , Robin Murphy , Christian Koenig , Luc Van Oostenryck Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 11, 2019 at 7:50 PM Catalin Marinas wrote: > > On Tue, Jun 11, 2019 at 07:18:04PM +0200, Andrey Konovalov wrote: > > On Tue, Jun 11, 2019 at 5:01 PM Catalin Marinas wrote: > > > static void *tag_ptr(void *ptr) > > > { > > > static int tagged_addr_err = 1; > > > unsigned long tag = 0; > > > > > > if (tagged_addr_err == 1) > > > tagged_addr_err = prctl(PR_SET_TAGGED_ADDR_CTRL, > > > PR_TAGGED_ADDR_ENABLE, 0, 0, 0); > > > > I think this requires atomics. malloc() can be called from multiple threads. > > It's slightly racy but I assume in a real libc it can be initialised > earlier than the hook calls while still in single-threaded mode (I had > a quick attempt with __attribute__((constructor)) but didn't get far). > > Even with the race, under normal circumstances calling the prctl() twice > is not a problem. I think the risk here is that someone disables the ABI > via sysctl and the ABI is enabled for some of the threads only. OK, I'll keep the code racy, but add a comment pointing it out. Thanks! > > -- > Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel