Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3917172pxj; Tue, 15 Jun 2021 11:20:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSH46T1gup5kthtLP5mgzHI+4VC6TtbQvt9YoOp93wNvGanr5h24HKhXOeG/lmy8mm6s+7 X-Received: by 2002:aa7:c04e:: with SMTP id k14mr1019297edo.157.1623781259561; Tue, 15 Jun 2021 11:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623781259; cv=none; d=google.com; s=arc-20160816; b=ci/grvuJ5u0qqlm9GVQZLA6Ie8HNi6AX8wmlGbtPd3dgjnsVrDYZTNzuQa1Aky1E59 ousnFoL1QMX2RADMHE5O+fXydhm9v5TAlLNoVqJT2sxGEK7nF336sOGrIYhrKDZ5XPiH pdQGUUx9yCYdxoZXndDC4b4ZMP4G3GspurYMs96DlDtv888wVcECnZpZCoyBIinR96jB vvIMbRgJDPsOT3Hsz4M5J2YJkASCZJu/EjaaaVfFV6dZcUe/J0Qat/dgxsbsn+RgFNi0 lqC1JEiLEdu8hDnXpEtiI6rbbQ1bztZCjMxBMqIS7EglNRgtgQzfnIEgRBOdfSJ9knzL uwVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Av+6lPQlyv+Sn6WN/JAS+BG6bGNrpjaP5opx8sV0nnc=; b=0py+BoEdU5fyxdcebbkujRIsIEjVdaoGFk16UjFUdmK5KvjN3ofC8PAE9VgWB/oZ4o VdjcscGAeUbnmpbV4s5VOyNM0/mDucJj8L6VSEtAbtnPtDjWqbcszlJ4Yn2D/1YiqTjS 5ohv51+5I6WujSJx+75dXx6ZP8LBY+ccLqTvM+EgJnE/xsZnNDxrGJ5hBwdOG9l3wK3L 0jj2Kb55vGlf6dzPF6IkTbbgZ/WwQOaTet4iR4eQ9osPUjpd7p/ngDwbYCvGT4HMo4rS Hfv//KltjNXDbndICGEdCxNUTso0j+C9LdG7NXJsl8Rme5JL31iWlGoyE3unAAJMoBYR of0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=WQuQwtCi; 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 e25si15429731eds.353.2021.06.15.11.20.35; Tue, 15 Jun 2021 11:20:59 -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=@linux-foundation.org header.s=google header.b=WQuQwtCi; 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 S231310AbhFOSVa (ORCPT + 99 others); Tue, 15 Jun 2021 14:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbhFOSVa (ORCPT ); Tue, 15 Jun 2021 14:21:30 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 627A1C061574 for ; Tue, 15 Jun 2021 11:19:25 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id i13so5236405lfc.7 for ; Tue, 15 Jun 2021 11:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Av+6lPQlyv+Sn6WN/JAS+BG6bGNrpjaP5opx8sV0nnc=; b=WQuQwtCiT/eoKl6qV5lHYx4lH+0EDr7+nOJYQ1h6yvBunl0woPiervNHkI2DWuHNMS q2DNf1dI8WkF30DAo2o970Na/Exs7H+KKRGluFxJ9QUdoPaAT85CHvggye+xAbjL8yy7 H4ASmIp9BBpePbCJfnUYj3imRXf4Pc4Dds7lg= 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=Av+6lPQlyv+Sn6WN/JAS+BG6bGNrpjaP5opx8sV0nnc=; b=M/AEAtwu0bkiUQJfVjx5m8kUUkTjGhZ46L1q9JeX6qWm43GFAbvsCCZIfn7TPTDdQr LnoFxvzDy01YiUh2OJ1JkcB+LqNwrRLHy7+f1fludx5ftsdBhLp9EX1pHzk8011hQNS4 rF9cTF1WjLdJef2pZfc/5YyKPfpGGL2ZMIpXOWYfgK7OuTpMK0flhPbyOtF9R6Sna5Su NLWeRN5gFB6tlkKP4WmDOMkxCjbM26ep5zXL13FgRTjsrbeDwNdQ+lb3lJIYdWlaVeL4 mu3RvCW5AXvHPbYzK9e3QSfwg7FRUPD61a0IhC/j9swqBCUHP/qUAa8ldgYIS4FrAN+z iEOQ== X-Gm-Message-State: AOAM532Asr8/2jj80p0QoL6CgRs1ucTxKfPXExG3taxhm6yG3+TJkWNs lRVDzJnsfrtfg6y68r9+OfDS6MwrMwgpkU+G X-Received: by 2002:ac2:5f7a:: with SMTP id c26mr488292lfc.515.1623781163521; Tue, 15 Jun 2021 11:19:23 -0700 (PDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id v19sm1885211lfp.92.2021.06.15.11.19.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 11:19:23 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id j2so28377322lfg.9 for ; Tue, 15 Jun 2021 11:19:23 -0700 (PDT) X-Received: by 2002:a05:6512:374b:: with SMTP id a11mr468018lfs.377.1623781160087; Tue, 15 Jun 2021 11:19:20 -0700 (PDT) MIME-Version: 1.0 References: <20210608171221.276899-1-keescook@chromium.org> <20210614100234.12077-1-youling257@gmail.com> <202106140826.7912F27CD@keescook> <202106140941.7CE5AE64@keescook> <202106141503.B3144DFE@keescook> In-Reply-To: From: Linus Torvalds Date: Tue, 15 Jun 2021 11:19:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] proc: Track /proc/$pid/attr/ opener mm_struct To: youling 257 Cc: Kees Cook , Christian Brauner , Andrea Righi , Linux Kernel Mailing List , stable , regressions@lists.linux.dev, LSM List , Paul Moore , Stephen Smalley , SElinux list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). 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). Kees, do you see anything? Linus