Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp349933pxj; Fri, 7 May 2021 09:59:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWts7ZFFAWsI22xt6s7OhbRegp8O5OuRz7nbrENz3uyqgRSTk0UGUbE1tK2ioEGehxhdy7 X-Received: by 2002:a17:90a:974a:: with SMTP id i10mr11528236pjw.11.1620406764783; Fri, 07 May 2021 09:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620406764; cv=none; d=google.com; s=arc-20160816; b=IbRVdVz1HmjrIGgzHU04qUu2OOfXhEKYvEKxeA6TEilkXBqmulMflJ8YgpkIgHPrB1 f1KujZpd+jixg/fVOSyK5+uJDL8yslzf9U6mC4ZXsKGop3J/QqwCKOrNtVBtPtnpYMIM T03BwqRetajXAwTghGG4lPC5fUHMYYxZfMw+A9naFG1xRlETJl4GNGbwWb+YSWbRxheM gpBgoyrKBg5MjVNEwYjmU/pkxoGqIZgpALqf25x8rmzVkAx1LAbdr+LavOGLQppKV1B/ X2IfjSVVF/VHELfuU1lOCNl4zluitVceHc/gQ22C4JAi8lHOIeMrwyP5YfJP9YvgVGBu bRPQ== 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=GLhWfHwcaV8aKPVU7+Ft0vYJAChyhrhw9hcFw4aRmbo=; b=RNN74YAHC5Ge/1OyP39RLtCdiBLPcWp9tdZHMYkio6fI0/ODqIgVtbJSQ4TLM3xBej yIFHF9OErnX/vluxOgDpexfofD9xNK2yz1v9cseIEuZ5X1/4NbdoWcGtq3Hr+JPbt4MJ XksmcPXxvUxp/Her8ueSf+bKP+BTBj87LBBYFspfvrMfwnZK/WELAbwDCFYRr0GPlzDw /UW2YRM270Y3uIz9+MqNOdyzGM6gU99x6AYLd8rvM4ChVXUUK9mqCsxD/iG5qK+Lc+Xa CZWNTMrN7PCOQNsui3jXTzR4FCyDVu7HeVqEHEalyvG2pf08I8hexid/hb1r7uNch5Fp cPJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=irasaOWx; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si7167995pgj.23.2021.05.07.09.59.11; Fri, 07 May 2021 09:59:24 -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=@redhat.com header.s=mimecast20190719 header.b=irasaOWx; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236776AbhEGM7k (ORCPT + 99 others); Fri, 7 May 2021 08:59:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34309 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236731AbhEGM7j (ORCPT ); Fri, 7 May 2021 08:59:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620392319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GLhWfHwcaV8aKPVU7+Ft0vYJAChyhrhw9hcFw4aRmbo=; b=irasaOWxzwPAiNVGanYXsDHtcf9sY2z7n1v37Sjs3pfuQ77zfuc10TPb24hlpF8uPkVjGn lZPcZFJtF87vGiYgU5j8XIc9KdKev/8gZZFCGNIZQQaLtPl93H9tE1AG9j2gHfnBthk5NY kAe7iNPgxHUVlH26LTDMPrc0lxHv6a0= Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-191-QroS9fnvNQitpBCZk8-TBg-1; Fri, 07 May 2021 08:58:37 -0400 X-MC-Unique: QroS9fnvNQitpBCZk8-TBg-1 Received: by mail-yb1-f200.google.com with SMTP id d89-20020a25a3620000b02904dc8d0450c6so9888965ybi.2 for ; Fri, 07 May 2021 05:58:37 -0700 (PDT) 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=GLhWfHwcaV8aKPVU7+Ft0vYJAChyhrhw9hcFw4aRmbo=; b=hjOfhsWd5zHcCkCOXGKDrCJAOeuXpshJrtnx6+g5J6D5fTez0HkEFFDVj6TJ5woI0f BhAxP+j1++QU60S6G3KaloUlKHxYXgHlMoWxjefzmo0WBX1ePVkZBg4u31SjL3GaxqlT QkTG13E44KKM5wXhCKLehlwB9NA6+xwW7Srf1z7doAFpP38rkHUHUZ79/szMbnAFFqO6 XZmPRjsKopMFMidcegDwFrBHz1MeviyHjO0Cw8hWdp/KpAj6Kj+RcfcKBuY12V3045tZ ZTmHQdu90tRYSN6Vcx9ic8XPdb+lpeD5ofQXiSvEs1Dw6umWadgi3MtS2jn8nTeNQTbr ZJ/Q== X-Gm-Message-State: AOAM530iax3hY8ju94Sa5EqEl74mQLJ48Pg+NRLlF9gS7DSFLiy2h77f KcNVKR1+/QSohVyhpNIkn3PZ0aMDMJy6rELfGfnBE6fPEcS1RV93jTpEw9uxS+fathLp5pbdNuw 25dVHtjO/MnTKfBtnH/udtXQq+mHO46bkj8y2kdwf X-Received: by 2002:a25:640f:: with SMTP id y15mr13270245ybb.436.1620392317283; Fri, 07 May 2021 05:58:37 -0700 (PDT) X-Received: by 2002:a25:640f:: with SMTP id y15mr13270200ybb.436.1620392316934; Fri, 07 May 2021 05:58:36 -0700 (PDT) MIME-Version: 1.0 References: <20210507115719.140799-1-omosnace@redhat.com> In-Reply-To: From: Ondrej Mosnacek Date: Fri, 7 May 2021 14:58:23 +0200 Message-ID: Subject: Re: [PATCH] serial: core: fix suspicious security_locked_down() call To: Greg Kroah-Hartman Cc: linux-serial@vger.kernel.org, David Howells , Matthew Garrett , Kees Cook , Jiri Slaby , SElinux list , Linux Security Module list , James Morris , Linux FS Devel , Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 7, 2021 at 2:27 PM Greg Kroah-Hartman wrote: > On Fri, May 07, 2021 at 01:57:19PM +0200, Ondrej Mosnacek wrote: > > The commit that added this check did so in a very strange way - first > > security_locked_down() is called, its value stored into retval, and if > > it's nonzero, then an additional check is made for (change_irq || > > change_port), and if this is true, the function returns. However, if > > the goto exit branch is not taken, the code keeps the retval value and > > continues executing the function. Then, depending on whether > > uport->ops->verify_port is set, the retval value may or may not be reset > > to zero and eventually the error value from security_locked_down() may > > abort the function a few lines below. > > > > I will go out on a limb and assume that this isn't the intended behavior > > and that an error value from security_locked_down() was supposed to > > abort the function only in case (change_irq || change_port) is true. > > Are you _sure_ about this? > > Verification from the authors and users of this odd feature might be > good to have, as I am loath to change how this works without them > weighing in here. I'm not completely sure and I'm with you on not merging this without feedback from people involved in the original patch and/or whoever understands the logic in said function. -- Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.