Don't segfault when product name from BIOS is empty#15929
Don't segfault when product name from BIOS is empty#15929nicolasnoble merged 2 commits intogrpc:masterfrom
Conversation
Somehow some Dell servers we're trying to run a gRPC client on have an empty product name in the BIOS. When gRPC tries to creadte default credentials, it checks whether it's running on GCE by strcmp()ing the contents of /sys/class/dmi/id/product_name to some magic strings. When it reads that file, it gets only a newline; in trim() it skips over the newline in both directions, and since end < start it returns nullptr. This causes a segfault in the strcmp() call. Since a machine without a product name clearly isn't GCE, change it to return false instead.
|
yihuazhang
left a comment
There was a problem hiding this comment.
Please make sure the PR passes all tests before merging it.
|
|
|
PTAL. Clang format diffs were the only failing test in the sanity check. |
|
|
|
|
|
@srini100 any plans to backport this PR to v1.14.x? We are running into crashes with v1.14.1 and they seem to be related to this problem. |
|
@coryan, will do an RC hopefully by tomorrow and release 1.14.2 patch after a few days. Have you verified the fix on master or using nightly builds from https://packages.grpc.io/ ? |
Don't segfault when product name from BIOS is empty
|
@coryan, 1.14.2 RC is now available. |
|
@srini100, good news, it works for us. Thanks for the quick turnaround. |
|
Would it be possible to merge this fix to 1.13 which is still used by TensorFlow? |
|
We'll work with tensorflow on getting them to a newer version of grpc. |
|
Thanks Nicolas! |
Somehow some Dell servers we're trying to run a gRPC client on have an empty product name in the BIOS. When gRPC tries to create default credentials, it checks whether it's running on GCE by strcmp()ing the contents of /sys/class/dmi/id/product_name to some magic strings. When it reads that file, it gets only a newline; in trim() it skips over the newline in both directions, and since end < start it returns nullptr. This causes a segfault in the strcmp() call. Since a machine without a product name clearly isn't GCE, change it to return false instead.