Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2329899pxa; Mon, 24 Aug 2020 11:04:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ92tCCG2Te4ewai/uOfDJ8t7wjxl6hWDq7N5zP+EkJIr46Y2sPN/ZI3WkfFVnybqnWVU+ X-Received: by 2002:a17:906:e2d5:: with SMTP id gr21mr3916010ejb.438.1598292295882; Mon, 24 Aug 2020 11:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598292295; cv=none; d=google.com; s=arc-20160816; b=Goh9g01FLAIEbsXkuL0wXOGOI2MONVuQgfttDDBPvrTPMjHTIeAOcJraW1T2wGpAFi TcqcHlZeTQ2wZ+mRzkoGec+saQ2gylvy71XNh96cGKm5YLZCgCF9I43NRbHKiVpLOaiL STW1SN7MLy/CvLCZRNFSSJMX5AW6ULxhBKyOfopp+garqlBIiHq9A6fW2Jpi4GVuVl4f Lv7n0V+4JOOny1wZIcszHBgMJOKQJP3LhZM1UaGWeKHa+gt2mUkp/t+lWH6L5oMFFqKi ExFG/IJeH+pi9n1N5C/RsnCShW77d/fimq49Jp5H2RAXH2LfUahIqKFbT1olw87+AUte HLMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:from:references:cc:to; bh=3GJCfwC6SVPAdYsbdjOag7ygfBjGZBd/v2hPsIjMnwk=; b=F0i58L5Ny90pxdfprh/AYK5haSTAK5sY2eNj2TqaQe4w1iOmOI9KnKuAvyuGwM1jnA 4QRO6f8CL0Eax+Xrhi74q32JFO7PmpdqEc/728WTdlxC/c2W5Qg3k4QUcW1JINSL3mI/ n2kD2hIZgbYtgdawEi6nbqgu79QckW6W+2rgOW/7OMwMnhKOUj45blFmS4i6yIXcTCry h74zUaI9+1oqILPVETgP/N6ahxGkt9+dr5U41ka/axRyVDQdP74zrcRjVVFvxdzhk/mO UzuOu+JZ5VdobtWYdwLx2UJRAZSTNVu6z9KSrM6KID1ePz1bzyUY6X+OXMqNZswAN7fS /1eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me20si1116597ejb.270.2020.08.24.11.04.31; Mon, 24 Aug 2020 11:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbgHXSDn (ORCPT + 99 others); Mon, 24 Aug 2020 14:03:43 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43136 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgHXSDl (ORCPT ); Mon, 24 Aug 2020 14:03:41 -0400 Received: by mail-lj1-f194.google.com with SMTP id v12so10708731ljc.10 for ; Mon, 24 Aug 2020 11:03:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=3GJCfwC6SVPAdYsbdjOag7ygfBjGZBd/v2hPsIjMnwk=; b=UFsh+1ZKEyZtu4GIlycvX7FhAvkEa5LJILXfunlaTw/fZrYMgglazvkJCPZeZmROa9 7D/f0qTO7lGd4Utt7Oi6LmeocidjFRguRlASXNvTyFVgoY1tPbviOOT9pty71+F1BVCg yTfY0Z+eygiPStUdn5btkNl67iSdiLu//RkVYYpEPQ5LHxzwIXeMH+a55XS8Z6v3G5e2 Hm/u2m83Uxa8VMHNL6glFm7qaRrbi2mTvpWcoHz8rtdgCdMlCHoNX/x8O2RcIBhI4pj5 hMKVYa6avUDRfdPkvexdQm5z1JXDtdeUcNBOiu0KpjJZaMZO1KxdcVMV33lFtBsZGeC/ eT9w== X-Gm-Message-State: AOAM532LrZl4vF4YNdTeCX0nd0OT8u4g/CjTdzf0DOy/dYbSNPBCaCNo 0zHvl4qIcSuD8pEFdB7Jv4G/N4qashs= X-Received: by 2002:a2e:7c18:: with SMTP id x24mr2989083ljc.402.1598292214900; Mon, 24 Aug 2020 11:03:34 -0700 (PDT) Received: from [10.68.32.192] (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.gmail.com with ESMTPSA id e21sm452427lfc.97.2020.08.24.11.03.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Aug 2020 11:03:34 -0700 (PDT) To: Kees Cook Cc: Andy Lutomirski , Will Drewry , linux-kernel@vger.kernel.org References: <20200824125921.488311-1-efremov@linux.com> <202008240929.8DDED2B90@keescook> From: Denis Efremov Autocrypt: addr=efremov@linux.com; keydata= mQINBFsJUXwBEADDnzbOGE/X5ZdHqpK/kNmR7AY39b/rR+2Wm/VbQHV+jpGk8ZL07iOWnVe1 ZInSp3Ze+scB4ZK+y48z0YDvKUU3L85Nb31UASB2bgWIV+8tmW4kV8a2PosqIc4wp4/Qa2A/ Ip6q+bWurxOOjyJkfzt51p6Th4FTUsuoxINKRMjHrs/0y5oEc7Wt/1qk2ljmnSocg3fMxo8+ y6IxmXt5tYvt+FfBqx/1XwXuOSd0WOku+/jscYmBPwyrLdk/pMSnnld6a2Fp1zxWIKz+4VJm QEIlCTe5SO3h5sozpXeWS916VwwCuf8oov6706yC4MlmAqsQpBdoihQEA7zgh+pk10sCvviX FYM4gIcoMkKRex/NSqmeh3VmvQunE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WyEhJT+CS3JJyP8BmmSgPa0Adlp6Do+pRsOO1YNNO78SYABhMi3fEa7X37 WxL31TrNCPnIauTgZtf/KCFQJpKaakC3ffEkPhyTjEl7oOE9xccNjccZraadi+2uHV0ULA1m ycHhb817A03n1I00QwLf2wOkckdqTqRbFFI/ik69hF9hemK/BmAHpShI+z1JsYT9cSs8D7wb aF/jQVy4URensgAPkgXsRiboqOj/rTz9F5mpd/gPU/IOUPFEMoo4TInt/+dEVECHioU3RRrW EahrGMfRngbdp/mKs9aBR56ECMfFFUPyI3VJsNbgpcIJjV/0N+JdJKQpJ/4uQ2zNm0wH/RU8 CRJvEwtKemX6fp/zLI36Gvz8zJIjSBIEqCb7vdgvWarksrhmi6/Jay5zRZ03+k6YwiqgX8t7 ANwvYa1h1dQ36OiTqm1cIxRCGl4wrypOVGx3OjCar7sBLD+NkwO4RaqFvdv0xuuy4x01VnOF Subject: Re: [PATCH] seccomp: Use current_pt_regs() Message-ID: Date: Mon, 24 Aug 2020 21:03:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <202008240929.8DDED2B90@keescook> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/24/20 7:34 PM, Kees Cook wrote: > On Mon, Aug 24, 2020 at 03:59:21PM +0300, Denis Efremov wrote: >> Modify seccomp_do_user_notification(), __seccomp_filter(), >> __secure_computing() to use current_pt_regs(). > > This looks okay. It seems some architectures have a separate > define for current_pt_regs(), though it's overlapped directly with > task_pt_regs(). I'm curious what the benefit of the change is? > Generally, it's just a shorthand. From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3460a59747cfddfa7be4758e5ef08bf5d751d59 - arch versions are "optimized versions" - some architectures have task_pt_regs() working only for traced tasks blocked on signal delivery. current_pt_regs() needs to work for *all* processes My motivation: I'm going to add cocci rule for using current_uid(), current_xxx(), ... instead of raw accesses to current->cred, current->cred->uid https://elixir.bootlin.com/linux/latest/source/include/linux/cred.h#L379 These interfaces use rcu_dereference_protected() internally for access check. I though that adding current_pt_regs(), current_user_stack_pointer() to this cocci rule will be a good idea. Thanks, Denis