-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SONiC buildimage ARM arch support #2980
SONiC buildimage ARM arch support #2980
Conversation
ARM 32 bit/ARMHF architecture has been introduced
Support for ARM 32 bit/ARMHF architecture has been introduced Signed-off-by: arheneus <arheneus@marvell.com>
…tony-rheneus/sonic-buildimage into 2019_06_06_azure_sonic_master
Fix for HOST ARCH Signed-off-by: Antony Rheneus <arheneus@marvell.com>
…tony-rheneus/sonic-buildimage into 2019_06_06_azure_sonic_master
Merge branch '2019_06_06_azure_sonic_master' of https://github.com/antony-rheneus/sonic-buildimage into 2019_06_06_azure_sonic_master
…tony-rheneus/sonic-buildimage into 2019_06_06_azure_sonic_master
…tony-rheneus/sonic-buildimage into 2019_06_06_azure_sonic_master
…tony-rheneus/sonic-buildimage into 2019_06_06_azure_sonic_master
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
the default x64 build all fails, is that expected? |
@@ -0,0 +1,8 @@ | |||
# linux kernel package for marvell arm64 | |||
|
|||
KVERSION= 4.4.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4.4.8 [](start = 10, length = 5)
amd64 is already using 4.9.0. Could you use the same or newer version? #Pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Marvell ARM platform we are in process of analysing kernel migration to latest version.
Since we have tested with 4.4.8, I have retained it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your concern. Still I prefer the same version with all other platforms. If we introduce different ABI for master branch, some other component may have issues on this platform.
In reply to: 292588057 [](ancestors = 292588057)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some sonic features depends on the kernel especially vrf feature, what's your plan to bring kernel to 4.9.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have image running with kernel 4.14.76 and is ready now.
Do you still insist on 4.9 version, I have not started working on migrating to 4.9 kernel version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, what I am expecting is that we have your arm kernel compile from https://github.com/Azure/sonic-linux-kernel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated kernel version 4.9.168 as debian package.
In parallel working on to compile kernel from sonic-linux-kernel too.
|
Let me check again, I verified x86_64 before pushing. |
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
…ve j2 Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Cannot remove the dockerfiles, as jenkins build machine doesn't have jinja2 |
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
retest vs please |
[docker] multiarch/cross kernel arch docker daemon service cannot run in side docker, hence run on native Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
…emplate Signed-off-by: Antony Rheneus <arheneus@marvell.com>
jenkins Signed-off-by: Antony Rheneus <arheneus@marvell.com>
please remove *.pyc files |
I suggest you to use a new PR to add your sku. focus this PR on introduce new build arch support. The PR is already very large. adding more commits will delaying merging this PR. |
support Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Removed hwsku changes |
removed hwsku directory where *.pyc were present |
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
Bug is introduced in sonic-net#2980. Mellanox does not support setting MAC on switch create.
Bug is introduced in #2980. Mellanox does not support setting MAC on switch create.
return 0; | ||
} | ||
- strncpy(info->name, name, sizeof(info->name) - 1); | ||
+ strncpy(info->name, name, sizeof(info->name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antony-rheneus: Can you please explain why you made this change? Subtracting 1 from the size of the buffer ensures that the copied string will be NULL-terminated. This change could potentially result in a non-terminated buffer. It seems like there is now the potential for a crash with this change rather than without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excerpt from Man page strncpy:-
The strncpy() function is similar, except that at most n bytes of src are copied. Warning: If there is no null byte among the first n bytes of src, the string placed in dest will not be null-terminated.
Issue in Code:-
Max Interface name size is 16 bytes.
info->name is NOT initialized/memset to 0 (NULL).
If source string "name" has 15 bytes like in case of "PortChannel0001", then earlier code will copy only 15 bytes (max_size - 1). So it would not copy the Last NULL character from the 16th byte of source string "name"
This leads to seg fault/crash
There is a check above this line that Source string "name" will not go beyond max size 16 bytes.
And Source string should be NULL terminated by the caller.
Now this strncpy line should ensure to add NULL terminator at the last byte.
Your concern of Non-Terminated NULL buffer would arise only if source string "name" is NOT null terminated or is more than 15 bytes. But this would not happen as the below lines would catch it and return Error.
546 len = p - name;
547 if (len >= sizeof(info->name)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antony-rheneus: Thanks for the quick reply. I now understand your reasoning. However, a few lines below this, name
is also copied into tmp.ifr_name
in a similar fashion. However, in this case, the buffer is initialized to 0 beforehand:
memset(&tmp, 0, sizeof(tmp));
strncpy(tmp.ifr_name, name, sizeof(tmp.ifr_name) - 1);
Therefore, with your patch, these two strncpy operations differ, and at first glance it is not clear why. Thus, I think it makes more sense to keep these copy operations identical in behavior. So I suggest that we instead explicitly memset the buffer info->name
to 0 before doing the strncpy.
memset(&info->name, 0, sizeof(info->name));
strncpy(info->name, name, sizeof(info->name) - 1);
I think this is the most easily understood code, and an explicit memset of info->name
couldn't hurt, especially because they unnecessarily define it to be one byte longer than IFNAMSIZ
.
struct iface_info {
char name[IF_NAMESIZE+1]; /* name of the interface, e.g. "bge0" */
struct sockaddr_storage addr; /* address information */
struct sockaddr_storage netmask; /* netmask information */
isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */
};
What are your thoughts on my proposal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antony-rheneus In future, please don't include changes not related to main topic into a big PR like this. I approved at iteration 33, but you still made significant code changes after that. My approval is not applied to anything after that iteration.
I agree this strncpy
is a valid bug fix. I notice another occurrence, please check whether it is a bug.
strncpy(info->name, name, sizeof(info->name) - 1);
#ifdef SKIP_DUMMY_INTERFACES
} while (strncmp(info->name, "dummy", 5) == 0);
#else
} while (0);
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft: As I mentioned above, I believe the proper fix is to leave the strncpy calls untouched and memset the buffer to 0 before each call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jleveque ,
From which file you referred iface_info? I could see below in SONIC dhcp submodule for name[IFNAMSIZ]
src/isc-dhcp/isc-dhcp/common/discover.c
399 /*
400 * Structure used to return information about a specific interface.
401 */
402 struct iface_info {
403 char name[IFNAMSIZ]; /* name of the interface, e.g. "eth0" */
404 struct sockaddr_storage addr; /* address information */
405 struct sockaddr_storage netmask; /* netmask information */
406 isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */
407 };
408
I agree with your proposal, by doing memset before strncpy.
However using strncpy in right way will avoid cpu cycles of memset operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antony-rheneus: I mistakenly quoted from the Solaris section at lines 227-230. The definition you quoted is the Linux definition, so the buffer is only IFNAMSIZ
is length.
I'm not very concerned about a few extra CPU cycles here, as interface discovery only occurs once when the relay agent starts.
Also, I respectfully disagree that your solution is the "right way" to use strncpy. This is debatable. I personally think the proper way to use strncpy is to explicitly write a NUL char after the strncpy call. This not only ensures there will be no overflow, but it is easy to read and understand what is taking place. In the case of this code, a memset first will accomplish the same thing, but if I wrote the code myself, I would have explicitly written a NUL char after the strncpy call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, The following upstream patch introduced a memset call before the strncpy call, much like I had suggested earlier in these comments: https://gitlab.isc.org/isc-projects/dhcp/-/commit/b7bfb2c74821ad6055c349dd2eddf2c749578762. This patch was included in the 4.4.0 release of isc-dhcp.
We are upgrading the dhcp_relay Docker container to be based off Debian Buster, for which the native version of isc-dhcp is currently 4.4.1-2. Therefore, I have requested this patch be removed as part of the upgrade, as it is no longer necessary.
docker/sonic-slave/Makefile
ARM Architecture support in SONIC
make configure platform=[ASIC_VENDOR_ARCH] PLATFORM_ARCH=[ARM_ARCH]
SONIC_ARCH: default amd64
armhf - arm32bit
arm64 - arm64bit