<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src-test2/usr.sbin/crunch, branch master</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src-test2/atom?h=master</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src-test2/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/'/>
<updated>2020-12-10T09:31:05Z</updated>
<entry>
<title>Lift scope of buf[] to make it extend to a potential access via *basename</title>
<updated>2020-12-10T09:31:05Z</updated>
<author>
<name>Stefan Eßer</name>
<email>se@FreeBSD.org</email>
</author>
<published>2020-12-10T09:31:05Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=7483b9e4dcfb4c444f8b5d54117fb6c8c48c20e9'/>
<id>urn:sha1:7483b9e4dcfb4c444f8b5d54117fb6c8c48c20e9</id>
<content type='text'>
It can be assumed that the contents of the buffer was still allocated and
valid at the point of the out-of-scope access, so there was no security
issue in practice.

Reported by:	Coverity Scan CID 1437697
MFC after:	3 days
</content>
</entry>
<entry>
<title>crunchgen: fix NULL-deref bug introduced in r364647</title>
<updated>2020-12-04T15:53:37Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2020-12-04T15:53:37Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=f7ff7baaf62dd2e7b1f7b00c584cd4b968b4de1d'/>
<id>urn:sha1:f7ff7baaf62dd2e7b1f7b00c584cd4b968b4de1d</id>
<content type='text'>
While porting over the local changes from CheriBSD for upstreaming, I
accidentally committed a broken version of find_entry_point(): we have to
return NULL if the value is not found instead of a value with
ep-&gt;name == NULL, since the checks in main were changed to check ep instead
of ep-&gt;name for NULL.

This only matters if the crunched tool cannot be found using normal lookup
and one of the fallback paths is used, so it's unlikely to be triggered
in rescue. However, I noticed that one of our CheriBSD test scripts was
failing to run commands under `su` on minimal disk images where all
binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen.

This also updates the bootstrapping check in Makefile.inc1 to bootstrap
crunchgen up to the next version bump.

Reviewed By:	kevans
Differential Revision: https://reviews.freebsd.org/D27474
</content>
</entry>
<entry>
<title>crunchgen: fix MK_AUTO_OBJ logic after r364166</title>
<updated>2020-10-05T20:57:44Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2020-10-05T20:57:44Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=9c7bd4f198e14c4d59e6d25a90b39b4633360d12'/>
<id>urn:sha1:9c7bd4f198e14c4d59e6d25a90b39b4633360d12</id>
<content type='text'>
r364166 converted echo -n `/bin/pwd` to a raw pwd invocation, leaving a
trailing newline at the end of path.  This caused a later stat() of it to
erroneously fail and the fallback to MK_AUTO_OBJ=no logic proceeded as
unexpected.

Harry Schmalzbauer bissected the resulting build failure he experienced
(stable/12 host, -HEAD build) down to r365887. This change is mostly
unrelated, except it switches the build to bootstrapped crunchgen - clue!

I then bissected recent crunchgen changes going back a bit since we wouldn't
observe the failure immediately with -CURRENT in most configurations, which
landed me on r364166. After many intense head-scratching minutes and printf
debugging, I realized that the newline was the difference. This is where our
tale ends.

Reported by:	Harry Schmalzbauer, O. Hartmann, Mike Tancsa, kevans
MFC after:	3 days
</content>
</entry>
<entry>
<title>[rcorder] [crunch] Fix C function declarations to include void</title>
<updated>2020-09-21T17:59:45Z</updated>
<author>
<name>Adrian Chadd</name>
<email>adrian@FreeBSD.org</email>
</author>
<published>2020-09-21T17:59:45Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=0dcdda0984d779cd2024030535a7d270b18b273d'/>
<id>urn:sha1:0dcdda0984d779cd2024030535a7d270b18b273d</id>
<content type='text'>
This fixes a compile issue under gcc6 which complains about
legacy style C function declarations.

Differential Revision:	https://reviews.freebsd.org/D26504
</content>
</entry>
<entry>
<title>crunchgen(8): fix crunched application build with WARNS=6</title>
<updated>2020-09-10T18:19:45Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2020-09-10T18:19:45Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=fc90521002fbe200da4bf1bf76c9cf17db629dd3'/>
<id>urn:sha1:fc90521002fbe200da4bf1bf76c9cf17db629dd3</id>
<content type='text'>
This was revealed by the rescue build with a patch I'm working on to default
WARNS=6 everywhere. The issues resolved were:

- Missing prototype for _crunched_${ident}_stub in the *_stub.c generated
  bits
- Missing prototype for crunched_main
- Incomplete prototype for _crunched_${ident}_stub in the generated parts of
  crunched_main
- Literal strings in the stub table must drop const qualifier, unless we
  const'ify name
- f field in struct stub didn't have a proper prototype

Most of these issues are minor formalities and easily addressed.

I note that if my patch to eventually raise WARNS for the rescue build
lands, we'll need to bump the __FreeBSD_version requirement for
bootstrapping crunchgen and wipe out the rescue .OBJDIR if it's stale, which
we should be able to detect pretty easily from a couple of the issues that
have been fixed here.

Reviewed by:	arichardson
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26363
</content>
</entry>
<entry>
<title>Correctly determine the real executable in crunched binaries</title>
<updated>2020-08-24T09:20:23Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2020-08-24T09:20:23Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=50e525e40b4800bdf69bd1616e7382c284f13108'/>
<id>urn:sha1:50e525e40b4800bdf69bd1616e7382c284f13108</id>
<content type='text'>
This should fix cases like su setting argv[0] to _su for /bin/sh.
Previously cheribsdbox (a crunched tool we use in CheriBSD to reduce the
size of our minimal disk images to allow loading them onto FPGAs without
waiting forever for the transfer) would complain about _su not being
compiled in, but now that we also look at AT_EXECPATH it correctly
invokes the sh tool.

Note: we use use AT_EXECPATH instead of the KERN_PROC_PATHNAME sysctl to get
the crunchgen binary name since it seems like KERN_PROC_PATHNAME just
returns the last cached path for a given hardlink.
When using `su`, instead of invoking /bin/csh this would invoke the last
used hardlink to cheribsdbox. This caused weird test failures when running
tests due to `id` being executed instead of `echo`:

$ id  # id is a hardlink to /bin/cheribsdbox
$ su postgres -c 'echo 1' # su is also a hardlink
uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)

Obtained from: CheriBSD

Reviewed By:	emaste, brooks
Differential Revision: https://reviews.freebsd.org/D25998
</content>
</entry>
<entry>
<title>Re-indent crunched_main.c in preparation for D25998</title>
<updated>2020-08-24T09:20:18Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2020-08-24T09:20:18Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=b0f558df9f4edc9b1002af8f49855ade1dc6cbbd'/>
<id>urn:sha1:b0f558df9f4edc9b1002af8f49855ade1dc6cbbd</id>
<content type='text'>
</content>
</entry>
<entry>
<title>crunchgen: use pwd -P without env</title>
<updated>2020-08-14T09:45:41Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2020-08-14T09:45:41Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=0d5e65186195325557d4b0a8331d066a85818e01'/>
<id>urn:sha1:0d5e65186195325557d4b0a8331d066a85818e01</id>
<content type='text'>
The -P flag is required by POSIX so we don't have to care whether pwd is
a shell builtin or not. This also allows removing pwd from the list of
bootstrap tools since all shells we care about for building have a
builtin pwd command. This effectively reverts r364190.

Suggested By:	rgrimes, jrtc27
</content>
</entry>
<entry>
<title>Use env pwd instead of pwd in crunchgen.c</title>
<updated>2020-08-12T17:27:24Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2020-08-12T17:27:24Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=d5c62a6f032e9fac5cf108d4a3ef0126a54dea19'/>
<id>urn:sha1:d5c62a6f032e9fac5cf108d4a3ef0126a54dea19</id>
<content type='text'>
In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that
may not correctly return a real path. To ensure that all symlinks are
resolved use `env pwd -P` instead (the -P flag is part of POSIX so
should be supported everywhere).

Reported By:	rgrimes
Suggested By:	jrtc27
</content>
</entry>
<entry>
<title>Fix crunchgen usage of mkstemp()</title>
<updated>2020-08-12T15:49:06Z</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2020-08-12T15:49:06Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=188d6f4bc6bd8fd2e5c777b733164fb8b2782dd2'/>
<id>urn:sha1:188d6f4bc6bd8fd2e5c777b733164fb8b2782dd2</id>
<content type='text'>
On Glibc systems mkstemp can only be used once with the same template
string since it will be modified in-place and no longer contain any 'X' chars.
It is fine to reuse the same file here but we need to be explicit and use
open() instead of mkstemp() on the second use.

While touching this file also avoid a hardcoded /bin/pwd since that may not
work when building on non-FreeBSD systems.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25990
</content>
</entry>
</feed>
