Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2704638ybk; Mon, 18 May 2020 06:05:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHvyCUxq9vSBR/mQ0HgS8G0ZfXhyZdqPRj6zBIi6SIL2OBsy/t2qiCzziVLAWgq1IL+8qC X-Received: by 2002:a1c:a793:: with SMTP id q141mr19017905wme.135.1589807153014; Mon, 18 May 2020 06:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589807153; cv=none; d=google.com; s=arc-20160816; b=ZeoYFQIxd/7hhy/S5vhOtGWDxlQTO1tAZDlV44/MMUfNQKduTSGwqlKSabBKgp3RKH B53Ei2HppNpdJRHyKNIFKbk6wgr/Fh+DfbsqbINr3eGzxHFct3tnnKra1eaq7m889RDV ucWET9D1/945FFfT/cQ6fkNF5Oj3i55NMiou0IXx30FKo0ozIVm3pZshJSMhlR6jok1p idi/Y6PZuz+CdUsYFcmj5qyYDvpl68PeoUcVwPjxlwoKJfkqVjuECq6aDIv6/zSYIaEf TCTj+7SmDJTFvpeDytHS3vIx/LT1PAAryaeXZcfZJLB6vCpY5QKvN6ZmcFK3Lq63Csc/ CjSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DE7uK7PgZphHEbyHN4dmCYsC1gmSSGDrdiNz9MTxFQ0=; b=XNomQvmylRKpTQwkiGiilgRjI7DshJ5sWo8QB/hU0oxnKeqyZLkvhbCDUlXfF2a92M EeC6DDd8WJk0PpbqRQjT6pBFTLFOgprBQG/U9C27uWmlNciHhZfxxc1Xz0gVcq9ahRsV 9ySWcQGaUpCsl20Fvj/SjMOxC9vYfSa5EN64s5i/gegZAdbHhyBxsbNcEpZ2rDAfPSvz MQ4ifjSiFc5oldvJol05AtU/+JJ5X45lSugZw4KNZ5j2KefycKXejycJwOiwPBGgqQVP I9QmrZJKs63cAsTMFaSXdW9U/10tUuFNUWe4HbQgdT+tX6ntUT9qtUsnJzvPmx3F+4w0 X4sg== 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 l4si5671874edl.169.2020.05.18.06.05.28; Mon, 18 May 2020 06:05:52 -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 S1727869AbgERNDB (ORCPT + 99 others); Mon, 18 May 2020 09:03:01 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:60458 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbgERNDB (ORCPT ); Mon, 18 May 2020 09:03:01 -0400 Received: from ip5f5af183.dynamic.kabel-deutschland.de ([95.90.241.131] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jafPw-0006cd-7l; Mon, 18 May 2020 13:02:52 +0000 Date: Mon, 18 May 2020 15:02:51 +0200 From: Christian Brauner To: Kees Cook Cc: Al Viro , Andrew Morton , Tetsuo Handa , Eric Biggers , Dmitry Vyukov , linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] exec: Change uselib(2) IS_SREG() failure to EACCES Message-ID: <20200518130251.zih2s32q2rxhxg6f@wittgenstein> References: <20200518055457.12302-1-keescook@chromium.org> <20200518055457.12302-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200518055457.12302-2-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 17, 2020 at 10:54:54PM -0700, Kees Cook wrote: > Change uselib(2)' S_ISREG() error return to EACCES instead of EINVAL so > the behavior matches execve(2), and the seemingly documented value. > The "not a regular file" failure mode of execve(2) is explicitly > documented[1], but it is not mentioned in uselib(2)[2] which does, > however, say that open(2) and mmap(2) errors may apply. The documentation > for open(2) does not include a "not a regular file" error[3], but mmap(2) > does[4], and it is EACCES. > > [1] http://man7.org/linux/man-pages/man2/execve.2.html#ERRORS > [2] http://man7.org/linux/man-pages/man2/uselib.2.html#ERRORS > [3] http://man7.org/linux/man-pages/man2/open.2.html#ERRORS > [4] http://man7.org/linux/man-pages/man2/mmap.2.html#ERRORS > > Signed-off-by: Kees Cook This is all extremely weird. uselib has been deprected since forever basically which makes me doubt this matters much but: Acked-by: Christian Brauner Also - gulp (puts on flame proof suit) - may I suggest we check if there are any distros out there that still set CONFIG_USELIB=y and if not do what we did with the sysctl syscall and remove it? If someone yells we can always backpaddle... Christian