Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4068858pxj; Tue, 15 Jun 2021 14:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXxusvL52OUXOONe2DoZQo6t5Bop35Wr7rNhnNvjmGftT6kCjxIvZxUBysAvdVFl/PCjGT X-Received: by 2002:a92:d9ce:: with SMTP id n14mr1150652ilq.176.1623793888121; Tue, 15 Jun 2021 14:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623793888; cv=none; d=google.com; s=arc-20160816; b=SU1PbCfBJ7O210aumghybnRsr92hgflRvrbFEIt9XU9jf28mRXwDtjICdWM+hkHUVf TCxo2jXe4KqgAY3h2KQjrhAjqyFCgdUDuBWQpQocF3udJ5vhsP/35k/bNeiEzIDy9YFP D9+xEbw88/gGaBCrgB/c1WL+pR0sokCV5vZUce0/7a/wfDf4xsGCcgSEvRPqahH8by4q 3utBsgTZ3EHpgL4nbFRWL2i3z7LL4OMdaAE36EJjYcy8LU6DI5KucX+bQyGW8lhv+4OT 6wrXGK/x7ZUdYW/OsR2Daa4izWE2ol2gxPpjrVkJMlUlDLpODA3baMfjzsZZ1NyDCuTm 1QuQ== 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=kAd/yfjnZAJnZ1i9PxYoWIcrrD32M0xPaFynNraifo8=; b=drCRxAtMKFCf4rM1S7RXFyVJx0i1FNob6nSsABjnujUUzErRggNMxe6Q+Hat6+jPbc M3BflWpgLQu+4hkmCMnY3zWsDWDc2wZoFDkro+PxjDFvYVAuq9stKXuGqBtCeq5mYh5g yJXM2RFJJhVQM+yy11ntLD5h3nErlwuBLyysvqt0Dg5I/pTZTkbX8UGPz6Bqt65mfmJx BwOwlURQJ/T7f/h46SEtqtiLEaPkim4UMidR4zhSprZvbMwIehUD8CoqkabmFZ/04v1e K+SwctnlcU8K4lFMWrx0ffDmEesuy5tcjNALglvwplnIUUq9bhsE2Ne+lciarm88Jr4Y vK/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TTsvJNuq; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x15si366302jas.110.2021.06.15.14.51.15; Tue, 15 Jun 2021 14:51:28 -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=@chromium.org header.s=google header.b=TTsvJNuq; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231264AbhFOVws (ORCPT + 99 others); Tue, 15 Jun 2021 17:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbhFOVwr (ORCPT ); Tue, 15 Jun 2021 17:52:47 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25A5FC06175F for ; Tue, 15 Jun 2021 14:50:42 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id fy24-20020a17090b0218b029016c5a59021fso2730753pjb.0 for ; Tue, 15 Jun 2021 14:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kAd/yfjnZAJnZ1i9PxYoWIcrrD32M0xPaFynNraifo8=; b=TTsvJNuqQMhrf0yczwugM/OX3X5T887jaoeU16Dyq1hM7HpduS6R9dGOlaKseXfo5X MU6zYiDkXNoF+6j8/+NuvuGgRVPA4s6s7nQ/vD+qNtnI/fG/mSqUSJKfdQUSDDF6JSLH 2Z/u+jmcGeMetKZkZO240THoxgYUber3JRYt8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kAd/yfjnZAJnZ1i9PxYoWIcrrD32M0xPaFynNraifo8=; b=iirbnr8E/Ji/mUcNrDVsI8l06vsE6rEPe7iDHXMO1gmkUXvFBz127/Re83l2aW1UQj jKyRIBTJ03ES0cHJnPAh0CNt2aBAbaSc5f15WyznIxLmgm1ncO7z2ZRZHMbthRr0AoMv j7r8s1ckthYuuWAw0TA0dknl/adymmPtOkymyMRskbaOkXl4/3m8X/4qPIcbu3zl1XcR /7msYJgl0WjBz8kLTZYq8UUHYeRh9U8ulWTgefo6Ey2LeRM3DpnmWCCwkzeapei/++CU s8ZEAMbtQLb3kRgASTWC2zhIoZ0OeshY0gn9raSRrK8ueEr8xihnDZyggrLFJRjG8Lb0 xtBw== X-Gm-Message-State: AOAM532EV8jR7sCJPA8AdQ9qOajfJPX8oCC6UcrvxT9NlGstdd/Ao6Nl y3IsC7Ppx50kU3Gbee3owpUd/A== X-Received: by 2002:a17:90a:1a:: with SMTP id 26mr7076831pja.187.1623793841662; Tue, 15 Jun 2021 14:50:41 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a9sm119023pfo.69.2021.06.15.14.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 14:50:40 -0700 (PDT) Date: Tue, 15 Jun 2021 14:50:39 -0700 From: Kees Cook To: Linus Torvalds Cc: 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: <202106151449.816D7DA682@keescook> References: <20210608171221.276899-1-keescook@chromium.org> <20210614100234.12077-1-youling257@gmail.com> <202106140826.7912F27CD@keescook> <202106140941.7CE5AE64@keescook> <202106141503.B3144DFE@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > Kees, do you see anything? No, I haven't been able to reproduce the failure. :( -- Kees Cook