From patchwork Tue Oct 17 13:05:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 78027 X-Patchwork-Delegate: siddhesh@gotplt.org Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF2E43882AFA for ; Tue, 17 Oct 2023 13:08:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id AE680385E02D for ; Tue, 17 Oct 2023 13:06:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE680385E02D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE680385E02D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697548012; cv=none; b=dJpuNnbTnjnN3tXDGA5ze1qekEHyXjcvvGJbQ29qcJe9dwPpkOTggVwzrpnCtioShHHV6DvI1xER+LQlTMSRLv+ZWeGUfOGEuPHTuLN/ePo8HpWro9oS9H0Vqa3k2IEAXjFRsuOwDvnVucTRegasNHX/Wap3lLk8xD4e8TSTm4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697548012; c=relaxed/simple; bh=/14hMOfrdbjyNdiy4FstCws/zVFE4wTVdJ9wq44vwUw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=fWEr+BsyVVeJ8kqJFwIVKN+8Kp43CUfZ9CeRt55sfNDxxjCyoG7ACd67bxK05B3PGDs4uyXD0pSnGR3F/IYgpk3AJSr/de5zdydAkjJYhw50uIDA9Pn2dyDUXNheat35BdRM0XQPT7qJfgB4K2nGipVzXOO0aHoLvooPn0M+Gug= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6be840283ceso313105b3a.3 for ; Tue, 17 Oct 2023 06:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697548010; x=1698152810; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Pph0HzXGubFkM72YNoRwe9rSD1jpPmNhGJehSpDJ8NU=; b=C68cT9Vsq9xEaFaYmlODNTcupoeE+/YKa7UE4buXgNrS0YR364PQEV1XcQggrtiB+l OH3dXF73VAz8EE3ATxP8fVGEXWA3ZajhU5Xoryixi6dZekNvUAklcUBgypYVQZzKg/wb kuFQWGrNbF2Y5F0tjGwXG5PtNIMiINhTXQdGOsdeCMKVK4gkIkiU2SQpQbZISzlQDPKO szTIrBA9PZzae5RED9lkaYqPst17U3gS5Bb7r8I+1J3dPFbhythKZS/za5qTrG4b727a 4QE3wXermxOQP5k5BscebHLD/1vGQULcLniWotnkPJ/Q4nNA5cTboPtXVSjddHYYGLHs v+Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697548010; x=1698152810; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pph0HzXGubFkM72YNoRwe9rSD1jpPmNhGJehSpDJ8NU=; b=kGnLlk2B9CxeHWgJoCYj9gkF2/+zoZ2LeXt7LXkHTB14txm2jKgC1rSX4y4WPq1As8 5txRqbBZV4iODYQGau9UjHk7F9h4sPfu/y3iGBijQyBqGaJnwQTRd7ko83cq/pNicbBl qd/f0+d2LmE8hNzQJzVykhXjejrkHkTAqqRbq/NHAi3IwAQfkjGaViEWk31L1HLkU2Si UQnITQ/iGbDW6ina5CwC6RgQw3RE1XoVnQrZroQOO/oHAhiqdzW70PoSNAHuHaRQM1/9 Mgbz6YtDw+v2J28hTvvUl1aXpVpEN6HKEP9EkvGbGw6GxolAF8WmujSu/ysUmJ8+dlEY 3YMg== X-Gm-Message-State: AOJu0Yzj/ZA8yfiFbXUBgtro7BVZdJq+ZbsbHZa9XV4yy7QHXLAIf+Mw tzceXn6wEHLc3cZPXxvKCmHdlxvyidrPXjWsE18Duw== X-Google-Smtp-Source: AGHT+IF9wEq71XeLSA2JRyH/8tuqMxBmr1MSl+JsT5AEZO7NdrnyqrzjWa2cJNxZfLGeteypMadWPA== X-Received: by 2002:a05:6a21:7187:b0:159:fe1d:2f32 with SMTP id wq7-20020a056a21718700b00159fe1d2f32mr1825544pzb.42.1697548010002; Tue, 17 Oct 2023 06:06:50 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:7f2e:11d:92b4:4d78:4197]) by smtp.gmail.com with ESMTPSA id l28-20020a635b5c000000b0056b6d1ac949sm1309788pgm.13.2023.10.17.06.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 06:06:49 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Siddhesh Poyarekar Subject: [PATCH v2 17/19] elf: Add comments on how LD_AUDIT and LD_PRELOAD handle __libc_enable_secure Date: Tue, 17 Oct 2023 10:05:24 -0300 Message-Id: <20231017130526.2216827-18-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017130526.2216827-1-adhemerval.zanella@linaro.org> References: <20231017130526.2216827-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org To make explicit why __libc_enable_secure is not checked. Reviewed-by: Siddhesh Poyarekar --- elf/rtld.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/elf/rtld.c b/elf/rtld.c index 638b019670..d1017ba9e9 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -2563,6 +2563,10 @@ process_envvars (struct dl_main_state *state) process_dl_debug (state, &envline[6]); break; } + /* For __libc_enable_secure mode, audit pathnames containing slashes + are ignored. Also, shared audit objects are only loaded only from + the standard search directories and only if they have set-user-ID + mode bit enabled. */ if (memcmp (envline, "AUDIT", 5) == 0) audit_list_add_string (&state->audit_list, &envline[6]); break; @@ -2576,7 +2580,10 @@ process_envvars (struct dl_main_state *state) break; } - /* List of objects to be preloaded. */ + /* For __libc_enable_secure mode, preload pathnames containing slashes + are ignored. Also, shared objects are only preloaded from the + standard search directories and only if they have set-user-ID mode + bit enabled. */ if (memcmp (envline, "PRELOAD", 7) == 0) { state->preloadlist = &envline[8];