OS-6158: signed math leads getelfshdr astray

Details

Issue Type:Bug
Priority:3 - Elevated
Status:Resolved
Created at:2017-06-01T02:58:22.000Z
Updated at:2019-04-04T22:03:45.031Z

People

Created by:Former user
Reported by:Former user
Assigned to:Former user

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2019-03-18T19:09:42.040Z)

Fix Versions

2019-03-28 Operation Righteous Cowboy Lightning (Release Date: 2019-03-28)

Related Issues

Description

As several crashdumps have demonstrated, there are several parts of the in-kernel ELF handling which could benefit from having their unnecessary and incorrect use of signed types be cleaned up.

Comments

Comment by Dan McDonald
Created at 2017-06-01T17:07:41.000Z
Updated at 2019-03-18T19:08:21.874Z

The usr/src/uts/common/exec/elf/elf.c has several definitions of shstrndx:

http://src.illumos.org/source/more/illumos-gate/usr/src/uts/common/exec/elf/elf.c?defs=shstrndx

All of which appear to be int. Userspace versions of this local are either size_t or unsigned int. I'm guessing the kernel should change these to unsigned int, OR MAYBE uint32_t.


Comment by Former user
Created at 2017-06-01T17:09:54.000Z

Yeah, I plan to clamp down hard on any inappropriate signed types in the area while I'm fixing this.


Comment by Former user
Created at 2019-03-12T21:44:31.925Z

Added a patch which allows Melkor to build in a smartos zone.


Comment by Former user
Created at 2019-03-13T15:29:10.623Z

Using a test PI, I've done several melkor ELF fuzzer runs (including an interpreter with bogus data) which the latest code was able to handle. Additionally the latest 16.04-targetted quine relay was able to complete successfully in an LX zone.


Comment by Former user
Created at 2019-03-15T20:58:44.522Z

I ran a pbulk build of pkgsrc trunk on the test PI and found the results roughly comparable to the most recent run in the "production". (There were some differences due to missing sources or runtimes that are addressed in the production build env). After applying the updates @accountid:624ba422247a4b0069202447 suggested WRT elfreadhdr/elf32readhdr, I rebuilt the PI and re-tested the quine-relay under LX, which would have been the most likely victim had there been problems with the symbols.


Comment by Former user
Created at 2019-03-18T13:40:47.154Z

@accountid:624ba422247a4b0069202447 tested a COAL setup procedure using the test PI for this change and was successful in completing the process without incurring any errors or core dumps.


Comment by Jira Bot
Created at 2019-03-18T19:09:38.699Z

illumos-joyent commit 90e27ef5fc2bdeb7f9934f4e77140ef5f1aa9392 (branch master, by Patrick Mooney)

OS-6158 signed math leads getelfshdr astray
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Cody Peter Mello <melloc@writev.io>
Approved by: Mike Gerdts <mike.gerdts@joyent.com>