Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp165142pxj; Tue, 15 Jun 2021 22:59:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHt7880Tll+jZ8Uz0fk78WhtNh+eO1aOmAjdBC08ViRCq2h/9y8mpxM1/72exvjNSgpwBP X-Received: by 2002:a05:6402:28a:: with SMTP id l10mr2053949edv.365.1623823185725; Tue, 15 Jun 2021 22:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623823185; cv=none; d=google.com; s=arc-20160816; b=reTVL10gQkavSWI5eSIBDFSWPhLHBXrX5+nMcSwdl6DcRzBSi6Z8mIv3eW/9ecBW3/ lgt4cJWphSKQd5LX/Ti7fDKnJl6yr+K/6gg4XV2y71SJdwhJ92GmmmCAkXvvwn1Opt1+ hWfZq4YvjDocx0ysSlR8uUfOjLt2Q+x950csqiL0jJinsViHeeqZth0HQXFX0JD3eprN RBWqkXPeBgB8tMqXgDqwvh65pjtU4uADaPxEFEE+Oa60lkpClEfCO3LR2PUCE56FQW/9 KQPEh3J+c9Xnh6hwJhQQK1yOnhbsUtTZAaWYl7Gl9ruoWIdNBDwm8Mu8RjPaNv1259s6 XUXg== 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=Snt3Rtzt9YQ4b5ZL2cGkK4Ell5YkfJ13R0+NEziU0Bk=; b=VlNg5BsoaTtpOFmbAg9jIz5igPWtCmAePp6NjxZEdqLqaWHbQo208wmJFhdmWHXCuj Mz13ErVoLGS1KN9R+SfmeiAdX05IAjuqK+vuTvxAPuqkA0Fvw8GLIO4vVzVFIksNFOiM 20l9J9wd9pdcLOSIKCTj1TqTxR+/FrXy/RQU1cIKXNrkk+m3/8KIMtIUs0C3sfHJ8kRX YuKM198ppMBvffFNqZOi4conrgU9SPEe5HL+rNnd/fuGoD76Uo4WVg+mjQnPyqaYX7C1 gw5Qf2siPYgEwjPNEs2OCRUPEEqefLLp8K2CXVPJhTaPqT5q1FHLJZugIZ7cWwKaudwY w5nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F2huXltd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fl21si1220483ejc.443.2021.06.15.22.59.22; Tue, 15 Jun 2021 22:59:45 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F2huXltd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231187AbhFPF6R (ORCPT + 99 others); Wed, 16 Jun 2021 01:58:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:56614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbhFPF6Q (ORCPT ); Wed, 16 Jun 2021 01:58:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 959FC613BF; Wed, 16 Jun 2021 05:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623822970; bh=dMV6mj8avOtYIM6fDZMCQ/7U10m1DHYngtE/rADgayQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F2huXltdBPNovJk4HlG+2LtNSHW/oGSzMB5+Yin2VSRvdVPwqDhOl5UCfbGUMjcvn GyuOQt2sd+J+7oVVQiYx+eQ0fTqLtU65l4K2O3lHFG5iiH9ZpJVIXoPqPVNDTGK8UF QqhjtYxqRAe5kPEaANQzdh/E3Pn+YnmlPLYv3W90= Date: Wed, 16 Jun 2021 07:56:06 +0200 From: Greg KH To: Kees Cook Cc: Linus Torvalds , youling 257 , Christian Brauner , Andrea Righi , Linux Kernel Mailing List , stable , regressions@lists.linux.dev, LSM List , Paul Moore , Stephen Smalley , SElinux list Subject: Re: [PATCH] proc: Track /proc/$pid/attr/ opener mm_struct Message-ID: References: <20210608171221.276899-1-keescook@chromium.org> <20210614100234.12077-1-youling257@gmail.com> <202106140826.7912F27CD@keescook> <202106140941.7CE5AE64@keescook> <202106141503.B3144DFE@keescook> <202106151449.816D7DA682@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202106151449.816D7DA682@keescook> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 15, 2021 at 02:50:39PM -0700, Kees Cook wrote: > On Tue, Jun 15, 2021 at 11:19:04AM -0700, Linus Torvalds wrote: > > On Mon, Jun 14, 2021 at 6:55 PM youling 257 wrote: > > > > > > if try to find problem on userspace, i used linux 5.13rc6 on old > > > android 7 cm14.1, not aosp android 11. > > > http://git.osdn.net/view?p=android-x86/system-core.git;a=blob;f=init/service.cpp;h=a5334f447fc2fc34453d2f6a37523bedccadc690;hb=refs/heads/cm-14.1-x86#l457 > > > > > > 457 if (!seclabel_.empty()) { > > > 458 if (setexeccon(seclabel_.c_str()) < 0) { > > > 459 ERROR("cannot setexeccon('%s'): %s\n", > > > 460 seclabel_.c_str(), strerror(errno)); > > > 461 _exit(127); > > > 462 } > > > 463 } > > > > I have no idea where the cm14.1 libraries are. Does anybody know where > > the matching source code for setexeccon() would be? > > > > For me - obviously not on cm14.1 - all "setexeccon()" does is > > > > n = openat(AT_FDCWD, "/proc/thread-self/attr/exec", O_RDWR|O_CLOEXEC) > > write(n, string, len) > > close(n) > > > > and if that fails, it would seem to indicate that proc_mem_open() > > failed. Which would be mm_access() failing. But I don't see how that > > can be the case, because mm_access() explicitly allows "mm == > > current->mm" (which the above clearly should be). > > Yeah, that was what I saw too. > > > youling, can you double-check with the current -git tree? But as far > > as I can tell, my minimal patch is exactly the same as Kees' patch > > (just smaller and simpler). > > FWIW, for that patch: > > Acked-by: Kees Cook > Cc: stable@vger.kernel.org Thanks, I'll go pick it up now. greg k-h