Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp819452ybm; Wed, 22 May 2019 12:04:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxF1y3+Tn+Egcq6LFslma9aZBKZyQTClAhiuYpRlrEaoFR9U91XaroAX51/lrBRFFguBQi8 X-Received: by 2002:a62:38d3:: with SMTP id f202mr52362599pfa.41.1558551842916; Wed, 22 May 2019 12:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558551842; cv=none; d=google.com; s=arc-20160816; b=Z+xBhzmQO7WFiNKXPgOcEaD1lNtqXy82o2uv3symhRO/WJ2Z5LqjMBiDIHZ+Y1036C H0JYROD9JpGIBHgNHiM/tZ6Q29ItQTEkS5/34lia51sORaa9fOlmypuhrHpGrg+aRYeb 1/ez2+EH263iuLqDtIEYHDBZGFJlXH/60poy9DYxGf1fFOrBHQKIOTqrcXjHQ7bo9c9b hqqF5WuOl5DC3rjpxEkRth2ti+Na4xPHAfIq7+sYJK7xRQ2MsOHzBw01+yf0so4KWHyq Mb4tBi1pJTu4wxOSySSgDi/aJHlzkUX9CH0vHmwd7VHCErhuacPndoc42rqKQ1UZ7HdH tRJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=wIfrMLKIhnLFItaUwZ3SnF6lNwn3U+d0bettAEO9eVA=; b=GkRpjV0mMhdGgpk+FRK7ZsbJZxLnSSCRHXUSPJgNp9ZfDPbYCCoNkk3B3Y/Hn1SOol dJI1V7rk6jX1hJWiWiNNjDLDu2UPBg8rGCikKghpr2XMR1sknOiby16reWYATloO90pi obyTw3PbvRcJkXgupgYLTFFqbSV6Ndm8A05/Bty6xmLrfk5NwwQuKMsBNs7jHV6Xfhcf At/0TEc3hhT7J38wjOBf1JGcqrDwaq0ur5ur2b9u9ITPQd5700oE6ExJs+TTjsBU/8JO GIN3aR9viNb08BkXkWoDN9S8fCoyfI6ptOhiAi6w9YDNTYS4VbpHGo5DmfkOuZYYqYDO Iycw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si25422848plo.211.2019.05.22.12.03.47; Wed, 22 May 2019 12:04:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729691AbfEVTCb (ORCPT + 99 others); Wed, 22 May 2019 15:02:31 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:56520 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728615AbfEVTCa (ORCPT ); Wed, 22 May 2019 15:02:30 -0400 Received: (qmail 10222 invoked by uid 2102); 22 May 2019 15:02:29 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 22 May 2019 15:02:29 -0400 Date: Wed, 22 May 2019 15:02:29 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Eric W. Biederman" cc: linux-usb@vger.kernel.org, Greg Kroah-Hartman , Oliver Neukum , Subject: Re: [PATCH] signal/usb: Replace kill_pid_info_as_cred with kill_pid_usb_asyncio In-Reply-To: <877eakou9o.fsf@xmission.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 May 2019, Eric W. Biederman wrote: > The usb support for asyncio encoded one of it's values in the wrong > field. It should have used si_value but instead used si_addr which is > not present in the _rt union member of struct siginfo. > > The practical result of this is that on a 64bit big endian kernel > when delivering a signal to a 32bit process the si_addr field > is set to NULL, instead of the expected pointer value. > > This issue can not be fixed in copy_siginfo_to_user32 as the usb > usage of the the _sigfault (aka si_addr) member of the siginfo > union when SI_ASYNCIO is set is incompatible with the POSIX and > glibc usage of the _rt member of the siginfo union. > > Therefore replace kill_pid_info_as_cred with kill_pid_usb_asyncio a > dedicated function for this one specific case. There are no other > users of kill_pid_info_as_cred so this specialization should have no > impact on the amount of code in the kernel. Have kill_pid_usb_asyncio > take instead of a siginfo_t which is difficult and error prone, 3 > arguments, a signal number, an errno value, and an address enconded as > a sigval_t. The encoding of the address as a sigval_t allows the > code that reads the userspace request for a signal to handle this > compat issue along with all of the other compat issues. > > Add BUILD_BUG_ONs in kernel/signal.c to ensure that we can now place > the pointer value at the in si_pid (instead of si_addr). That is the > code now verifies that si_pid and si_addr always occur at the same > location. Further the code veries that for native structures a value > placed in si_pid and spilling into si_uid will appear in userspace in > si_addr (on a byte by byte copy of siginfo or a field by field copy of > siginfo). The code also verifies that for a 64bit kernel and a 32bit > userspace the 32bit pointer will fit in si_pid. Okay, I have gone through this. Although I still don't really understand the detailed issues concerning the layout of the data fields (probably hopeless without seeing a diagram), the USB portions of the patch look good and do what the patch description says. Acked-by: Alan Stern Alan Stern