Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp739968pxf; Thu, 25 Mar 2021 12:57:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIm9MBdNs2fOe8zGcJdRvJKo8iaL5Ixu6CSedH2JeHtZZdVExCwv3/2GLOuXLs309mObOc X-Received: by 2002:a17:906:86c6:: with SMTP id j6mr10943390ejy.197.1616702238681; Thu, 25 Mar 2021 12:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616702238; cv=none; d=google.com; s=arc-20160816; b=EzZ5fHi4HdGTjcNWk0f9h48bPCmDnQkXbwKO9hLw/UUEyTJysnK7ou/acmv7HPKjiV CGhHOnTuOUd8Rk5dJ4IB/zkaaZHkEelSXUZfYSJFZYY8AQVG34jfgcwslMWvvQsWQbE0 fLaYs7Ku0Y0DzOxmbOBf5kd0Eog4/7VE3xtlYiVLrGjcRTawOkVqa/Q2SRFfJP88caXg 2BJTkn4NDSTahxVfFcNlS1qKiVaIIqItM47dUSq74Qu4VQCgschF8edHVypeSu9tY6oR DZBfFK8nd9nk++No9toebVMTxCq6oawly5/lTYOMBikB29p51JPOgbPIUaNYZZNfEKIA Zu0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=uSG5CEzsf76tkQIGnoKAE4N2Fll5W9OWcjsAwbJJ0BE=; b=hYK7teL2ajuzII42xP5/qqfFYk5awLLV6WHhaM2scrSKXHmEczQUPn5CeztWZMPu0P 5n9MklmTdUuY74139Dt9HK/FkDYkYlcqSDPeDwt0ykayVGKZB1ed8qIyBd5Ao9jWQUE3 oHGEHSk3qCokM/qx7+1LKr4X3zmbCzxRX5Tv/3fYl6uO1AGIh3uArOZ7vDLinVpInw6i ceFg6gi7Sw5xR2JunqTTC1RhESCLEOcBrhW+XuNXjsnMgDTnMFsUcRFqkeoklBP122m8 9bYKCUdBxZBXsg4d8VEKExDxgKJP0WQ22ioX5qGlq+IqvtuBgGtqOesRl0wRUrCnbSFB Kttg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=vHLaGUHC; dkim=pass header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=CrRmM76f; 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 b25si4942120ejv.506.2021.03.25.12.56.55; Thu, 25 Mar 2021 12:57:18 -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=@pobox.com header.s=sasl header.b=vHLaGUHC; dkim=pass header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=CrRmM76f; 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 S230263AbhCYTz5 (ORCPT + 99 others); Thu, 25 Mar 2021 15:55:57 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:63350 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbhCYTzp (ORCPT ); Thu, 25 Mar 2021 15:55:45 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 763B7132693; Thu, 25 Mar 2021 15:55:45 -0400 (EDT) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=rHRnYKKhAcD9UZjS9+xd9QNDSUM=; b=vHLaGU HCr5cnGtdMQKJrX3v1esXJw2dY0PyLDMCHv0gEzKibWyrOxRag2yRWQw+yEPJnJK 43CW4qawoJJvdDP/kWgwjcqWYLDANVEPSWXMDD1nKPWmzQnS92J+H85MvwcDWG/e gqAHm5bnw7fQBaUOBiIjI2UKAVl0uV+l/qF9Y= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 6FD1B132692; Thu, 25 Mar 2021 15:55:45 -0400 (EDT) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=YztIcC1Qncz7Kox/lNy2qQQLh9Y1lY5UmmJSBkF/+n8=; b=CrRmM76fixQYJMjKNWqzL/oeiTOddILivMPIz02iWrGjDus4o93HC4+HnHMmTnYhIU6C/noi3aLtKDQgF8JG6gNFh+VGtqm6yRZwnuQT2N59VdwD3n3DRs+V+9K+izkepDxrck00XY40H0kBZCet+AIb/+twlIp8eVcYtrLqdz4= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 65A9B132691; Thu, 25 Mar 2021 15:55:42 -0400 (EDT) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id B071F2DA0080; Thu, 25 Mar 2021 15:55:40 -0400 (EDT) Date: Thu, 25 Mar 2021 15:55:40 -0400 (EDT) From: Nicolas Pitre To: Jann Horn cc: Russell King - ARM Linux admin , Linux ARM , kernel list , Tavis Ormandy Subject: Re: ARM FDPIC_FUNCPTRS personality flag handling looks broken In-Reply-To: Message-ID: <72pn55r-r95-9ns6-7p9r-4940r6834nq9@syhkavp.arg> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 1493E7B0-8DA4-11EB-BC11-E43E2BB96649-78420484!pb-smtp20.pobox.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 25 Mar 2021, Jann Horn wrote: > Hi! > > Tavis noticed that on ARM kernels with CONFIG_BINFMT_ELF_FDPIC, it > looks like the FDPIC_FUNCPTRS personality flag is not reset on > execve(). This would mean that if a process first executes an ELF > FDPIC binary (which forces the personality to PER_LINUX_FDPIC), and > then executes a non-FDPIC binary, the signal handling code > (setup_return()) will have bogus behavior (interpreting a normal > function pointer as an FDPIC function handle). > > I think FDPIC_FUNCPTRS should probably either be reset on every > execve() or not be a personality flag at all (since AFAIU pretty much > the whole point of personality flags is that they control behavior > even across execve()). I think you're right. This is probably true for SH as well. I'd recommend the former solution as being the least intrusive one. Nicolas